Undefined symbols for architecture x86_64 on Mac OS - macos

I am trying to install stunnel software on Mac OS 10.10 and I am getting the following error
Undefined symbols for architecture x86_64
while executing make command from terminal.
below are the detailed logs:
Making all in src
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
/bin/sh ../libtool --tag=CC --mode=link gcc -g -O2 -D_THREAD_SAFE -pthread -Wall -Wextra -Wpedantic -Wformat=2 -Wconversion -Wno-long-long -Wno-deprecated-declarations -fstack-protector -fPIE - D_FORTIFY_SOURCE=2 -L/usr/local/openssl/lib64 -L/usr/local/openssl/lib -lssl -lcrypto -fPIE -pie -o stunnel stunnel-tls.o stunnel-str.o stunnel-file.o stunnel-client.o stunnel-log.o stunnel-options.o stunnel-protocol.o stunnel-network.o stunnel-resolver.o stunnel-ssl.o stunnel-ctx.o stunnel-verify.o stunnel-sthreads.o stunnel-fd.o stunnel-dhparam.o stunnel-cron.o stunnel-stunnel.o stunnel-pty.o stunnel-libwrap.o stunnel-ui_unix.o -lz
libtool: link: gcc -g -O2 -D_THREAD_SAFE -pthread -Wall -Wextra -Wpedantic -Wformat=2 -Wconversion - Wno-long-long -Wno-deprecated-declarations -fstack-protector -fPIE -D_FORTIFY_SOURCE=2 -fPIE -pie -o stunnel stunnel-tls.o stunnel-str.o stunnel-file.o stunnel-client.o stunnel-log.o stunnel-options.o stunnel-protocol.o stunnel-network.o stunnel-resolver.o stunnel-ssl.o stunnel-ctx.o stunnel-verify.o stunnel-sthreads.o stunnel-fd.o stunnel-dhparam.o stunnel-cron.o stunnel-stunnel.o stunnel-pty.o stunnel-libwrap.o stunnel-ui_unix.o -L/usr/local/openssl/lib64 -L/usr/local/openssl/lib -lssl -lcrypto -lz -pthread
clang: warning: argument unused during compilation: '-pthread'
clang: warning: argument unused during compilation: '-pie'
clang: warning: argument unused during compilation: '-pthread'
ld: warning: directory not found for option '-L/usr/local/openssl/lib64'
ld: warning: directory not found for option '-L/usr/local/openssl/lib'
Undefined symbols for architecture x86_64:
"_CRYPTO_THREADID_set_callback", referenced from:
_sthreads_init in stunnel-sthreads.o
"_CRYPTO_THREADID_set_numeric", referenced from:
_threadid_func in stunnel-sthreads.o
"_ERR_remove_thread_state", referenced from:
_client_run in stunnel-client.o
"_SSL_CTX_set_psk_client_callback", referenced from:
_context_init in stunnel-ctx.o
"_SSL_CTX_set_psk_server_callback", referenced from:
_context_init in stunnel-ctx.o
"_TLSv1_1_client_method", referenced from:
_parse_service_option in stunnel-options.o
"_TLSv1_1_server_method", referenced from:
_parse_service_option in stunnel-options.o
"_TLSv1_2_client_method", referenced from:
_parse_service_option in stunnel-options.o
"_TLSv1_2_server_method", referenced from:
_parse_service_option in stunnel-options.o
"_X509_STORE_get1_certs", referenced from:
_verify_callback in stunnel-verify.o
"_X509_check_email", referenced from:
_verify_callback in stunnel-verify.o
"_X509_check_host", referenced from:
_verify_callback in stunnel-verify.o
"_X509_check_ip_asc", referenced from:
_verify_callback in stunnel-verify.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[2]: *** [stunnel] Error 1
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1

You need to pass arguments to link with pthread and pie
not -pthread but -lpthread and not -pie but -lpie
Also there are no libs in /usr/local/openssl/ try to install them with brew or macports or just download the binaries.
The hints are there, right in front of You:
clang: warning: argument unused during compilation: '-pthread'
...
ld: warning: directory not found for option '-L/usr/local/openssl/lib64'

