coin-or / Cbc

COIN-OR Branch-and-Cut solver
Other
814 stars 115 forks source link

Missing nauty in static build #613

Closed fontanf closed 1 year ago

fontanf commented 1 year ago

I use CBC inside one of my codes. I downloaded this static build https://github.com/coin-or/Cbc/releases/download/releases%2F2.10.10/Cbc-releases.2.10.10-x86_64-ubuntu20-gcc940-static.tar.gz

At the linking step, I get:

external/coinor_linux/lib/libCbc.a(CbcSymmetry.o):CbcSymmetry.cpp:function CbcNauty::operator=(CbcNauty const&): error: undefined reference to 'alloc_error'
external/coinor_linux/lib/libCbc.a(CbcSymmetry.o):CbcSymmetry.cpp:function CbcNauty::operator=(CbcNauty const&): error: undefined reference to 'alloc_error'
external/coinor_linux/lib/libCbc.a(CbcSymmetry.o):CbcSymmetry.cpp:function CbcNauty::operator=(CbcNauty const&): error: undefined reference to 'alloc_error'
external/coinor_linux/lib/libCbc.a(CbcSymmetry.o):CbcSymmetry.cpp:function CbcNauty::computeAuto(): error: undefined reference to 'nauty'
external/coinor_linux/lib/libCbc.a(CbcSymmetry.o):CbcSymmetry.cpp:function CbcNauty::computeAuto(): error: undefined reference to 'nautil_freedyn'
external/coinor_linux/lib/libCbc.a(CbcSymmetry.o):CbcSymmetry.cpp:function CbcNauty::computeAuto(): error: undefined reference to 'nauty_freedyn'
external/coinor_linux/lib/libCbc.a(CbcSymmetry.o):CbcSymmetry.cpp:function CbcNauty::computeAuto(): error: undefined reference to 'dispatch_sparse'
external/coinor_linux/lib/libCbc.a(CbcSymmetry.o):CbcSymmetry.cpp:function CbcNauty::computeAuto(): error: undefined reference to 'sparsenauty'
external/coinor_linux/lib/libCbc.a(CbcSymmetry.o):CbcSymmetry.cpp:function CbcNauty::CbcNauty(int, unsigned long const*, int const*, int const*): error: undefined reference to 'nauty_check'
external/coinor_linux/lib/libCbc.a(CbcSymmetry.o):CbcSymmetry.cpp:function CbcNauty::CbcNauty(int, unsigned long const*, int const*, int const*): error: undefined reference to 'dispatch_graph'
external/coinor_linux/lib/libCbc.a(CbcSymmetry.o):CbcSymmetry.cpp:function CbcNauty::CbcNauty(int, unsigned long const*, int const*, int const*): error: undefined reference to 'alloc_error'
external/coinor_linux/lib/libCbc.a(CbcSymmetry.o):CbcSymmetry.cpp:function CbcNauty::computeAuto(): error: undefined reference to 'nausparse_freedyn'

It seems that nauty is not included in this build. I don't have this issue with the dynamic builds.

fontanf commented 1 year ago

I managed to make it work by installing nauty via the package manager:

sudo apt install libnauty2-dev

But again, I didn't need it with the dynamic build. So I don't know if it's the expected behavior

tkralphs commented 1 year ago

You can check the workflow that does the build here: https://github.com/coin-or/Cbc/blob/stable/2.10/.github/workflows/linux-ci.yml

Nauty is found and linked in both the static and dynamic builds. You can verify this in the logs from a recent workflow run (the logs from the release builds have expired):

https://github.com/coin-or/Cbc/actions/runs/5453288036/job/14762540588#step:5:621 https://github.com/coin-or/Cbc/actions/runs/5453288036/job/14762540426#step:5:627

I downloaded both and verified that the dynamic build does have a dependency on Nauty:

~/tmp/Cbc-dynamic20/lib > ldd libCbc.so
        ...
        libnauty.so.2 => /usr/lib/x86_64-linux-gnu/libnauty.so.2 (0x00007f1af9d4e000)
        ...

My guess is that you had libnauty2 on your system already, but that package only provides dynamic libraries. libnauty2-dev provides the static libraries and so the linking would have only failed in the static build before installing the latter package. Installing that fixed the linking for the static build.

The change in behavior from 2.10.9 to 2.10.10 was due to #593, which modified the workflow so that nauty is properly detected by configure. Previously, the nauty package was being installed, but nauty was not detected by configure and so not included in the build.

fontanf commented 1 year ago

Thank you for your quick reply.

My guess is that you had libnauty2 on your system already, but that package only provides dynamic libraries. libnauty2-dev provides the static libraries and so the linking would have only failed in the static build before installing the latter package. Installing that fixed the linking for the static build.

Indeed, that sounds right. Sorry for the inconvenience