wg / wrk

Modern HTTP benchmarking tool
Other
37.88k stars 2.94k forks source link

macOS 10.13.4 - Linker failed for architecture x86_64 #333

Open dertin opened 6 years ago

dertin commented 6 years ago

System Version: macOS 10.13.4 (17E199) Kernel Version: Darwin 17.5.0 Openssl 1.0.2o_1

Undefined symbols for architecture x86_64:
  "_OPENSSL_add_all_algorithms_noconf", referenced from:
      _ssl_init in ssl.o
  "_SSL_library_init", referenced from:
      _ssl_init in ssl.o
  "_SSL_load_error_strings", referenced from:
      _ssl_init in ssl.o
  "_SSLv23_client_method", referenced from:
      _ssl_init in ssl.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [wrk] Error 1
robwil commented 6 years ago

I was able to get this working by manually editing the Makefile to output the ld command.

@@ -7,7 +7,7 @@ ifeq ($(TARGET), sunos)
        CFLAGS += -D_PTHREADS -D_POSIX_C_SOURCE=200112L
        LIBS   += -lsocket
 else ifeq ($(TARGET), darwin)
-       LDFLAGS += -pagezero_size 10000 -image_base 100000000
+       LDFLAGS += -pagezero_size 10000 -image_base 100000000 -v

Now running make shows that this is the command which fails:

"/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -lto_library /Library/Developer/CommandLineTools/usr/lib/libLTO.dylib -dynamic -arch x86_64 -image_base 100000000 -macosx_version_min 10.13.0 -pagezero_size 10000 -o wrk -Lobj/lib -L/usr/local/opt/openssl/lib obj/wrk.o obj/net.o obj/ssl.o obj/aprintf.o obj/stats.o obj/script.o obj/units.o obj/ae.o obj/zmalloc.o obj/http_parser.o obj/bytecode.o obj/version.o -lluajit-5.1 -lpthread -lm -lcrypto -lssl -lSystem /Library/Developer/CommandLineTools/usr/lib/clang/9.1.0/lib/darwin/libclang_rt.osx.a

I rearranged the two -L lines, so that the openssl library path was before the local obj/lib path.

"/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -lto_library /Library/Developer/CommandLineTools/usr/lib/libLTO.dylib -dynamic -arch x86_64 -image_base 100000000 -macosx_version_min 10.13.0 -pagezero_size 10000 -o wrk -L/usr/local/opt/openssl/lib -Lobj/lib obj/wrk.o obj/net.o obj/ssl.o obj/aprintf.o obj/stats.o obj/script.o obj/units.o obj/ae.o obj/zmalloc.o obj/http_parser.o obj/bytecode.o obj/version.o -lluajit-5.1 -lpthread -lm -lcrypto -lssl -lSystem /Library/Developer/CommandLineTools/usr/lib/clang/9.1.0/lib/darwin/libclang_rt.osx.a

This command successfully runs, and creates the working wrk executable.

jerryleooo commented 5 years ago

@robwil can show the final patch? Thanks!