Skip to content
Snippets Groups Projects
Commit 918f1ae8 authored by Tom Pillot's avatar Tom Pillot
Browse files

docker manylinux: fix generated cmake files and update build for hpp-fcl

parent 82aa0261
No related branches found
No related tags found
No related merge requests found
......@@ -76,29 +76,20 @@ zlib-devel
```
#!/bin/bash -eux
source "/work/config/config"
source "/io/config/config"
for PYBIN in /opt/python/*/bin; do
"$PYBIN"/pip install numpy
"$PYBIN"/pip install -i https://test.pypi.org/simple/ eigenpy==2.4.2
"$PYBIN"/pip install -i https://test.pypi.org/simple/ eigenpy-test==2.4.3
done
# TODO: eigenpyTargets-release.cmake has the wrong path to libeigenpy
sed -i 's:IMPORTED_LOCATION_RELEASE "":IMPORTED_LOCATION_RELEASE "/usr/lib/python2.7/site-packages/eigenpy/eigenpy.libs/libeigenpy-453555c1.so":' /usr/lib/cmake/eigenpy/eigenpyTargets-release.cmake
sed -i 's:libeigenpy.so:libeigenpy-453555c1.so:' /usr/lib/cmake/eigenpy/eigenpyTargets-release.cmake
# TODO: the files in /opt/_internal/cpython-*/lib/cmake/eigenpy/eigenpyTargets-release.cmake need to be modified
# TODO: but even then cmake need to be searching in the right directory (with the right python version) to find these files
git clone -j"$NPROC" git://github.com/OctoMap/octomap.git
cd octomap/
mkdir build && cd build
cmake ..
make -j"$NPROC" install
cd /io
cd /src
rm -rf octomap
```
To build : `LD_LIBRARY_PATH=/usr/lib/python2.7/site-packages/eigenpy/eigenpy.libs:$LD_LIBRARY_PATH ./build_wheels.sh`
Only the python 2.7 wheels are working for now, to test the wheels make sure `libgl1-mesa-dev` is installed.
To test the wheels make sure `libgl1` is installed.
#!/bin/bash -eu
#!/bin/bash -eux
function repair_wheel {
wheel="$1"
......@@ -31,16 +31,20 @@ source config
# Build wheels
for PYBIN in /opt/python/*/bin; do
PYVERSION=$(find "$PYBIN" -name 'python[0-9]\.[0-9]' -printf "%f\n" | grep -Eo '[0-9].[0-9]')
[ -n "$INSTALL_REQUIRES" ] && "$PYBIN/pip" install "$(echo "$INSTALL_REQUIRES" | sed -E 's/"|\[|\]|,//g')"
"$PYBIN/python" setup.py bdist_wheel -- -- -j"$NPROC"
PYVERSION=$(find "$PYBIN" -type f -name 'python*.*' | head -1 | grep -Eo "[0-9]\.[0-9]")
CMAKE_PREFIX_PATH=$(find / -path "*$PYVERSION*" -type d -name cmake | tr '\n' ';')
"$PYBIN/python" setup.py bdist_wheel -DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH" -DBUILD_TESTING=OFF -j"$NPROC"
# Bundle external shared libraries into the wheels
MAIN_LIB=$(find _skbuild/*/cmake-build -type f ! -path '*test/*' -name 'lib*.so*')
MAIN_LIB_DIR=$(pwd)/$(dirname "$MAIN_LIB")
OTHER_LIB_DIRS=$(find / -path "*$PYVERSION*.libs/*" -name *.so | xargs dirname | tr '\n' ':')
WHEEL_NAME=$(ls -Art dist/ | tail -n 1)
LD_LIBRARY_PATH="$MAIN_LIB_DIR:$LD_LIBRARY_PATH" \
LD_LIBRARY_PATH="$MAIN_LIB_DIR:$OTHER_LIB_DIRS$LD_LIBRARY_PATH" \
repair_wheel "dist/$WHEEL_NAME"
rm -rf _skbuild
done
......@@ -52,7 +56,7 @@ for whl in /io/wheelhouse/*.whl; do
LIB_DIR=$(find . -type d -name '*.libs')
PACKAGE_DIR=$(dirname "$MAIN_LIB")
LIB64_DIR=$(find . -type d -name 'lib64')
WHEEL_DIR=$(echo "$MAIN_LIB" | cut -d'/' -f2)
WHEEL_DIR=$(find . -name *.so | head -1 | cut -d'/' -f2)
# Put the libs inside the package directory so the relative path to the libs is always the same
mv "$LIB_DIR" "$PACKAGE_DIR"/
......@@ -69,15 +73,6 @@ for whl in /io/wheelhouse/*.whl; do
# Remove libraries that are present twice (auditwheel already copied them in the .libs directory)
rm -f "$LIB64_DIR"/*.so*
#TODO: .cmake files should not have references to _skbuild, temporary fix (only for eigenpy.so):
find "$WHEEL_DIR" -name '*.cmake' | while read -r file; do
sed -i 's:;/src/_skbuild/linux-x86_64-.*/cmake-install/include::' "$file"
sed -i 's:/src/_skbuild/linux-x86_64-.*/cmake-install/lib64/libeigenpy.so:/usr/lib/python2.7/site-packages/eigenpy/eigenpy.libs/libeigenpy-453555c1.so:' "$file"
sed -i 's:libeigenpy.so:libeigenpy-453555c1.so:' "$file"
sed -i 's:/src/_skbuild/linux-x86_64-.*/cmake-install/include:/usr/local/include:' "$file"
sed -i 's:/src/_skbuild/linux-x86_64-.*/cmake-install/lib64:/usr/local/lib64:' "$file"
done
wheel pack "$WHEEL_DIR" -d /io/wheelhouse
rm -rf "${WHEEL_DIR:?}"/
done
......@@ -88,6 +83,28 @@ for PYBIN in /opt/python/*/bin; do
(cd "$HOME"; test "$PYBIN/python")
done
# TODO: Fix generated .cmake files (need to be done after installing the wheels so we know where the shared libraries are installed)
for whl in /io/wheelhouse/*.whl; do
wheel unpack "$whl"
WHEEL_DIR=$(find . -name *.so | head -1 | cut -d'/' -f2)
PYVERSION=$(find "$WHEEL_DIR" -type d -name 'python*' | tail -c4)
MAIN_LIB=$(find / ! -path "*$WHEEL_DIR*" -path "*$PYVERSION*$PACKAGE_NAME*.libs/*" -name "*$PACKAGE_NAME*.so")
MAIN_LIB_NAME=$(basename "$MAIN_LIB") # libeigenpy-[hash].so
MAIN_LIB_NAME_NO_HASH=$(echo $MAIN_LIB_NAME | sed 's/-.*\.so/\.so/') # libeigenpy.so
#TODO: .cmake files should not have references to _skbuild, this is only a temporary fix to be able to build hpp-fcl
find "$WHEEL_DIR" -name '*.cmake' | while read -r file; do
sed -i 's:/src/_skbuild/linux-x86_64-.*/cmake-install/include:/usr/local/include:' "$file" || true
sed -i "s:/src/_skbuild/linux-x86_64-.*/cmake-install/lib64/.*\.so:$MAIN_LIB:" "$file" || true
sed -i "s:$MAIN_LIB_NAME_NO_HASH:$MAIN_LIB_NAME:" "$file" || true
sed -i 's:/src/_skbuild/linux-x86_64-.*/cmake-install/lib64:/usr/local/lib64:' "$file" || true
done
wheel pack "$WHEEL_DIR" -d /io/wheelhouse
rm -rf "${WHEEL_DIR:?}"/
done
rm -rf "$TARGET_NAME".egg-info/ dist/
ls /io/wheelhouse
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment