Opened 9 months ago

Last modified 9 months ago

#68345 assigned defect

librdkafka @2.2.0_0: building fails with Clang fails due to unused -stdlib flag

Reported by: zbaylin (Zach Baylin) Owned by: alexeyt820
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: cjones051073 (Chris Jones)
Port: librdkafka

Description

When installing librdkafka, the build step fails because the -stdlib flag is unused by Clang, and -Werror and -Wunused-command-line-argument are enabled.

Building with configure.cxx_stdlib="" succeeds, since the flag is conditionally set here: https://github.com/macports/macports-ports/blob/4fbdb7680519077095eaa3128d3d28b3a0fec25e/net/librdkafka/Portfile#L29-L31

This may be an issue with the new version of Clang included in macOS 14 (Sonoma).

Below is a relevant part of the log:

/usr/bin/clang -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64 -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -g -O2 -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wall -Werror _mkltmpuw2ulX.c -o _mkltmpuw2ulX.c.o  -L../src -L/opt/local/lib -Wl,-headerpad_max_install_names -stdlib=libc++ -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64 -lcurl :
clang: error: argument unused during compilation: '-stdlib=libc++' [-Werror,-Wunused-command-line-argument]

Change History (3)

comment:1 Changed 9 months ago by ryandesign (Ryan Carsten Schmidt)

Owner: set to alexeyt820
Status: newassigned

comment:2 Changed 9 months ago by cjones051073 (Chris Jones)

The warning is valid, as the stdlib option only relates to C++ code , where as above it is being passed to clang (not clang++) which is the C compiler.

The bug is in the portfile, at the line you link above, as the option is being incorrectly appended to the ldflags, whereas it should instead be appended to the cxxflags, which anyway should be done by default, so I question why this block was added at all ?.

Last edited 9 months ago by cjones051073 (Chris Jones) (previous) (diff)

comment:3 Changed 9 months ago by cjones051073 (Chris Jones)

Cc: cjones051073 added
Note: See TracTickets for help on using tickets.