Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing addtional libs when libCbcSolver.so is copied #73

Closed
corneel27 opened this issue May 16, 2022 · 5 comments
Closed

Missing addtional libs when libCbcSolver.so is copied #73

corneel27 opened this issue May 16, 2022 · 5 comments

Comments

@corneel27
Copy link

I compiled libCbcSolver for using in Python-mip on a Rasberry Pi4
At first look all went well.
But when I copy the lib-folder to another docker container i get error-message that I am missing several lib's.
Is it possible to compile libCbcSolver with a flag that all necessary libs are bind into the final library (I am a gcc-noob).

@tkralphs
Copy link
Member

It's difficult to give a straightforward answer without additional information. You should probably do a little reading on static versus dynamically linked libraries to get a better understanding. Depending on what you're planning to do, building static libraries is an option---just add --disable-shared to your coinbrew build command line. You will get .a files instead of .o. This won't work, however, if you are trying to use Cbc with python-mip, which needs a shared library. I think this is what you're trying to do. Building a portable shared library is not easy in general and it really depends on what libraries are missing on your Docker container, whether the build machine and docker container have the version of gcc, etc.

The easiest thing to do is just to build Cbc inside the container. Is there a reason you don't do that? There are Docker images available with pre-built Cbc already installed. Just grab one of those.

Anyway. if you provide a little more information, I can try to help further.

@corneel27
Copy link
Author

Thank you for your fast reply!!
I am using Home Assistant (HA) as my smart home application.
It runs on a Raspberry Pi4.
I haven't found a library suitable for arch64 processor (libCbcSolver.so)
HA is build on Linux(version Alpine), with a docker system for the core application and dockers for the database, a supervisor and several addons. There is also a addon in a docker for a "separate" Pythonsystem (also based on Alpine). These addons are central maintained. And i few times in a year there is an update. That update replaces the core of the addon.
So it is not easy to make a developenvironment in a docker: an update becames than impossible.
So one shared library which contains all the dependant libraries (libnauty.so.2, libcolamd.so etc) would be very nice for me.
I think it must be possibe to build such a library, because the libCbcSolver.so for x86 systems is also independant from other libraries.

@corneel27
Copy link
Author

I tried to compile with --disable-shared .
I compiled with this command:
bash coinbrew build Cbc@master --no-prompt --prefix=/home/prog/ --tests=none --enable-cbc-parallel --enable-relocatable --disable-shared
But then I get no so-files:

root@b35896718346:/home/prog# ls -la lib
total 13708
drwxr-xr-x 3 root root    4096 May 17 10:49 .
drwxr-xr-x 6 root root    4096 May 17 10:36 ..
-rw-r--r-- 1 root root 4085470 May 17 10:49 libCbc.a
-rwxr-xr-x 1 root root    1196 May 17 10:49 libCbc.la
-rw-r--r-- 1 root root 2001708 May 17 10:40 libCgl.a
-rwxr-xr-x 1 root root    1120 May 17 10:40 libCgl.la
-rw-r--r-- 1 root root 3359776 May 17 10:36 libClp.a
-rwxr-xr-x 1 root root     961 May 17 10:36 libClp.la
-rw-r--r-- 1 root root 2348552 May 17 10:27 libCoinUtils.a
-rwxr-xr-x 1 root root     895 May 17 10:27 libCoinUtils.la
-rw-r--r-- 1 root root  612918 May 17 10:30 libOsi.a
-rwxr-xr-x 1 root root     945 May 17 10:30 libOsi.la
-rw-r--r-- 1 root root   82884 May 17 10:49 libOsiCbc.a
-rwxr-xr-x 1 root root    1230 May 17 10:49 libOsiCbc.la
-rw-r--r-- 1 root root  404264 May 17 10:36 libOsiClp.a
-rwxr-xr-x 1 root root    1051 May 17 10:36 libOsiClp.la
-rw-r--r-- 1 root root 1079176 May 17 10:30 libOsiCommonTest.a
-rwxr-xr-x 1 root root    1000 May 17 10:30 libOsiCommonTest.la
drwxr-xr-x 2 root root    4096 May 17 10:49 pkgconfig
root@b35896718346:/home/prog# ls -la bin
total 7872
drwxr-xr-x 2 root root    4096 May 17 10:49 .
drwxr-xr-x 6 root root    4096 May 17 10:36 ..
-rwxr-xr-x 1 root root 5426488 May 17 10:49 cbc
-rwxr-xr-x 1 root root 2623352 May 17 10:36 clp
root@b35896718346:/home/prog# 

@tkralphs
Copy link
Member

Yes, right, the .a files are static libraries, which probably don't suffice for what you're trying to do. Making portable shared libraries on Linux is non-trivial. It took quite a bit of work to set up builds for the Cbc libraries that come with python-mip. Basically, you need to build as if you are building a so called manylinux wheel, which uses a very old libc that is likely to be compatible with all modern versions. There are Docker images that are set up specifically to do this. You could have a look at the cibuildwheel project or just do some Googling, but it's not a straightforward thing I can easily describe how to do.

@corneel27
Copy link
Author

corneel27 commented May 26, 2022

I solved my problem:

coin-or/python-mip#276 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants