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
Related
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
I'm trying to install libevent-2.0.12-stable on Centos, but when i type sudo make,error happens(I did ./configure before make):
/bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 -Wall -fno-strict-aliasing -pthread -version-info 6:1:1 -release 2.0 -o libevent.la -rpath /usr/local/libevent-2.0.12-stable/lib event.lo evthread.lo buffer.lo bufferevent.lo bufferevent_sock.lo bufferevent_filter.lo bufferevent_pair.lo listener.lo bufferevent_ratelim.lo evmap.lo log.lo evutil.lo evutil_rand.lo strlcpy.lo select.lo poll.lo epoll.lo signal.lo event_tagging.lo http.lo evdns.lo evrpc.lo -lrt
libtool: link: gcc -shared -fPIC -DPIC .libs/event.o .libs/evthread.o .libs/buffer.o .libs/bufferevent.o .libs/bufferevent_sock.o .libs/bufferevent_filter.o .libs/bufferevent_pair.o .libs/listener.o .libs/bufferevent_ratelim.o .libs/evmap.o .libs/log.o .libs/evutil.o .libs/evutil_rand.o .libs/strlcpy.o .libs/select.o .libs/poll.o .libs/epoll.o .libs/signal.o .libs/event_tagging.o .libs/http.o .libs/evdns.o .libs/evrpc.o -lrt -O2 -pthread -pthread -Wl,-soname -Wl,libevent-2.0.so.5 -o .libs/libevent-2.0.so.5.1.1
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/librt.a(clock_gettime.o): relocation R_X86_64_PC32 against undefined symbol `__errno_location##GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make[2]: *** [libevent.la] Error 1
make[2]: Leaving directory `/home/lpchou/software/httpsqs/libevent-2.0.12-stable'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/lpchou/software/httpsqs/libevent-2.0.12-stable'
make: *** [all] Error 2
Can anyone help? Thanks.
Update
After i install libevent successfully with rpm package as mentioned by #KnudLarsen, i try to install tokyocabinet using make, however same error happens:
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libm.a(s_sin.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libm.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [libtokyocabinet.so.9.10.0] Error 1
I tried methods in Recompiling with -fPIC, but doesn't work. It seems there lacks some dependent packages, for i just install libevent and tokyocabinet in another centos machine and everything works fine.
CentOS 6.8 - 64bits :
tokyocabinet-1.4.32 builds OK : libtokyocabinet.so.8.23.0, libtokyocabinet.a
tokyocabinet-1.4.48 is also OK : libtokyocabinet.so.9.11.0, libtokyocabinet.a
... So I guess you have to install / reinstall your build requirements for gcc :
yum reinstall gcc-c++ glibc-devel glibc-headers kernel-headers
... to have the right files /usr/lib64/ and /usr/include/.
? Which version of tokyocabinet are you trying to build ? And where did you get it ?
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.
I tried to compile a pass source code in my MacOSX 10.8. I first had the problem that
iMac-de-Anne:pass_v1.2 elenacapel$ make
g++ src/pass.cpp -O9 -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DSHRIMP_BUGS=OFF -static -D NOSERVER -lpthread -o bin/pass
ld: library not found for -lcrt0.o
collect2: ld returned 1 exit status
make: *** [all] Error 1
But I could install the libraries missing by installing Xcode.
Now I have a different error while trying to compile the source code:
iMac-de-Anne:pass_v1.2 elenacapel$ make
g++ src/pass.cpp -O9 -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DSHRIMP_BUGS=OFF -static -D NOSERVER -lpthread -o bin/pass
error: invalid value '9' in '-O9'
make: *** [all] Error 1
Any helpful tips?
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!