Nauty and Traces on Mac OS X - c

I am trying to use the code Nauty and Traces http://pallini.di.uniroma1.it/. But when I complied an example, say nautyex8.c (provided by the package), the following error showed up:
Undefined symbols for architecture x86_64:
"_alloc_error", referenced from:
_main in nautyex8-54d9da.o
"_densenauty", referenced from:
_main in nautyex8-54d9da.o
"_dispatch_graph", referenced from:
_main.options in nautyex8-54d9da.o
"_nauty_check", referenced from:
_main in nautyex8-54d9da.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am using Mac OS X Yosemite (10.10.5) and Xcode (version 7.1). I believe that there is no error in the codes because they are widely used so I guess the problem comes from my system settings.
Thank you so much!

I've just opened a pull request to make brew install nauty work on OS X: https://github.com/Homebrew/homebrew-core/pull/48701
Until then, here's how you would build nautyex8.c on OS X, as of Nauty/Traces 2.6r12.
Step 1 is to download the code and build the library:
wget http://pallini.di.uniroma1.it/nauty26r12.tar.gz
tar zxvf nauty26r12.tar.gz
cd nauty26r12
./configure
make
ls -l nauty.a
Step 2 is to compile nautyex8.c and link it against the library you just built:
gcc -O3 nautyex8.c nauty.a
./a.out
You probably forgot to put that "nauty.a" at the end of your compiler command line. If I do that too, I get:
gcc -O3 nautyex8.c
Undefined symbols for architecture x86_64:
"_alloc_error", referenced from:
_main in nautyex8-05f086.o
"_densenauty", referenced from:
_main in nautyex8-05f086.o
"_dispatch_graph", referenced from:
_main.options in nautyex8-05f086.o
"_nauty_check", referenced from:
_main in nautyex8-05f086.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
which exactly matches the symptom you described.

Related

testu01 installation problems on mac OS X

I installed testu01 on my mac (OS El Capitan). I want to compile one of the examples using gcc, code below. But I get the following error, below. Did anybody run TestU01 on x86_64 successfully? Any other suggestions?
MacBook-Pro-2:examples Joan$ gcc -std=c99 -Wall -O3 -o birth1 birth1.c -I/Users/TestU01/TestU01-1.2.3/include -I/Users/TestU01/TestU01-1.2.3/mylib
Undefined symbols for architecture x86_64:
"_smarsa_BirthdaySpacings", referenced from:
_main in birth1-c99705.o
"_ulcg_CreateLCG", referenced from:
_main in birth1-c99705.o
"_ulcg_DeleteGen", referenced from:
_main in birth1-c99705.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Mac OS X Sierra : Undefined symbols for architecture x86_64

I am trying to build a C source file based on Linphone in Mac OS X Sierra but getting the following error.
This is the link for the C source file.
http://www.linphone.org/docs/liblinphone/group__basic__call__tutorials.html
Edited:
I am trying to compile the source code with this command
clang -o tt tt.c -I/Users/softdev/Downloads/linphone-sdk-3.11.1-mac/include/
Error:
Undefined symbols for architecture x86_64
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have tried to change the target cpu but didn't work.
My system has XCode 8. Any help regarding this will be appreciated.
Edited: Complete Output
Undefined symbols for architecture x86_64:
"_linphone_call_get_state", referenced from:
_main in tt-ca2045.o
"_linphone_call_ref", referenced from:
_main in tt-ca2045.o
"_linphone_call_unref", referenced from:
_main in tt-ca2045.o
"_linphone_core_destroy", referenced from:
_main in tt-ca2045.o
"_linphone_core_invite", referenced from:
_main in tt-ca2045.o
"_linphone_core_iterate", referenced from:
_main in tt-ca2045.o
"_linphone_core_new", referenced from:
_main in tt-ca2045.o
"_linphone_core_terminate_call", referenced from:
_main in tt-ca2045.o
"_ms_usleep", referenced from:
_main in tt-ca2045.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I got the sample code to compile using this:
clang -o hello hello.c -Ilinphone-sdk-3/include -Llinphone-sdk-3/lib -llinphone -lmediastreamer_base
Clang's -I parameter points to the where the header (.h) files live
And as for my additions, -L specifies the path for clang to get to where the lib files live. In your case, it might live in -L/Users/softdev/Downloads/linphone-sdk-3.11.1-mac/lib
then -l specifies which dylibs you want to include (strip off the lib prefix and the dylib suffix).
Lastly, you need to add a missing line to the sample code you pointed to. Add:
#include <unistd.h>
after signal.h

Symbol not found - linking to hdf library

I am trying to use the hdf5-format to store data. Problem is, that I fail to link against the library. I have the following code
#include <H5Cpp.h>
int main(void){
H5::H5File file("test_MatrixRoundTrip_Double.h5", H5F_ACC_TRUNC);
}
and compile it using
gcc -std=c++11 -o main main.cpp -I /usr/local/include/ -L /usr/local/lib/ -lhdf5 -lhdf5_hl
This always returns the error
Undefined symbols for architecture x86_64:
"H5::FileAccPropList::DEFAULT", referenced from:
_main in main-c207d1.o
"H5::FileCreatPropList::DEFAULT", referenced from:
_main in main-c207d1.o
"H5::H5File::H5File(char const*, unsigned int, H5::FileCreatPropList const&, H5::FileAccPropList const&)", referenced from:
_main in main-c207d1.o
"H5::H5File::~H5File()", referenced from:
_main in main-c207d1.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I installed the hdf5 library on OSX using
brew install homebrew/science/hdf5
What am I doing wrong here?
You are including the HDF5 C++ header file, but only linking the HDF5 C library. Add the line: -lhdf5_cpp to link the C++ shared object and use locate libhdf5_cpp to find it's libpath.

Gstreamer first steps - "Undefined symbols..." error

Probably a noob question but I can't find an answer to this. I've downloaded and installed Gstreamer for Mac from http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-init.html
I copied the code for example 4.1, to initialize GStreamer, from
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-init.html into a file called eg41.c
and used the terminal command gcc eg41.c -I/Library/Frameworks/GStreamer.framework/Headers
. The output was:
Undefined symbols for architecture x86_64:
"_gst_init", referenced from: _main in eg41-9814a5.o
"_gst_version", referenced from: _main in eg41-9814a5.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any ideas?

Compiling and linking libev on Mac OS X

Yet another symbol(s) not found issue with Mac OS X. I wrote a C program that uses the libev event loop library that when compiled produces this output:
$ make
clang midnight.c midnight_logging.c -o midnight
Undefined symbols for architecture x86_64:
"_ev_default_loop", referenced from:
_main in midnight-Wlcawk.o
"_ev_io_start", referenced from:
_main in midnight-Wlcawk.o
"_ev_run", referenced from:
_main in midnight-Wlcawk.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: *** [midnight] Error 1
I used homebrew to install libev. The shared library is in /usr/local/lib per normal and I've used every combination of compiler arguments including "-I /usr/local/lib", "-l libev" and "-L /usr/local/lib".
Assistance appreciated, I'd rather not have to statically compile.
But you do not link against libev! The compiler isn't a clairvoyant (nor is the linker), you have to tell it what to search for those symbols...
clang midnight.c midnight_logging.c -o midnight -lev

Resources