简体   繁体   English

Mac OS X 上的 Nauty 和 Traces

[英]Nauty and Traces on Mac OS X

I am trying to use the code Nauty and Traces http://pallini.di.uniroma1.it/ .我正在尝试使用代码 Nauty 和 Traces http://pallini.di.uniroma1.it/ But when I complied an example, say nautyex8.c (provided by the package), the following error showed up:但是当我编译一个例子时,说nautyex8.c(由包提供),出现了以下错误:

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).我使用的是 Mac OS X Yosemite (10.10.5) 和 Xcode(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我刚刚打开了一个拉取请求,让brew install nauty在 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.在此之前,从 Nauty/Traces 2.6r12 开始,您将如何在 OS X 上构建 nautyex8.c。
Step 1 is to download the code and build the library:第 1 步是下载代码并构建库:

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 :第 2 步是编译 nautyex8.c 并将其链接到您刚刚构建的库

gcc -O3 nautyex8.c nauty.a
./a.out

You probably forgot to put that " nauty.a " at the end of your compiler command line.您可能忘记将“ nauty.a ”放在编译器命令行的末尾。 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.完全符合你描述的症状。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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