Cbc
Cbc copied to clipboard
Cbc/mip on a raspberry pi4
I compiled a version for raspberry pi 4 (64 bit) I compiled it in a separate docker container from Home Assistant and copied all the cbc-binaries to my working python docker container. But the loading of the library didn't succeed. I tried it manually at the python prompt:
>> from cffi import FFI
>>> ffi = FFI()
>>> ffi.dlopen('/config/appdaemon/mip/lib/libCbcSolver.so')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.9/site-packages/cffi/api.py", line 150, in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
File "/usr/lib/python3.9/site-packages/cffi/api.py", line 832, in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
File "/usr/lib/python3.9/site-packages/cffi/api.py", line 828, in _load_backend_lib
return backend.load_library(path, flags)
OSError: cannot load library '/config/appdaemon/mip/lib/libCbcSolver.so': Error loading shared library libnauty.so.2: No such file or directory (needed by /config/appdaemon/mip/lib/libCbcSolver.so)
So I am missing libnauty.so.2 What did I wrong?
You did not provide the Nauty lib in your "working python docker container".
I am starting copying a lot of missing libs, but I thought it should work without these. When I install mip on a Linux machine with x86 I also need only the libCbsSolver.so for x86 (it is installed with the mip-package).
Whatever libraries are present when Cbc is built must also be present when it is run. If you move the Cbc libraries, you have to also move the dependent libraries. It may be easier just not to link to the problematic libraries when you build so that you don't need to worry about it. In this case, you could add --without-nauty
to the coinbrew
command to avoid linking to nauty. ALternatively, just uninstall nauty on the build machine or install nauty on the target machine. Of course, this will make the solver less performant. And it's going to be a bit of "wack a mole."
Looks like this was resolved in duplicate issue https://github.com/coin-or/python-mip/issues/276. Also related to https://github.com/coin-or/coinbrew/issues/73.
Hello Ted, Does this mean that there are ready to use binaries for a debian like version of Linux on a raspberry pi4? At the moment I have (with success) build (with coinbrew) my own binaries and I can work with them but it would be much better when the binaries would be delivered together with the mip-package for that os on raspberry pi4 (such as is done on machines with a amd64 processor).
Thanks in advance. Cees
The Cbc project is completely separate from python-mip
and only provides binaries for a limited set of platforms (the ones we do build and test for using Github Actions). Providing universal binaries such as python-mip
does is beyond the scope of this project and requires a lot of additional tooling.
With that said, we spent a good amount of time a while back figuring out how to build wheels for the CyLP python package that include portable Cbc libraries using the cibuildwheels
package. I suggested that python-mip
adopt a similar system to build their binaries, but that hasn't been done to my knowledge. It looks as though cibuildwheel
could work for building binaries for Raspberry Pi4. So maybe ask the python-mip
developers about this. The discussion I posted is here.
Anyway, I closed this ticket because the one opened in python-mip
that asked a similar question was closed and you had said the issue was resolved. If you want to ask whether python-mip
is planning to provide binaries for raspberry pi4 in the future, you should probably open a ticket for over there.
[As a side note, I am now a super happy Home Assistant user, largely thanks to your posting here about Home Assistant. I looked into it and took the plunge to switch from Smart Things over the holidays. LOVE IT! So you may be able to get me hooked on helping with that effort :)]