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

add aarch64 static cbc library for arm64 architecture #391

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions mip/cbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,15 @@
else:
if "linux" in platform.lower():
if os_is_64_bit:
pathlibe = pathlib
libfile = os.path.join(pathlib, "cbc-c-linux-x86-64.so")
if not exists(libfile):
if platform_machine().lower().startswith("aarch64"):
libfile = os.path.join(pathlib, "cbc-c-linux-aarch64.so")
else:
pathlibe = pathlib
libfile = os.path.join(pathlib, "cbc-c-linux-x86-64.so")
pathlib = pathlibe
if not exists(libfile):
pathlibe = pathlib
libfile = os.path.join(pathlib, "cbc-c-linux-x86-64.so")
pathlib = pathlibe
else:
raise NotImplementedError("Linux 32 bits platform not supported.")
elif platform.lower().startswith("win"):
Expand Down
Binary file added mip/libraries/cbc-c-linux-aarch64.so
Binary file not shown.
75 changes: 75 additions & 0 deletions scripts/buildCBCLinuxARM.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
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 -fprefetch-loop-arrays -DNDEBUG -I/opt/gcc/include/"
export LDFLAGS="-Ofast -fPIC -L/opt/gcc/lib -flto -static-libgcc -static-libstdc++ -static-libgfortran"

dir=`pwd`
mkdir -p ~/prog
cd ~/prog
IDIR=`pwd`
export PKG_CONFIG_PATH=${IDIR}/lib/pkgconfig/:${PKG_CONFIG_PATH}

#cd $dir/ThirdParty-Metis
#./configure --prefix=$IDIR --enable-cbc-parallel --enable-static --disable-shared --enable-gnu-packages
#make -j 6
#make -j 6 install

cd $dir/ThirdParty-Blas
./configure --prefix=$IDIR --enable-cbc-parallel --enable-static --disable-shared --enable-gnu-packages
make -j 6
make -j 6 install

cd $dir/ThirdParty-Lapack
./configure --prefix=$IDIR --enable-cbc-parallel --enable-static --disable-shared --enable-gnu-packages
make -j 6
make -j 6 install

#cd $dir/ThirdParty-Mumps
#./configure --prefix=$IDIR --enable-cbc-parallel --enable-static --disable-shared --enable-gnu-packages
#make -j 6
#make -j 6 install

cd $dir/ThirdParty-Glpk
./configure --prefix=$IDIR --enable-cbc-parallel --enable-static --disable-shared --enable-gnu-packages
make -j 6
make -j 6 install

cd $dir/CoinUtils
./configure --prefix=$IDIR --enable-cbc-parallel --enable-static --disable-shared --enable-gnu-packages
make -j 6
make -j 6 install

cd $dir/Osi
./configure --prefix=$IDIR --enable-cbc-parallel --enable-static --disable-shared --enable-gnu-packages
make -j 6
make -j 6 install

cd $dir/Clp
./configure --prefix=$IDIR --enable-cbc-parallel --enable-static --disable-shared --enable-gnu-packages
make -j 6
make -j 6 install

cd $dir/Cgl
./configure --prefix=$IDIR --enable-cbc-parallel --enable-static --disable-shared --enable-gnu-packages
make -j 6
make -j 6 install


cd $dir/Cbc
./configure --prefix=$IDIR --enable-cbc-parallel --enable-static --disable-shared --enable-gnu-packages
make -j 6
make -j 6 install

cd $IDIR

patch -p1 < $dir/../scripts/coinutils-glpk.patch

cd $dir

g++ -shared -Ofast -fPIC -o ../mip/libraries/cbc-c-linux-aarch64.so \
-I${IDIR}/include/coin-or/ \
-DCBC_THREAD \
./Cbc/src/Cbc_C_Interface.cpp \
-L/opt/gcc/lib64/ -L${IDIR}/lib/ \
-lCbc -lpthread -lrt -lCgl -lOsiClp -lClp -lOsi -lCoinUtils \
-lcoinlapack -lcoinblas -lgfortran -lm -static-libgcc -static-libstdc++ -static-libgfortran -lcoinglpk
12 changes: 12 additions & 0 deletions scripts/coinutils-glpk.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -Naur prog/include/coin-or/CoinMpsIO.hpp prog.new/include/coin-or/CoinMpsIO.hpp
--- prog/include/coin-or/CoinMpsIO.hpp 2024-10-03 05:45:57.318155954 +0000
+++ prog.new/include/coin-or/CoinMpsIO.hpp 2024-10-03 07:20:13.388096889 +0000
@@ -19,7 +19,7 @@
#include "CoinFileIO.hpp"

#ifdef COINUTILS_HAS_GLPK
-#include "glpk.h"
+#include "glpk/glpk.h"
#endif

class CoinModel;