confluentinc / librdkafka

The Apache Kafka C/C++ library
Other
7.36k stars 3.11k forks source link

`configure.atomics` uses Linux-only flag on macOS which breaks configure #4759

Open barracuda156 opened 1 week ago

barracuda156 commented 1 week ago

-Wl,--as-needed is a linuxism and should not be used on macOS. However, it is added unconditionally. In result, configure fails:

--->  Configuring librdkafka
Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_librdkafka/librdkafka/work/librdkafka-2.3.0" && ./configure --prefix=/opt/local --enable-zstd --enable-lz4-ext --enable-ssl --enable-gssapi --disable-syslog --enable-curl 
checking for OS or distribution... ok (osx)
checking for C compiler from CC env... ok
checking for C++ compiler from CXX env... ok
checking executable ld... ok
checking executable nm... ok
checking executable objdump... failed (disable)
checking executable strip... ok
checking executable libtool... ok
checking executable ranlib... ok
checking for debug symbols compiler flag (-g...)... ok
checking for pkgconfig (by command)... ok
checking for install (by command)... failed
checking for GNU ar... failed (disable)
checking for PIC (by compile)... ok
checking for GNU-compatible linker options... failed
checking for OSX linker options... ok
checking for GNU linker-script ld flag... failed
checking for Solaris linker-script ld flag... failed (ignore)
checking for __atomic_32 (by compile)... ok
checking for __atomic_64 (by compile)... failed
checking for __atomic_64_lib (by compile)... ok
checking for socket (by compile)... failed
checking for socket_nsl (by compile)... failed (fail)
parsing version '0x020300ff'... ok (2.3.0)
checking for librt (by pkg-config)... failed
checking for librt (by compile)... failed
checking for libpthread (by pkg-config)... failed
checking for libpthread (by compile)... failed (fail)
checking for c11threads (by pkg-config)... failed
checking for c11threads (by compile)... failed (disable)
checking for libdl (by pkg-config)... failed
checking for libdl (by compile)... failed (disable)
checking for zlib (by pkg-config)... failed
checking for zlib (by compile)... failed (disable)
checking for libcrypto (by pkg-config)... failed
checking for libcrypto (by compile)... failed (fail)
checking for libsasl2 (by pkg-config)... failed
checking for libsasl2 (by compile)... failed (fail)
checking for libsasl (by pkg-config)... failed
checking for libsasl (by compile)... failed (fail)
checking for libzstd (by pkg-config)... failed
checking for libzstd (by compile)... failed (fail)
checking for libcurl (by pkg-config)... failed
checking for libcurl (by compile)... failed (fail)
checking for libm (by pkg-config)... failed
checking for libm (by compile)... failed (disable)
checking for liblz4 (by pkg-config)... failed
checking for liblz4 (by compile)... failed (disable)
checking for rapidjson (by compile)... failed (disable)
checking for crc32chw (by compile)... failed (disable)
checking for regex (by compile)... failed (disable)
checking for rand_r (by compile)... failed (disable)
checking for strndup (by compile)... failed (disable)
checking for strlcpy (by compile)... failed (disable)
checking for strerror_r (by compile)... failed (disable)
checking for strcasestr (by compile)... failed (disable)
checking for pthread_setname_gnu (by compile)... failed (disable)
checking for pthread_setname_darwin (by compile)... failed (disable)
checking for pthread_setname_freebsd (by compile)... failed (disable)
checking for nm (by env NM)... ok (cached)
checking for getrusage (by compile)... failed (disable)

###########################################################
###                  Configure failed                   ###
###########################################################
### Accumulated failures:                               ###
###########################################################
 socket_nsl () 
    module: socket
    action: fail
    reason:
compile check failed:
CC: CC
flags: 
/opt/local/bin/gcc-mp-13 -pipe -Os -arch ppc -I/opt/local/include -gstrict-dwarf -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wall -Werror _mkltmpEwPpRn.c -o _mkltmpEwPpRn.c.o -lsocket -lnsl -L../src -L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc -Wl,--as-needed  -latomic:
ld: warning: directory '../src' following -L not found
ld: library not found for -lsocket
collect2: error: ld returned 1 exit status
source: 
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
void foo (void) {
   int s = socket(0, 0, 0);
   close(s);
}

 libpthread () 
    module: self
    action: fail
    reason:
