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

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.

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

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.

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!

Cannot link with boost in Mac OS X with Clang, c++11

I try to compile program using boost with Clang++ on Mac OS X in Qt Creator. Everything goes fine: I have compiled boost and all program modules, but on the linkage stage clang cannot find any symbols:
Undefined symbols for architecture x86_64:
"_BIO_ctrl", referenced from:
boost::asio::ssl::detail::engine::map_error_code(boost::system::error_code&) const in session.o
.....
"boost::log::v2s_mt_posix::core::get()", referenced from:
INIT_LOG() in log.o
.....
qmake config:
CONFIG -= qt
CONFIG += console debug
TARGET = server
QMAKE_CXXFLAGS -= -mmacosx-version-min=10.6
QMAKE_CXXFLAGS += -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.7
QMAKE_LFLAGS -= -mmacosx-version-min=10.6
QMAKE_LFLAGS += -stdlib=libc++ -mmacosx-version-min=10.7
Linking command is:
clang++ -headerpad_max_install_names -stdlib=libc++ -mmacosx-version-min=10.7 -o server main.o session.o log.o -L/Users/apple/Lib/boost_1_53_0/usr/lib -L/opt/local/lib -L/usr/lib -lssl -lboost_system -lboost_filesystem -lboost_date_time -lboost_thread -lboost_log_setup -lboost_log -lboost_chrono -lboost_program_options
If I rename *.dylib, it says that cannot find -lboost_*, so it really SEES library files.
With nm I can find, that symbols exist:
0000000000018ad0 T __ZN5boost3log11v2_mt_posix4core3getEv

Install fortran-based R package on Mac OS X

I'm attempting to install version 1.10 of the cts package from CRAN on OS X, and I'm running into some linker problems. I need to install from source, because I'm making a few changes to the source (actually Zhu Wang, the cts author, made the changes & sent me the new tarball - but the same issue happens with the stock sources of cts on CRAN).
It seems to compile all the sources fine, but then fails with the following errors during linking:
> install.packages('~/Downloads/cts_1.0-11.tar.gz', .libPaths()[1], repos=NULL, type='source')
* installing *source* package ‘cts’ ...
** libs
*** arch - i386
gfortran-4.2 -arch i386 -fPIC -g -O2 -c a9rntc.f -o a9rntc.o
gfortran-4.2 -arch i386 -fPIC -g -O2 -c a9rntd.f -o a9rntd.o
gfortran-4.2 -arch i386 -fPIC -g -O2 -c a9rnti.f -o a9rnti.o
[bunch of other compilation lines snipped ...]
gfortran-4.2 -arch i386 -fPIC -g -O2 -c u9dmp.f -o u9dmp.o
gfortran-4.2 -arch i386 -fPIC -g -O2 -c update.f -o update.o
gcc-4.2 -arch i386 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o cts.so a9rntc.o a9rntd.o a9rnti.o a9rntl.o a9rntr.o balanc.o balinv.o cinvert.o complete.o cspec.o d1mach.o d1rply.o d2rply.o d3rply.o d4rply.o d5rply.o d6rply.o d7rply.o d8rply.o d9rply.o dgetrf.o dgetrs.o display.o dpca.o drpoly.o e9rint.o envirn.o eprint.o fdump.o forecast.o frmatd.o frmati.o frmatr.o getmin.o hqrort.o i0tk00.o i10wid.o i1mach.o i8save.o iceil.o iflr.o isamax.o istkgt.o istkqu.o istkrl.o kfilsm.o kfilsm1.o loop.o lybsc.o lycsr.o mepad.o mutil.o newline.o orthes.o ortran.o rejuce.o repar.o resg0.o resg0new.o resg1d.o resg1dpre.o resg1dpre1.o resgen.o revg1.o roots.o s88fmt.o saxpy.o sdata.o sdot.o sdump.o search.o setcom.o seterr.o setfor.o setkfilsm.o setup1.o setupdate.o simi.o sscal.o stkdmp.o store.o u9dmp.o update.o -L/Library/Frameworks/R.framework/Resources/lib/i386 -lRlapack -L/Library/Frameworks/R.framework/Resources/lib/i386 -lRblas -lgfortran -lgfortran -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: can't find atom for N_GSYM stabs mdeps:G(0,10)=s32base:(0,6),0,64;big:(0,6),64,64;small:(0,6),128,64;eps:(0,6),192,64;; in balanc.o
ld: warning: can't find atom for N_GSYM stabs base:G(0,6) in balanc.o
ld: warning: can't find atom for N_GSYM stabs setcon:G(0,3)=s252cso:(0,4)=r(0,2);8;0;,0,64;csz:(0,4),64,64;lam:(0,4),128,64;ssold:(0,4),192,64;gmold:(0,4),256,64;gmnew:(0,4),320,64;sigsq:(0,4),384,64;oldb:(0,5)=ar(0,2);0;21;(0,4),448,1408;conv:(0,6)=#s32;-16;,1856,32;fail:(0,6),1888,32;np:(0,2),1920,32;itct:(0,2),1952,32;ppind:(0,2),1984,32;; in cinvert.o
ld: warning: can't find atom for N_GSYM stabs cso:G(0,4) in cinvert.o
ld: warning: can't find atom for N_GSYM stabs resgn2:G(0,7)=s59364wk:(0,8)=ar(0,2);0;19;(0,4),0,1280;vt:(0,9)=ar(0,2);0;4999;(0,4),1280,320000;bi:(0,10)=ar(0,2);0;799;(0,4),321280,51200;r:(0,11)=ar(0,2);0;799;(0,4),372480,51200;ri:(0,12)=ar(0,2);0;799;(0,4),423680,51200;errno1:(0,2),474880,32;; in cinvert.o
ld: warning: can't find atom for N_GSYM stabs wk:G(0,8) in cinvert.o
ld: in cinvert.o, sectionForAddress(0xE7F0) address not in any section for architecture i386
collect2: ld returned 1 exit status
make: *** [cts.so] Error 1
ERROR: compilation failed for package ‘cts’
* removing ‘/Users/ken/R-dev/cts’
* restoring previous ‘/Users/ken/R-dev/cts’
Warning message:
In install.packages("~/Downloads/cts_1.0-11.tar.gz", .libPaths()[1], :
installation of package ‘/Users/ken/Downloads/cts_1.0-11.tar.gz’ had non-zero exit status
Are there any compile/link flags I should pass to install.packages(), maybe? What options are the CRAN binary build machines using?

Resources