This problem was coming since installable has dependency on OpenSSL and it was not able to find libraries related to OpenSSL.
There can be two possible reasons for this problem-
1. OpenSSL is not installed in the system. In this case , OpenSSL needs to be installed first before installing stunnel.
OpenSSL is not installed in standard path.

Related

fmemopen error on mac os x

I'd like to compile some code using makefile.
Those codes are implemented from "Computing Inverse Optical Flow, Javier et al., 2013"
When I compiled codes, I got the error below, so I tried add "fmemopen" files from "https://github.com/materialsvirtuallab/pyhull/tree/master/src/fmemopen" as it said.
But I still have the same error, I think "_read_image_f in iio.o" is the problem here. I don't know how to figure out this problem. Please help me out.
jeongHyunseonui-MacBook-Pro:inverse_flow hyunseon$ make
g++ -Wall -Wextra -Wno-unused -pedantic -O4 -o backward_flow backward_flow.cpp iio.o -lpng -ljpeg -ltiff
clang: warning: -O4 is equivalent to -O3
Undefined symbols for architecture x86_64:
"_fmemopen", referenced from:
_read_image_f in iio.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: *** [backward_flow] Error 1

Building GCC-4.9.2 on OS X Yosemite

Ok, I'm having trouble building gcc-4.9.2 on Apple's new OS X Yosemite. I'm not sure if I need to be building a gnu-gcc compiler on OS X, as most other software has compiled fine, apart from tesseract-3.0.1 and some of my own wxWidgets applications. Are there certain programs/code features that clang can't compile?
My build steps are as follows:
cd build-gcc
../gcc-4.9.1/configure --program-prefix="gnu-" --prefix="/usr/local/gcc-4.9.1" --with-gmp="/usr/local" --with-mpfr="/usr/local" --with-mpc="/usr/local" CC=clang CXX=clang++
make
My build path and gcc source paths do not contain any whitespace, and I have installed GMP, MPFR and MPC in /usr/local.
My build outputs are:
clang++ -g -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -Wl,-no_pie -o cc1 c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c/c-array-notation.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-cilkplus.o c-family/array-notation-common.o c-family/cilk.o c-family/c-ubsan.o i386-c.o darwin-c.o \
cc1-checksum.o libbackend.a main.o tree-browser.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ./../intl/libintl.a -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lmpc -lmpfr -lgmp -L../zlib -lz
ld: warning: ld: warning: ld: warning: ignoring file libbackend.a, file was built for archive which is not the architecture being linked (x86_64): libbackend.aignoring file libcommon-target.a, file was built for archive which is not the architecture being linked (x86_64): libcommon-target.aignoring file ../libdecnumber/libdecnumber.a, file was built for archive which is not the architecture being linked (x86_64): ../libdecnumber/libdecnumber.a
ld: warning: ignoring file ../zlib/libz.a, file was built for archive which is not the architecture being linked (x86_64): ../zlib/libz.a
Undefined symbols for architecture x86_64:
... (Lots of symbols)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [cc1] Error 1
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2
Configure outputs the build type as: x86_64-apple-darwin14.0.0, so I don't understand why this is happening.
Thank You in advance for any help.
Turns out that I had a broken ranlib in /usr/local/bin - maybe GNU Binutils don't work on OS X? All I needed to do to fix the problem was to:
sudo mv /usr/local/bin/ranlib /usr/local/ranlib_old
and then make, and now I have a working GCC!

Linking argp library for gcc on OSX