compile check failed:
CC: CC
flags: -lpthread
/opt/local/bin/gcc-mp-13 -pipe -Os -arch ppc -I/opt/local/include -gstrict-dwarf -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wall -Werror _mkltmp0ScW4V.c -o _mkltmp0ScW4V.c.o  -L../src -L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc -Wl,--as-needed -lpthread -latomic:
ld: warning: directory '../src' following -L not found
ld: unknown option: --as-needed
collect2: error: ld returned 1 exit status
source: #include <pthread.h>

 libcrypto () 
    module: self
    action: fail
    reason:
compile check failed:
CC: CC
flags: -lcrypto
/opt/local/bin/gcc-mp-13 -pipe -Os -arch ppc -I/opt/local/include -gstrict-dwarf -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wall -Werror _mkltmpSItDSB.c -o _mkltmpSItDSB.c.o  -L../src -L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc -Wl,--as-needed -lcrypto -latomic:
ld: warning: directory '../src' following -L not found
ld: unknown option: --as-needed
collect2: error: ld returned 1 exit status
source: 
#include <openssl/ssl.h>
#include <openssl/evp.h>
#if OPENSSL_VERSION_NUMBER < 0x1000100fL
#error "Requires OpenSSL version >= v1.0.1"
#endif

 libsasl2 (WITH_SASL_CYRUS) 
    module: self
    action: fail
    reason:
compile check failed:
CC: CC
flags: -lsasl2
/opt/local/bin/gcc-mp-13 -pipe -Os -arch ppc -I/opt/local/include -gstrict-dwarf -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wall -Werror _mkltmpD2HDk9.c -o _mkltmpD2HDk9.c.o  -L../src -L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc -Wl,--as-needed -lsasl2 -latomic:
ld: warning: directory '../src' following -L not found
ld: unknown option: --as-needed
collect2: error: ld returned 1 exit status
source: 
#include <stddef.h>
#include <sasl/sasl.h>

 libsasl (WITH_SASL_CYRUS) 
    module: self
    action: fail
    reason:
compile check failed:
CC: CC
flags: -lsasl
/opt/local/bin/gcc-mp-13 -pipe -Os -arch ppc -I/opt/local/include -gstrict-dwarf -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wall -Werror _mkltmpDM2J5Y.c -o _mkltmpDM2J5Y.c.o  -L../src -L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc -Wl,--as-needed -lsasl -latomic:
ld: warning: directory '../src' following -L not found
ld: unknown option: --as-needed
collect2: error: ld returned 1 exit status
source: 
#include <stddef.h>
#include <sasl/sasl.h>

 libzstd (WITH_ZSTD) 
    module: self
    action: fail
    reason:
compile check failed:
CC: CC
flags: -lzstd
/opt/local/bin/gcc-mp-13 -pipe -Os -arch ppc -I/opt/local/include -gstrict-dwarf -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wall -Werror _mkltmpQ6oMzk.c -o _mkltmpQ6oMzk.c.o  -L../src -L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc -Wl,--as-needed -lzstd -latomic:
ld: warning: directory '../src' following -L not found
ld: unknown option: --as-needed
collect2: error: ld returned 1 exit status
source: 
#include <zstd.h>
#include <zstd_errors.h>

void foo (void) {
     ZSTD_getFrameContentSize(NULL, 0);
}

 libcurl (WITH_CURL) 
    module: self
    action: fail
    reason:
compile check failed:
CC: CC
flags: -lcurl
/opt/local/bin/gcc-mp-13 -pipe -Os -arch ppc -I/opt/local/include -gstrict-dwarf -O2 -fPIC -Wall -Wsign-compare -Wfloat-equal -Wpointer-arith -Wcast-align -Wall -Werror _mkltmp0GyQg0.c -o _mkltmp0GyQg0.c.o  -L../src -L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc -Wl,--as-needed -lcurl -latomic:
ld: warning: directory '../src' following -L not found
ld: unknown option: --as-needed
collect2: error: ld returned 1 exit status
source: 
#include <curl/curl.h>

void foo (void) {
     curl_global_init(CURL_GLOBAL_DEFAULT);
}

###########################################################
### Installing the following packages might help:       ###
###########################################################
brew install  openssl zstd

Command failed:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_librdkafka/librdkafka/work/librdkafka-2.3.0" && ./configure --prefix=/opt/local --enable-zstd --enable-lz4-ext --enable-ssl --enable-gssapi --disable-syslog --enable-curl 
Exit code: 1
Error: Failed to configure librdkafka: consult /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_librdkafka/librdkafka/work/librdkafka-2.3.0/config.log
Error: Failed to configure librdkafka: configure failure: command execution failed

This is fixed by removing the flag.