Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[regression] Bulding socket.c fails on Amazon Linux 2023 (and other OSs) #655

Closed
gorloffslava opened this issue Jul 15, 2024 · 4 comments
Closed
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@gorloffslava
Copy link

Describe the bug

Looks like we've already had this bug before:

  1. posix/socket: fix missing include #506
  2. Int types #514

And looks like this commit reintroduces this issue: d04508d#diff-bbb6031b15894efd8c3b6ae10be38d407f72ac6c844513199348725cf044782c

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

Operating System and version

Amazon Linux 2023, 2023.5.20240708.0

@gorloffslava gorloffslava added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 15, 2024
@BwL1289
Copy link

BwL1289 commented Jul 15, 2024

Experiencing as well. Commenting for reach.

@waahm7
Copy link
Contributor

waahm7 commented Jul 15, 2024

Thank you for creating the issue, fixed in https://github.com/awslabs/aws-c-io/releases/tag/v0.14.13.

@waahm7 waahm7 closed this as completed Jul 15, 2024
@BwL1289
Copy link

BwL1289 commented Jul 15, 2024

Thank you!

@gorloffslava
Copy link
Author

@waahm7 thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants