When linking against poco, get RegularExpression error - osx-mavericks

I have tried building poco (poco-1.4.6p4) in several ways, all seem to build fine. However, when linking against it, all the different ways I have tried to build poco give error below. No matter what I choose, it appears that poco is being built with the clang++.
What is strange is that before I upgraded from Mountain Lion to Mavericks, none of this happened.
./configure --Darwin64 --shared
and
./configure --Darwin64-gcc --shared --no-tests
and
./configure --Darwin64-clang-libc++ --shared --no-tests
All the above seem to build fine.
But when I link against any of them, they all give the error below when linking against it.
Making all in compiler
/bin/sh ../libtool --tag=CXX --mode=link g++ -g -O2 -Wall -lfix8 -lPocoFoundation -lPocoNet -lPocoUtil -L../runtime -lz -o f8c f8c.o f8cutils.o f8precomp.o
libtool: link: g++ -g -O2 -Wall -o .libs/f8c f8c.o f8cutils.o f8precomp.o -Wl,-bind_at_load /Users/ivanfigueredo/Downloads/fix8/runtime/.libs/libfix8.dylib -lpthread -lPocoFoundation -lPocoNet -lPocoUtil -L../runtime -lz
Undefined symbols for architecture x86_64:
"Poco::RegularExpression::RegularExpression(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, bool)", referenced from:
FIX8::RegExp::RegExp(char const*, int) in f8c.o
"Poco::RegularExpression::match(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, std::vector<Poco::RegularExpression::Match, std::allocator<Poco::RegularExpression::Match> >&, int) const", referenced from:
_main in f8c.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make[1]: *** [f8c] Error 1
make: *** [all-recursive] Error 1

Configure generally will pay attention to CC and CXX environment variables to allow you to change compilers the software will build with. Try and adjust these settings.

Related

Compile Fortran Function using gfortran: object file was built for newer macOS version than being linked

Given a very simple fortran (95) function and a very simple c++ call to the program, I should be able to compile the program using:
g++ -c main1.cpp
gfortran -c test.f95
g++ main1.o test.o -o run
However, here I get the following error:
ld: warning: object file (test.o) was built for newer macOS version (11.5) than being linked (11.0)
Undefined symbols for architecture arm64:
"hello_()", referenced from:
_main in main1.o
"__gfortran_st_write", referenced from:
_hello_ in test.o
"__gfortran_st_write_done", referenced from:
_hello_ in test.o
"__gfortran_transfer_character_write", referenced from:
hello in test.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here, adding a -v tag before the -o tag and after the -o tag and the exe run did not solve the problem, as suggested by the error message.

QuantLib 1.9 install on OS X

The error clang: error: linker command failed with exit code 1 (use -v to see invocation)
on running the compile example, from http://quantlib.org/install/macosx.shtml,
g++ -I/opt/local/include/ -I/opt/local/include/boost BermudanSwaption.cpp \
-o bermudanswaption -L/opt/local/lib/ -lQuantLib
Error message is:
clang -cc1 version 8.0.0 (clang-800.0.42.1) default target x86_64-apple-darwin16.1.0
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
/opt/local/include
/opt/local/include/boost
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.12.0 -o bermudanswaption -L/opt/local/lib/ /var/folders/m3/39_h4bg52xzfv8800_zrkvrh0000gn/T/BermudanSwaption-a73fac.o -lQuantLib -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
......
"QuantLib::detail::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, QuantLib::detail::percent_holder const&)", referenced from:
calibrateModel(boost::shared_ptr<QuantLib::ShortRateModel> const&, std::__1::vector<boost::shared_ptr<QuantLib::CalibrationHelper>, std::__1::allocator<boost::shared_ptr<QuantLib::CalibrationHelper> > > const&) in BermudanSwaption-a73fac.o
_main in BermudanSwaption-a73fac.o
"QuantLib::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, QuantLib::Date const&)", referenced from:
QuantLib::InterestRateIndex::valueDate(QuantLib::Date const&) const in BermudanSwaption-a73fac.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`
What does this mean and why is LLVM invoked? I'm using latest Xcode, Mac OSX 10.12.1, familiar with python but not command line installs or compilation....
The error is very simple. You only compiled BermudanSwaption.cpp but you also need to compile the entire QuantLib. Otherwise, the linker can't find the implementation.

GCC: undefined reference - linker error

I am trying to build a software package from source with make in Centos 6.5 which was successfully built in Fedora 8.
I made a few changes to the files and downgrade a few dependencies in Centos.
When I do make, I get a linker error:
/home/wjn/Desktop/samPro/src/graphEdit.o:
In function `GW::graphEdit::setPoints(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': graphEdit.cpp:(.text+0x88): undefined reference to `bool GW::GraphUtils::create<GW::MathVector<double, 3, GW::MathVectorColumn>
>(GW::Graph<double, 3, GW::GraphColumn>&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char, char, char)' collect2: ld returned 1 exit status
I checked the gcc command initiated by make, it is:
/usr/bin/g++ -D_GNU_SOURCE -O3 -mfpmath=sse -finline-limit=1000 -shared -Xlinker --no-undefined -Wl,-soname,libGraphImg.so
-o /home/wjn/Desktop/samPro/lib/graphImg.so /home/wjn/Desktop/samPro/src/graphType.o
/home/wjn/Desktop/samPro/src/graphCalibration.o
/home/wjn/Desktop/samPro/src/graphEdit.o
/home/wjn/Desktop/samPro/src/imgMorph.o
-L/home/wjn/Desktop/samPro/lib -Wl,
-rpath-link=/home/wjn/Desktop/samPro/lib -Wl,
-Bdynamic -lpthread -lm -lc
So I check graphUtils.h and graphUtils.cpp, bool GW::GraphUtils::create is properly defined but there is no graphUtils.o.
It is perfectly built in Fedora 8, so I am guessing it is a compiler version problem?
Centos has GCC 4.4.7 and Fedora has 4.1.2, could this be the problem? What can I do to solve this if I don't want to use the old GCC to build it.

Undefined symbols for architecture x86_64 on Mac OS

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.

Undefined symbols for x86_64 architecture on mac

I am trying to compile a code that uses the FFTW libraries. I have installed these and have checked using lipo that they are installed for x86_64 architecture. However when I try to compile I get the following error
mpif90 -r8 -O3 -assume byterecl -u -I/usr/local/mpich2/include -I/usr/local/fftw_215_mpich2/include -L/usr/local/fftw_215_mpich2/lib -I./OBJ/ ./SRC/tt_main.f90 ./OBJ/xx_exter.o ./OBJ/tt_fft.o ./OBJ/tt_force.o ./OBJ/tt_init.o ./OBJ/tt_io.o ./OBJ/tt_les.o ./OBJ/tt_update.o ./OBJ/tt_stat.o ./OBJ/tt_mod.o ./OBJ/xx_mod.o -o turbo -ldfftw -ldrfftw -ldfftw_mpi -ldrfftw_mpi -lm
Undefined symbols for architecture x86_64:
"_rfftwnd_f77_mpi_", referenced from:
_fft3ds_ in tt_fft.o
_ifft3ds_ in tt_fft.o
"_rfftwnd_f77_mpi_create_plan_", referenced from:
_init_fft3d_ in tt_fft.o
"_rfftwnd_f77_mpi_local_sizes_", referenced from:
_init_fft3d_ in tt_fft.o
ld: symbol(s) not found for architecture x86_64
make[1]: *** [turb] Error 1
make: *** [turbo] Error 2
Can anyone help?

Resources