It relies on that inttypes.h is included transitvely via net/if.h, which isn't the case on many OSs, including Amazon Linux 2023 amon others.
Expected Behavior
Compilation works
Current Behavior
Compilation fails with an error:
0.539 CMake Deprecation Warning at CMakeLists.txt:2 (cmake_minimum_required):
0.539 Compatibility with CMake < 3.5 will be removed from a future version of
0.539 CMake.
0.539
0.539 Update the VERSION argument <min> value or use a ...<max> suffix to tell
0.539 CMake that the project does not need compatibility with older versions.
0.539
0.539
0.625 -- The C compiler identification is Clang 19.0.0
0.664 -- Detecting C compiler ABI info
0.844 -- Detecting C compiler ABI info - done
0.858 -- Check for working C compiler: /opt/llvm_toolchain/bin/clang - skipped
0.858 -- Detecting C compile features
0.858 -- Detecting C compile features - done
0.868 -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
1.026 -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
1.027 -- Found Threads: TRUE
1.032 -- Found crypto: /usr/local/lib/libcrypto.so
1.032 -- LibCrypto Include Dir: /usr/local/include
1.032 -- LibCrypto Shared Lib: /usr/local/lib/libcrypto.so
1.032 -- LibCrypto Static Lib: /usr/local/lib/libcrypto.a
1.035 -- Performing Test HAS_FPIC_FLAG
1.186 -- Performing Test HAS_FPIC_FLAG - Success
1.186 -- Performing Test HAS_64BIT_FILE_OFFSET_BY_DEFAULT
1.340 -- Performing Test HAS_64BIT_FILE_OFFSET_BY_DEFAULT - Success
1.340 -- Looking for fseeko
1.496 -- Looking for fseeko - found
1.496 -- Looking for stdint.h
1.650 -- Looking for stdint.h - found
1.651 -- Looking for stdbool.h
1.802 -- Looking for stdbool.h - found
1.802 -- Performing Test HAS_WGNU
1.952 -- Performing Test HAS_WGNU - Success
1.952 -- Performing Test NO_GNU_EXPR
2.109 -- Performing Test NO_GNU_EXPR - Success
2.109 -- Performing Test HAVE_SYSCONF
2.266 -- Performing Test HAVE_SYSCONF - Success
4.014 -- Found OpenSSL: /usr/local/lib/libcrypto.so (found version "3.3.1")
4.017 -- Configuring done (3.5s)
4.070 -- Generating done (0.1s)
4.072 -- Build files have been written to: /tmp/eugo/staging/aws_c_io/source/aws-c-io-0.14.12/eugo_build
4.163 [1/30] Building C object CMakeFiles/aws-c-io.dir/source/tracing.c.o
4.167 [2/30] Building C object CMakeFiles/aws-c-io.dir/source/statistics.c.o
4.167 [3/30] Building C object CMakeFiles/aws-c-io.dir/source/alpn_handler.c.o
4.171 [4/30] Building C object CMakeFiles/aws-c-io.dir/source/async_stream.c.o
4.174 [5/30] Building C object CMakeFiles/aws-c-io.dir/source/retry_strategy.c.o
4.175 [6/30] Building C object CMakeFiles/aws-c-io.dir/source/posix/shared_library.c.o
4.175 [7/30] Building C object CMakeFiles/aws-c-io.dir/source/tls_channel_handler_shared.c.o
4.180 [8/30] Building C object CMakeFiles/aws-c-io.dir/source/pkcs11_tls_op_handler.c.o
4.181 [9/30] Building C object CMakeFiles/aws-c-io.dir/source/socket_shared.c.o
4.182 [10/30] Building C object CMakeFiles/aws-c-io.dir/source/io.c.o
4.184 [11/30] Building C object CMakeFiles/aws-c-io.dir/source/posix/socket.c.o
4.184 FAILED: CMakeFiles/aws-c-io.dir/source/posix/socket.c.o
4.184 /opt/llvm_toolchain/bin/clang -DAWS_CAL_USE_IMPORT_EXPORT -DAWS_COMMON_USE_IMPORT_EXPORT -DAWS_IO_EXPORTS -DAWS_IO_USE_IMPORT_EXPORT -DAWS_USE_EPOLL -DHAVE_SYSCONF -DINTEL_NO_ITTNOTIFY_API -DUSE_S2N -DUSE_VSOCK -Daws_c_io_EXPORTS -I/tmp/eugo/staging/aws_c_io/source/aws-c-io-0.14.12/include -O3 -mcpu=neoverse-v2 -mno-outline-atomics -flto=thin -ffat-lto-objects -funified-lto -Wl,--lto-whole-program-visibility -mllvm -polly -mllvm -polly-vectorizer=stripmine -pipe -Qunused-arguments -fident -fdiagnostics-color=always -fcolor-diagnostics -O3 -DNDEBUG -std=gnu99 -fPIC -fcolor-diagnostics -Wall -Wstrict-prototypes -Wextra -pedantic -Wno-long-long -fPIC -Wgnu -Wno-gnu-zero-variadic-macro-arguments -fvisibility=hidden -MD -MT CMakeFiles/aws-c-io.dir/source/posix/socket.c.o -MF CMakeFiles/aws-c-io.dir/source/posix/socket.c.o.d -o CMakeFiles/aws-c-io.dir/source/posix/socket.c.o -c /tmp/eugo/staging/aws_c_io/source/aws-c-io-0.14.12/source/posix/socket.c
4.184 /tmp/eugo/staging/aws_c_io/source/aws-c-io-0.14.12/source/posix/socket.c:345:74: error: expected ')'
4.184 345 | snprintf(tmp_endpoint.address, sizeof(tmp_endpoint.address), "%" PRIu32, s->svm_cid);
4.184 | ^
4.184 /tmp/eugo/staging/aws_c_io/source/aws-c-io-0.14.12/source/posix/socket.c:345:17: note: to match this '('
4.184 345 | snprintf(tmp_endpoint.address, sizeof(tmp_endpoint.address), "%" PRIu32, s->svm_cid);
4.184 | ^
4.184 1 error generated.
4.186 [12/30] Building C object CMakeFiles/aws-c-io.dir/source/posix/host_resolver.c.o
4.191 [13/30] Building C object CMakeFiles/aws-c-io.dir/source/stream.c.o
4.195 [14/30] Building C object CMakeFiles/aws-c-io.dir/source/exponential_backoff_retry_strategy.c.o
4.195 [15/30] Building C object CMakeFiles/aws-c-io.dir/source/posix/pipe.c.o
4.197 [16/30] Building C object CMakeFiles/aws-c-io.dir/source/message_pool.c.o
4.206 [17/30] Building C object CMakeFiles/aws-c-io.dir/source/socket_channel_handler.c.o
4.209 [18/30] Building C object CMakeFiles/aws-c-io.dir/source/standard_retry_strategy.c.o
4.212 [19/30] Building C object CMakeFiles/aws-c-io.dir/source/pem.c.o
4.216 [20/30] Building C object CMakeFiles/aws-c-io.dir/source/tls_channel_handler.c.o
4.216 [21/30] Building C object CMakeFiles/aws-c-io.dir/source/event_loop.c.o
4.225 [22/30] Building C object CMakeFiles/aws-c-io.dir/source/linux/epoll_event_loop.c.o
4.238 [23/30] Building C object CMakeFiles/aws-c-io.dir/source/future.c.o
4.275 [24/30] Building C object CMakeFiles/aws-c-io.dir/source/channel_bootstrap.c.o
4.279 [25/30] Building C object CMakeFiles/aws-c-io.dir/source/channel.c.o
4.280 [26/30] Building C object CMakeFiles/aws-c-io.dir/source/pkcs11_lib.c.o
4.323 [27/30] Building C object CMakeFiles/aws-c-io.dir/source/host_resolver.c.o
4.327 [28/30] Building C object CMakeFiles/aws-c-io.dir/source/s2n/s2n_tls_channel_handler.c.o
4.327 ninja: build stopped: subcommand failed.
Reproduction Steps
Try to build version after specified commit on AL2023 or other affected OSs.
Possible Solution
Adding #include <inttypes.h> back to source/posix/socket.c fixes compilation.
Additional Information/Context
No response
aws-c-io version used
0.14.12
Compiler and version used
Tested with the following: Clang 18.1.8, Clang 19.0.0git, GCC 14.1
Describe the bug
Looks like we've already had this bug before:
And looks like this commit reintroduces this issue: https://github.com/awslabs/aws-c-io/commit/d04508d113851f1bc15630d93490b2aa09676137#diff-bbb6031b15894efd8c3b6ae10be38d407f72ac6c844513199348725cf044782c
It relies on that
inttypes.h
is included transitvely vianet/if.h
, which isn't the case on many OSs, including Amazon Linux 2023 amon others.Expected Behavior
Compilation works
Current Behavior
Compilation fails with an error:
Reproduction Steps
Try to build version after specified commit on AL2023 or other affected OSs.
Possible Solution
Adding
#include <inttypes.h>
back tosource/posix/socket.c
fixes compilation.Additional Information/Context
No response
aws-c-io version used
0.14.12
Compiler and version used
Tested with the following: Clang 18.1.8, Clang 19.0.0git, GCC 14.1
Operating System and version
Amazon Linux 2023, 2023.5.20240708.0