Files
2026-10-04 04:07:15 +00:00

46 lines
2.5 KiB
Plaintext

-- GFORTRAN_LIB, GNU_RT_LIB_1, GNU_RT_LIB_2 are GCC/gfortran runtime libraries that are
-- not present on FreeBSD (OpenBLAS is built with clang/LLVM on FreeBSD). Guard all
-- shutil.copy() calls with an emptiness check so setup.py bdist_wheel does not abort
-- with FileNotFoundError when these cmake variables are empty.
-- Also skip patchelf calls on FreeBSD: patchelf is a Linux-only ELF patching tool;
-- on FreeBSD the RPATH is set correctly at link time by cmake.
--- python/setup.py.in.orig 2026-09-09 02:40:49 UTC
+++ python/setup.py.in
@@ -1231,11 +1231,11 @@ package_data['paddle.libs']+=[
package_data['paddle.libs']+=[
os.path.basename('${LAPACK_LIB}'),
- os.path.basename('${BLAS_LIB}'),
- os.path.basename('${GFORTRAN_LIB}')]
+ os.path.basename('${BLAS_LIB}')] + \
+ ([os.path.basename('${GFORTRAN_LIB}')] if '${GFORTRAN_LIB}' else [])
shutil.copy('${BLAS_LIB}', libs_path)
shutil.copy('${LAPACK_LIB}', libs_path)
-shutil.copy('${GFORTRAN_LIB}', libs_path)
+if '${GFORTRAN_LIB}': shutil.copy('${GFORTRAN_LIB}', libs_path)
if len('${GNU_RT_LIB_1}') > 1:
package_data['paddle.libs'] += [
os.path.basename('${GNU_RT_LIB_1}')]
@@ -1246,8 +1246,9 @@ if not sys.platform.startswith("linux"):
shutil.copy('${MAGMA_LIB}', libs_path)
if not sys.platform.startswith("linux"):
- package_data['paddle.libs']+=[os.path.basename('${GNU_RT_LIB_2}')]
- shutil.copy('${GNU_RT_LIB_2}', libs_path)
+ if '${GNU_RT_LIB_2}':
+ package_data['paddle.libs']+=[os.path.basename('${GNU_RT_LIB_2}')]
+ shutil.copy('${GNU_RT_LIB_2}', libs_path)
if '${WITH_GPU}' == 'ON' or '${WITH_ROCM}' == 'ON':
if len('${FLASHATTN_LIBRARIES}') > 1:
@@ -1471,7 +1472,8 @@ if '${CMAKE_BUILD_TYPE}' == 'Release':
# change rpath of pir.ext for loading 3rd party lib
commands.append("patchelf --force-rpath --set-rpath '$ORIGIN:$ORIGIN/../libs' ${PADDLE_BINARY_DIR}/python/paddle/libs/${IR_NAME}")
# The sw_64 not support patchelf, so we just disable that.
- if platform.machine() != 'sw_64' and platform.machine() != 'mips64':
+ # FreeBSD does not have patchelf (Linux-only); RPATH is set by cmake at link time.
+ if platform.machine() != 'sw_64' and platform.machine() != 'mips64' and not sys.platform.startswith('freebsd'):
for command in commands:
if os.system(command) != 0:
raise Exception("patch ${FLUID_CORE_NAME}.%s failed, command: %s" % (ext_name, command))