简体   繁体   中英

Nauty and Traces on Mac OS X

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM