-
Notifications
You must be signed in to change notification settings - Fork 90
Closed
Description
I installed libmpc and libmpc-devel in my own space and wrote a .pc file, and set PKG_CONFIG_PATH accordingly.
(python3.12) $ pkg-config --cflags --libs libmpc
-I/proj/cot_globals/centos8/usr/include -L/proj/cot_globals/centos8/usr/lib64 -lmpc
(python3.12) $ ls /proj/cot_globals/centos8/usr/include
total 16
-rw-r--r-- 1 epramyl eusers 12898 Jan 11 2018 mpc.h
But the build can't find it. I did some Googling on how pip/setuptools interacts with external lib requirements, but I couldn't find much.
(python3.12) $ pip install gmpy2
Looking in indexes: https://arm.sero.gic.ericsson.se/artifactory/api/pypi/pypi-remote/simple/
Collecting gmpy2
Using cached https://arm.sero.gic.ericsson.se/artifactory/api/pypi/pypi-remote/packages/packages/d9/2e/2848cb5ab5240cb34b967602990450d0fd715f013806929b2f82821cef7f/gmpy2-2.1.5.tar.gz (261 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: gmpy2
Building wheel for gmpy2 (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [30 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-312
creating build/lib.linux-x86_64-cpython-312/gmpy2
copying gmpy2/__init__.py -> build/lib.linux-x86_64-cpython-312/gmpy2
running egg_info
writing gmpy2.egg-info/PKG-INFO
writing dependency_links to gmpy2.egg-info/dependency_links.txt
writing top-level names to gmpy2.egg-info/top_level.txt
reading manifest file 'gmpy2.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'COPYING'
adding license file 'COPYING.LESSER'
writing manifest file 'gmpy2.egg-info/SOURCES.txt'
copying gmpy2/__init__.pxd -> build/lib.linux-x86_64-cpython-312/gmpy2
copying gmpy2/gmpy2.h -> build/lib.linux-x86_64-cpython-312/gmpy2
copying gmpy2/gmpy2.pxd -> build/lib.linux-x86_64-cpython-312/gmpy2
running build_ext
building 'gmpy2.gmpy2' extension
creating build/temp.linux-x86_64-cpython-312
creating build/temp.linux-x86_64-cpython-312/src
gcc -pthread -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I./src -I/proj/cot_globals/envs/python3.12/include -I/proj/cot_globals/tools/freeware/python/3.12.0/include/python3.12 -c src/gmpy2.c -o build/temp.linux-x86_64-cpython-312/src/gmpy2.o -DSHARED=1
In file included from src/gmpy2.c:517:
src/gmpy2.h:83:10: fatal error: mpc.h: No such file or directory
83 | #include <mpc.h>
| ^~~~~~~
compilation terminated.
error: command '/app/vbuild/RHEL8-x86_64/gcc/12.2.0/bin/gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for gmpy2
Running setup.py clean for gmpy2
Failed to build gmpy2
ERROR: Could not build wheels for gmpy2, which is required to install pyproject.toml-based projects
I poked around in another project's setup.py and found this.
# How the build process finds the system libs:
#
# 1. if BORG_{LIBXXX,OPENSSL}_PREFIX is set, it will use headers and libs from there.
# 2. if not and pkg-config can locate the lib, the lib located by
# pkg-config will be used. We use the pkg-config tool via the pkgconfig
# python package, which must be installed before invoking setup.py.
# if pkgconfig is not installed, this step is skipped.
# 3. otherwise raise a fatal error.
try:
import pkgconfig as pc
except ImportError:
print("Warning: can not import pkgconfig python package.")
pc = None
def lib_ext_kwargs(pc, prefix_env_var, lib_name, lib_pkg_name, pc_version, lib_subdir="lib"):
system_prefix = os.environ.get(prefix_env_var)
if system_prefix:
print(f"Detected and preferring {lib_pkg_name} [via {prefix_env_var}]")
return dict(
include_dirs=[os.path.join(system_prefix, "include")],
library_dirs=[os.path.join(system_prefix, lib_subdir)],
libraries=[lib_name],
)
if pc and pc.installed(lib_pkg_name, pc_version):
print(f"Detected and preferring {lib_pkg_name} [via pkg-config]")
return pc.parse(lib_pkg_name)
raise Exception(
f"Could not find {lib_name} lib/headers, please set {prefix_env_var} "
f"or ensure {lib_pkg_name}.pc is in PKG_CONFIG_PATH."
)
Thanks for the help!
Metadata
Metadata
Assignees
Labels
No labels