I am having pretty much the same problem as in this question
Undefined symbols argp_parse and arpg_usage when installing rng-tools on OSX
but it's a different project. It seems the problem was solved by linking in argp, which I installed with homebrew. However, I can't link it properly. This is the error, where you can see how I've tried to link argp-standalone with -L.
gcc -std=gnu99 -pedantic -Wall -Wextra -Wmissing-prototypes -DRESDIR=\"/usr/local/share/tsim\"
-g -O2 -L/usr/local/opt/argp-standalone/lib -L/usr/X11R6/lib -lXaw -lXt -lXmu -lX11 -lXext
-o tsim tsim-AddToggleWidget.o tsim-DialogPopup.o tsim-file.o tsim-resources.o tsim-timer.o
tsim-tsim.o tsim-bitmap.o tsim-DrawingPalette.o tsim-Graph.o tsim-sound.o tsim-train.o
tsim-BitmapDirectory.o tsim-errcheck.o tsim-pipe.o tsim-Sprite.o tsim-tsim_argp.o
Undefined symbols for architecture x86_64:
"_argp_parse", referenced from:
_parse in tsim-tsim_argp.o
"_argp_usage", referenced from:
_parse_opt in tsim-tsim_argp.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[2]: *** [tsim] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

CUDA, OSX, MPI symbol(s) not found for architecture x86_64

Helllo, I have some code, that I'm trying to compile. The code runs well on Linux but I can't compile it on OSX.
In the makefile I use for Linux:
LD_FLAGS = -lcudart -L$(CUDA_HOME)/lib64
For Mac I try to use these flags:
LD_FLAGS = -lcudart -L$(CUDA_HOME)/lib
LD_FLAGS = -lm -F/Library/Frameworks -framework CUDA
CXXFLAGS = -O3 -g -m32 -I$(CUDA_HOME)/include
NVCC_FLAGS = -O3 -g -G -I$(CUDA_HOME)/include -arch=sm_11
This is the make output file:
mpic++ -c -o main.o main.cpp -O3 -m32 -I/Developer/NVIDIA/CUDA-5.0/include
/Developer/NVIDIA/CUDA-5.0/bin/nvcc -c -o kernel.o kernel.cu -O3 -I/Developer/NVIDIA/CUDA-5.0/include -arch=sm_11
ptxas /tmp/tmpxft_000026f4_00000000-5_kernel.ptx, line 146; warning : Double is not supported. Demoting to float
/Developer/NVIDIA/CUDA-5.0/bin/nvcc -c -o support.o support.cu -O3 -I/Developer/NVIDIA/CUDA-5.0/include -arch=sm_11
mpic++ main.o kernel.o support.o -o stencil-mpi -lcudart -L/Developer/NVIDIA/CUDA-5.0/lib
ld: warning: ld: warning: ignoring file kernel.o, file was built for i386 which is not the architecture being linked (x86_64): kernel.o
ignoring file main.o, file was built for i386 which is not the architecture being linked (x86_64): main.o
ld: warning: ignoring file support.o, file was built for i386 which is not the architecture being linked (x86_64): support.o
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [stencil-mpi] Error 1
This problem was caused by trying to mix 32 and 64 bit compilation between the CUDA and MPI toolchains. It was noted in comments that adding -m64 instead of -m32 for LD_FLAGS, CXXFLAGS, and NVCC_FLAGS produced a working 64 bit build.

Undefined symbols "_TLSv1_1_client_method" for x86_64 when compiling httpd on Mac os 10.8

The detail error message is below.
$ ./configure
$ make
then ...
/usr/share/apr-1/build-1/libtool --silent --mode=link /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc -lssl -lcrypto -lpthread \
-o ab ab.lo -L/usr/lib -R/usr/lib -laprutil-1 -lexpat -liconv -lsqlite3 -lldap -llber -llber -L/usr/lib -R/usr/lib -lapr-1 -lpthread
Undefined symbols for architecture x86_64:
"_TLSv1_1_client_method", referenced from:
_main in ab.o
"_TLSv1_2_client_method", referenced from:
_main in ab.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
APR and apr-util are required dependencies.
So - before building httpd on Mac,
port install APR
port install apr-util
Solved this.
Additionally, you might have to set the 'OPENSSL_ROOT_DIR' variable to '/opt/local'.
You can do that by giving '-DOPENSSL_ROOT_DIR=/opt/local' as command line argument when executing cmake.

Resources