FBGEMM
FBGEMM copied to clipboard
error: comparison of integer expressions of different signedness
In the QuantUtilsTest.cc on line 641 I am getting the error "error: comparison of integer expressions of different signedness: ‘std::vector
If any assistance can be provided, that would be awesome!
Which compiler version did you use and do you have more detailed repro? Thanks!
I recently had the same error message using clang. Switching to g++ seemed to fix the issue. @dkbattle
I get same on v4.3.4 (v4.3.1 is fine) from a different test:
In file included from ./external/unity/unity.h:16,
from tests/testutil_unity.hpp:36,
from tests/testutil.cpp:30:
tests/testutil.cpp: In function 'fd_t connect_socket(const char*, int, int)':
./external/unity/unity.h:134:130: error: comparison of integer expressions of different signedness: 'int' and 'const fd_t' {aka 'const long long unsigned int'} [-Werror=sign-compare]
134 | #define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal")
| ~~~~~~~~~~~^~~~~~~~~~~~
./external/unity/unity_internals.h:654:102: note: in definition of macro 'UNITY_TEST_ASSERT'
654 | #define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), (message));}
| ^~~~~~~~~
tests/testutil.cpp:389:5: note: in expansion of macro 'TEST_ASSERT_NOT_EQUAL'
389 | TEST_ASSERT_NOT_EQUAL (-1, s_pre);
| ^~~~~~~~~~~~~~~~~~~~~
tests/testutil.cpp: In function 'fd_t bind_socket_resolve_port(const char*, const char*, char*, int, int)':
./external/unity/unity.h:134:130: error: comparison of integer expressions of different signedness: 'int' and 'const fd_t' {aka 'const long long unsigned int'} [-Werror=sign-compare]
134 | #define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal")
| ~~~~~~~~~~~^~~~~~~~~~~~
./external/unity/unity_internals.h:654:102: note: in definition of macro 'UNITY_TEST_ASSERT'
654 | #define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)(line), (message));}
| ^~~~~~~~~
tests/testutil.cpp:446:5: note: in expansion of macro 'TEST_ASSERT_NOT_EQUAL'
446 | TEST_ASSERT_NOT_EQUAL (-1, s_pre);
| ^~~~~~~~~~~~~~~~~~~~
I am building zmq like:
#!/bin/bash
export SCRIPTDIR="$(pwd)"
export WORKDIR=${SCRIPTDIR}/build
export TYPES_OF_BUILD="x86_64"
export PREFIX=$WORKDIR/prefix_${TYPES_OF_BUILD}
export HOST=x86_64-w64-mingw32
ZMQ_SRC_DIR=$WORKDIR/libzmq
ZMQ_BRANCH=v4.3.4
ZMQ_COMMIT_HASH=4097855ddaaa65ed7b5e8cb86d143842a594eebd
cd $WORKDIR
rm -rf $ZMQ_SRC_DIR
git clone https://github.com/zeromq/libzmq.git ${ZMQ_SRC_DIR} -b ${ZMQ_BRANCH}
cd $ZMQ_SRC_DIR
git checkout ${ZMQ_COMMIT_HASH}
./autogen.sh
./configure \
--without-documentation \
--without-docs \
--disable-shared \
--disable-curve \
--prefix=${PREFIX} \
--host=${HOST} \
--enable-static \
--with-pic \
define=ZMQ_STATIC\
CFLAGS="-Wall -Wno-pedantic-ms-format -DLIBCZMQ_EXPORTS -DZMQ_DEFINED_STDINT" \
LDFLAGS="-lws2_32 -liphlpapi -lrpcrt4" #-L/usr/x86_64-w64-mingw32/lib \
#--without-libsodium \
make CROSS=x86_64-w64-mingw32.static- -j$THREADS
make install
# See http://vrecan.github.io/post/crosscompile_go_zeromq/
# See https://stackoverflow.com/questions/21322707/zlib-header-not-found-when-cross-compiling-with-mingw
Again, downgrading to v4.3.1 is a workaround for this issue.