Closed
Description
Describe the bug
aws_hton64()
in include/aws/common/byte_order.inl
uses _MSC_VER
not _WIN32
for Windows:
aws-c-common/include/aws/common/byte_order.inl
Lines 34 to 49 in 4c22f5c
We should use _WIN32
to support both of Visual C++ and MinGW.
#801 / #822 did it but these PRs missed aws_hton64()
.
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
No build error with MinGW.
Current Behavior
Build error:
[1/145] Building C object CMakeFiles/aws-c-common.dir/source/assert.c.obj
FAILED: CMakeFiles/aws-c-common.dir/source/assert.c.obj
C:\msys64\mingw32\bin\cc.exe -DAWS_AFFINITY_METHOD=AWS_AFFINITY_METHOD_NONE -DCJSON_HIDE_SYMBOLS -DINTEL_NO_ITTNOTI
FY_API -DPSAPI_VERSION=1 -DWINDOWS_KERNEL_LIB=kernel32 -IC:/msys64/home/kou/aws-c-common/source/external/libcbor -I
C:/msys64/home/kou/aws-c-common/include -IC:/msys64/home/kou/aws-c-common.build/generated/include -std=gnu99 -fvisi
bility=hidden -Wall -Wstrict-prototypes -fno-omit-frame-pointer -pedantic -Wno-long-long -fPIC -D_FILE_OFFSET_BITS=
64 -MD -MT CMakeFiles/aws-c-common.dir/source/assert.c.obj -MF CMakeFiles\aws-c-common.dir\source\assert.c.obj.d -o
CMakeFiles/aws-c-common.dir/source/assert.c.obj -c C:/msys64/home/kou/aws-c-common/source/assert.c
In file included from C:/msys64/home/kou/aws-c-common/include/aws/common/byte_order.h:71,
from C:/msys64/home/kou/aws-c-common/include/aws/common/byte_buf.h:9,
from C:/msys64/home/kou/aws-c-common/include/aws/common/system_info.h:9,
from C:/msys64/home/kou/aws-c-common/source/assert.c:8:
C:/msys64/home/kou/aws-c-common/include/aws/common/byte_order.inl: In function 'aws_hton64':
C:/msys64/home/kou/aws-c-common/include/aws/common/byte_order.inl:47:23: error: implicit declaration of function 'h
tonl' [-Wimplicit-function-declaration]
47 | return ((uint64_t)htonl(low)) << 32 | htonl(high);
| ^~~~~
[3/145] Building C object CMakeFiles/aws-c-common.dir/source/byte_buf.c.obj
FAILED: CMakeFiles/aws-c-common.dir/source/byte_buf.c.obj
C:\msys64\mingw32\bin\cc.exe -DAWS_AFFINITY_METHOD=AWS_AFFINITY_METHOD_NONE -DCJSON_HIDE_SYMBOLS -DINTEL_NO_ITTNOTI
FY_API -DPSAPI_VERSION=1 -DWINDOWS_KERNEL_LIB=kernel32 -IC:/msys64/home/kou/aws-c-common/source/external/libcbor -I
C:/msys64/home/kou/aws-c-common/include -IC:/msys64/home/kou/aws-c-common.build/generated/include -std=gnu99 -fvisi
bility=hidden -Wall -Wstrict-prototypes -fno-omit-frame-pointer -pedantic -Wno-long-long -fPIC -D_FILE_OFFSET_BITS=
64 -MD -MT CMakeFiles/aws-c-common.dir/source/byte_buf.c.obj -MF CMakeFiles\aws-c-common.dir\source\byte_buf.c.obj.
d -o CMakeFiles/aws-c-common.dir/source/byte_buf.c.obj -c C:/msys64/home/kou/aws-c-common/source/byte_buf.c
In file included from C:/msys64/home/kou/aws-c-common/include/aws/common/byte_order.h:71,
from C:/msys64/home/kou/aws-c-common/include/aws/common/byte_buf.h:9,
from C:/msys64/home/kou/aws-c-common/source/byte_buf.c:6:
C:/msys64/home/kou/aws-c-common/include/aws/common/byte_order.inl: In function 'aws_hton64':
C:/msys64/home/kou/aws-c-common/include/aws/common/byte_order.inl:47:23: error: implicit declaration of function 'h
tonl' [-Wimplicit-function-declaration]
47 | return ((uint64_t)htonl(low)) << 32 | htonl(high);
| ^~~~~
[6/145] Building C object CMakeFiles/aws-c-common.dir/source/allocator.c.obj
FAILED: CMakeFiles/aws-c-common.dir/source/allocator.c.obj
C:\msys64\mingw32\bin\cc.exe -DAWS_AFFINITY_METHOD=AWS_AFFINITY_METHOD_NONE -DCJSON_HIDE_SYMBOLS -DINTEL_NO_ITTNOTI
FY_API -DPSAPI_VERSION=1 -DWINDOWS_KERNEL_LIB=kernel32 -IC:/msys64/home/kou/aws-c-common/source/external/libcbor -I
C:/msys64/home/kou/aws-c-common/include -IC:/msys64/home/kou/aws-c-common.build/generated/include -std=gnu99 -fvisi
bility=hidden -Wall -Wstrict-prototypes -fno-omit-frame-pointer -pedantic -Wno-long-long -fPIC -D_FILE_OFFSET_BITS=
64 -MD -MT CMakeFiles/aws-c-common.dir/source/allocator.c.obj -MF CMakeFiles\aws-c-common.dir\source\allocator.c.ob
j.d -o CMakeFiles/aws-c-common.dir/source/allocator.c.obj -c C:/msys64/home/kou/aws-c-common/source/allocator.c
In file included from C:/msys64/home/kou/aws-c-common/include/aws/common/byte_order.h:71,
from C:/msys64/home/kou/aws-c-common/include/aws/common/byte_buf.h:9,
from C:/msys64/home/kou/aws-c-common/include/aws/common/thread.h:8,
from C:/msys64/home/kou/aws-c-common/include/aws/common/logging.h:11,
from C:/msys64/home/kou/aws-c-common/source/allocator.c:8:
C:/msys64/home/kou/aws-c-common/include/aws/common/byte_order.inl: In function 'aws_hton64':
C:/msys64/home/kou/aws-c-common/include/aws/common/byte_order.inl:47:23: error: implicit declaration of function 'h
tonl' [-Wimplicit-function-declaration]
47 | return ((uint64_t)htonl(low)) << 32 | htonl(high);
| ^~~~~
In file included from C:/msys64/mingw32/include/windows.h:92,
from C:/msys64/home/kou/aws-c-common/source/allocator.c:15:
C:/msys64/mingw32/include/winsock.h: At top level:
C:/msys64/mingw32/include/winsock.h:286:37: error: conflicting types for 'htonl'; have 'u_long(u_long)' {aka 'long
unsigned int(long unsigned int)'}
286 | WINSOCK_API_LINKAGE u_long WSAAPI htonl(u_long hostlong);
| ^~~~~
C:/msys64/home/kou/aws-c-common/include/aws/common/byte_order.inl:47:23: note: previous implicit declaration of 'ht
onl' with type 'int()'
47 | return ((uint64_t)htonl(low)) << 32 | htonl(high);
| ^~~~~
ninja: build stopped: subcommand failed.
FYI: Another build error log with Apache Arrow:
https://github.com/ursacomputing/crossbow/actions/runs/15502494926/job/43652596580#step:7:5884
cd /D/a/crossbow/crossbow/src/build-i686-cpp/_deps/aws-c-common-build && /D/a/crossbow/crossbow/sccache/sccache.exe /C/rtools40/mingw32/bin/cc.exe -DARROW_HAVE_RUNTIME_SSE4_2 -DARROW_HAVE_SSE4_2 -DARROW_WITH_TIMING_TESTS -DAWS_AFFINITY_METHOD=AWS_AFFINITY_METHOD_NONE -DCJSON_HIDE_SYMBOLS -DINTEL_NO_ITTNOTIFY_API -DPSAPI_VERSION=1 -DWINDOWS_KERNEL_LIB=kernel32 -D_CRT_SECURE_NO_WARNINGS @CMakeFiles/aws-c-common.dir/includes_C.rsp -O3 -DNDEBUG -O2 -ftree-vectorize -std=gnu99 -fvisibility=hidden -Wall -Wstrict-prototypes -pedantic -Wno-long-long -fPIC -D_FILE_OFFSET_BITS=64 -MD -MT _deps/aws-c-common-build/CMakeFiles/aws-c-common.dir/source/allocator.c.obj -MF CMakeFiles/aws-c-common.dir/source/allocator.c.obj.d -o CMakeFiles/aws-c-common.dir/source/allocator.c.obj -c /D/a/crossbow/crossbow/src/build-i686-cpp/_deps/aws-c-common-src/source/allocator.c
In file included from D:/a/crossbow/crossbow/src/build-i686-cpp/_deps/aws-c-common-src/include/aws/common/byte_order.h:71,
from D:/a/crossbow/crossbow/src/build-i686-cpp/_deps/aws-c-common-src/include/aws/common/byte_buf.h:9,
from D:/a/crossbow/crossbow/src/build-i686-cpp/_deps/aws-c-common-src/include/aws/common/thread.h:8,
from D:/a/crossbow/crossbow/src/build-i686-cpp/_deps/aws-c-common-src/include/aws/common/logging.h:11,
from D:/a/crossbow/crossbow/src/build-i686-cpp/_deps/aws-c-common-src/source/allocator.c:8:
D:/a/crossbow/crossbow/src/build-i686-cpp/_deps/aws-c-common-src/include/aws/common/byte_order.inl: In function 'aws_hton64':
D:/a/crossbow/crossbow/src/build-i686-cpp/_deps/aws-c-common-src/include/aws/common/byte_order.inl:47:23: warning: implicit declaration of function 'htonl'; did you mean 'wtoll'? [-Wimplicit-function-declaration]
return ((uint64_t)htonl(low)) << 32 | htonl(high);
^~~~~
wtoll
In file included from C:/rtools40/mingw32/i686-w64-mingw32/include/windows.h:92,
from D:/a/crossbow/crossbow/src/build-i686-cpp/_deps/aws-c-common-src/source/allocator.c:15:
C:/rtools40/mingw32/i686-w64-mingw32/include/winsock.h: At top level:
C:/rtools40/mingw32/i686-w64-mingw32/include/winsock.h:286:37: error: conflicting types for 'htonl'
WINSOCK_API_LINKAGE u_long WSAAPI htonl(u_long hostlong);
^~~~~
In file included from D:/a/crossbow/crossbow/src/build-i686-cpp/_deps/aws-c-common-src/include/aws/common/byte_order.h:71,
from D:/a/crossbow/crossbow/src/build-i686-cpp/_deps/aws-c-common-src/include/aws/common/byte_buf.h:9,
from D:/a/crossbow/crossbow/src/build-i686-cpp/_deps/aws-c-common-src/include/aws/common/thread.h:8,
from D:/a/crossbow/crossbow/src/build-i686-cpp/_deps/aws-c-common-src/include/aws/common/logging.h:11,
from D:/a/crossbow/crossbow/src/build-i686-cpp/_deps/aws-c-common-src/source/allocator.c:8:
D:/a/crossbow/crossbow/src/build-i686-cpp/_deps/aws-c-common-src/include/aws/common/byte_order.inl:47:23: note: previous implicit declaration of 'htonl' was here
return ((uint64_t)htonl(low)) << 32 | htonl(high);
^~~~~
Reproduction Steps
rm -rf aws-c-common.build && cmake -S aws-c-common -B aws-c-common.build && cmake --build aws-c-common.build
with 32bit MinGW.
Possible Solution
Use _WIN32
not _MSC_VER
.
Additional Information/Context
No response
aws-c-common version used
0.12.3
Compiler and version used
gcc.exe (Rev5, Built by MSYS2 project) 15.1.0
Operating System and version
MINGW32 on MSYS2