Skip to content

Commit

Permalink
fix: remove auditwheel repair due to libpaddle && add PYTHON_LIBRARY …
Browse files Browse the repository at this point in the history
…on non-Windows platforms
  • Loading branch information
0x3878f committed Dec 29, 2024
1 parent 9fbbe94 commit cf0e492
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
31 changes: 18 additions & 13 deletions .github/workflows/scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,25 @@ export PIP_EXTRA_INDEX_URL="https://www.paddlepaddle.org.cn/packages/nightly/cpu
# Build Paddle2ONNX wheels
$PYTHON_COMMAND -m build --wheel || { echo "Building wheels failed."; exit 1; }

# Bundle external shared libraries into the wheels
# find -exec does not preserve failed exit codes, so use an output file for failures
failed_wheels=$PWD/failed-wheels
rm -f "$failed_wheels"
find . -type f -iname "*-linux*.whl" -exec sh -c "auditwheel repair '{}' -w \$(dirname '{}') --plat '${PLAT}' || { echo 'Repairing wheels failed.'; auditwheel show '{}' >> '$failed_wheels'; }" \;
# ============================================================================
# Due to libpaddle’s limitations, it can only maintain a restricted platform tag of ‘linux_x86_64’.
# ============================================================================
# export LD_LIBRARY_PATH=/opt/python/${PY_VER}/lib/python${PY_VERSION}/site-packages/paddle/base/:$LD_LIBRARY_PATH
# export LD_LIBRARY_PATH=/opt/python/${PY_VER}/lib/python${PY_VERSION}/site-packages/paddle/libs/:$LD_LIBRARY_PATH
# # Bundle external shared libraries into the wheels
# # find -exec does not preserve failed exit codes, so use an output file for failures
# failed_wheels=$PWD/failed-wheels
# rm -f "$failed_wheels"
# find . -type f -iname "*-linux*.whl" -exec sh -c "auditwheel repair '{}' -w \$(dirname '{}') --plat '${PLAT}' || { echo 'Repairing wheels failed.'; auditwheel show '{}' >> '$failed_wheels'; }" \;

if [[ -f "$failed_wheels" ]]; then
echo "Repairing wheels failed:"
cat failed-wheels
exit 1
fi
# if [[ -f "$failed_wheels" ]]; then
# echo "Repairing wheels failed:"
# cat failed-wheels
# exit 1
# fi

# Remove useless *-linux*.whl; only keep manylinux*.whl
rm -f dist/*-linux*.whl
# # Remove useless *-linux*.whl; only keep manylinux*.whl
# rm -f dist/*-linux*.whl

echo "Successfully build wheels:"
find . -type f -iname "*manylinux*.whl"
# find . -type f -iname "*manylinux*.whl" # uncomment this line when libpaddle supports manylinux2014
6 changes: 6 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ def run(self):
else:
cmake_args.extend(["-A", "Win32", "-T", "host=x86"])
cmake_args.extend(["-G", "Visual Studio 16 2019"])
else:
cmake_args.append(
"-DPYTHON_LIBRARY={}".format(
sysconfig.get_python_lib(standard_lib=True)
)
)
if "CMAKE_ARGS" in os.environ:
extra_cmake_args = shlex.split(os.environ["CMAKE_ARGS"])
# prevent crossfire with downstream scripts
Expand Down

0 comments on commit cf0e492

Please sign in to comment.