Code Monkey home page Code Monkey logo

Comments (8)

h-g-s avatar h-g-s commented on May 30, 2024

from python-mip.

kokil01 avatar kokil01 commented on May 30, 2024

Thanks for providing the instructions.

I tried them and it failed because it could not link to libquadmath. Looks like its not supported on arm platforms yet - https://packages.debian.org/buster/libquadmath0

I modified the buildCBCLinux.sh locally by passing --disable-libquadmath option to the configure script. Lets see if it works.

Update: Unfortunately it didn't work.

from python-mip.

kokil01 avatar kokil01 commented on May 30, 2024

Hi

Spend sometime looking into this. I had to make 2 changes and I was able to compile. Since libquadmath is not available on Pi I had to remove it from linking. Here is the final bash script

if [ ! -d "Cbc" ];
then
        echo "call this script in the CBC source directory"
        exit
fi
if [ ! -f "configure" ];
then
        echo "call this script in the CBC source directory"
        exit
fi

export CFLAGS="-Ofast -fPIC -flto -DNDEBUG -fprefetch-loop-arrays -I/opt/gcc/include/"
export FFLAGS="-Ofast -fPIC -flto -DNDEBUG -I/opt/gcc/include/"
export CXXFLAGS="-Ofast -fPIC -flto -DNDEBUG -I/opt/gcc/include/"
export LDFLAGS="-Ofast -fPIC -L/opt/gcc/lib -flto -static-libgcc -static-libstdc++ -static-libgfortran"
./configure --enable-cbc-parallel --enable-static --disable-shared --disable-libquadmath
make clean
make -j 1
g++ -shared -Ofast -fPIC -o cbc-c-linux-x86-64.so \
-I~/prog/include/ -I./CoinUtils/src/ -I./Osi/src/ -I./Clp/src/ -I./Clp/src/ \
-I./Cgl/src/ -I./Cbc/src/ -I./Osi/src/Osi/ -I./Clp/src/OsiClp/ -DCBC_THREAD \
./Cbc/src/Cbc_C_Interface.cpp -L/opt/gcc/lib64/ -L./Cbc/src/.libs/ -L./Cgl/src/.libs/ \
-L./Cgl/src/.libs/ -L./Osi/src/Osi/.libs/ -L./Clp/src/OsiClp/.libs/ -L./Clp/src/.libs/ \
-L./CoinUtils/src/.libs/ -L./Cgl/src/.libs/ -L./Clp/src/OsiClp/.libs/ -L./Clp/src/.libs/ \
-L./ThirdParty/Lapack/.libs/ -L./ThirdParty/Blas/.libs/ \
 -lCbcSolver -lCbc -lpthread -lrt -lCgl -lOsiClp -lClpSolver -lClp -lOsi -lCoinUtils \
 -lcoinlapack -lcoinblas -lgfortran -lm -static-libgcc -static-libstdc++ -static-libgfortran

I have attached the produced binary file.

But I think it still does not work. Because when I do a = ffi.dlopen("/tmp/cbc-c-linux-x86-64.so") with the generated file it produces the following error -

OSError: cannot load library '/tmp/cbc-c-linux-x86-64.so': /tmp/cbc-c-linux-x86-64.so: undefined symbol: BZ2_bzWriteClose.  Additionally, ctypes.util.find_library() did not manage to locate a library called '/tmp/cbc-c-linux-x86-64.so'

cbc-c-linux-x86-64.so.zip

from python-mip.

kokil01 avatar kokil01 commented on May 30, 2024

Looking for all undefined symbols looks like there are a lot of them

nm /tmp/cbc-c-linux-x86-64.so | grep 'U '

yields

        U BZ2_bzRead
         U BZ2_bzReadClose
         U BZ2_bzReadOpen
         U BZ2_bzWrite
         U BZ2_bzWriteClose
         U BZ2_bzWriteOpen
         U _gfortran_stop_string@@GFORTRAN_8
         U _gfortran_string_len_trim@@GFORTRAN_8
         U _gfortran_st_write_done@@GFORTRAN_8
         U _gfortran_st_write@@GFORTRAN_8
         U _gfortran_transfer_character_write@@GFORTRAN_8
         U _gfortran_transfer_integer_write@@GFORTRAN_8
         U gzclose
         U gzopen
         U gzread
         U gzwrite

from python-mip.

kokil01 avatar kokil01 commented on May 30, 2024

It worked!!! Just needed to add bz2 as a library

g++ -shared -Ofast -fPIC -o cbc-c-linux-x86-64.so \
                                        -I~/prog/include/ -I./CoinUtils/src/ -I./Osi/src/ -I./Clp/src/ -I./Clp/src/ \
                                        -I./Cgl/src/ -I./Cbc/src/ -I./Osi/src/Osi/ -I./Clp/src/OsiClp/ -DCBC_THREAD \
                                        ./Cbc/src/Cbc_C_Interface.cpp -L/opt/gcc/lib64/ -L./Cbc/src/.libs/ -L./Cgl/src/.libs/ \
                                        -L./Cgl/src/.libs/ -L./Osi/src/Osi/.libs/ -L./Clp/src/OsiClp/.libs/ -L./Clp/src/.libs/ \
                                        -L./CoinUtils/src/.libs/ -L./Cgl/src/.libs/ -L./Clp/src/OsiClp/.libs/ -L./Clp/src/.libs/ \
                                        -L./ThirdParty/Lapack/.libs/ -L./ThirdParty/Blas/.libs/ \
                                         -lCbcSolver -lCbc -lpthread -lrt -lCgl -lOsiClp -lClpSolver -lClp -lOsi -lCoinUtils -lbz2 \
                                         -lcoinlapack -lcoinblas -lgfortran -lm -static-libgcc -static-libstdc++ -static-libgfortran

Here is the .so file which loads in python.
cbc-c-linux-x86-64.so.zip

from python-mip.

h-g-s avatar h-g-s commented on May 30, 2024

from python-mip.

h-g-s avatar h-g-s commented on May 30, 2024

just added this to the TODO list of the project, I'll remove as an issue for now

from python-mip.

corneel27 avatar corneel27 commented on May 30, 2024

I was installing mip on a raspberry pi, but it is still not working "out of the box"
I have build the binary by myself from https://github.com/coin-or /
Cbc
And with a softlink to the builded binary the mip library works fine.
But I want to use it in Appdaemon of Home Assistant and that docker image doesn't allow me to install binaries.
Is it possible to get this to work with an arm-binary?

from python-mip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.