2 years ago
#63984
Iulian98
Numpy building from source: RuntimeError: Broken toolchain: cannot link a simple C program
I keep getting an error when I'm trying to build numpy from source code. This is the error:
running build_ext
running build_src
INFO: build_src
INFO: building py_modules sources
INFO: building library "npymath" sources
as: unrecognized option '--64'
Traceback (most recent call last):
File "/home/iulian/Downloads/numpy-1.22.0/setup.py", line 450, in <module>
setup_package()
File "/home/iulian/Downloads/numpy-1.22.0/setup.py", line 442, in setup_package
setup(**metadata)
File "/home/iulian/Downloads/numpy-1.22.0/numpy/distutils/core.py", line 169, in setup
return old_setup(**new_attr)
File "/home/iulian/.local/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/iulian/Downloads/numpy-1.22.0/numpy/distutils/command/build_ext.py", line 101, in run
self.run_command('build_src')
File "/usr/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/iulian/Downloads/numpy-1.22.0/numpy/distutils/command/build_src.py", line 144, in run
self.build_sources()
File "/home/iulian/Downloads/numpy-1.22.0/numpy/distutils/command/build_src.py", line 155, in build_sources
self.build_library_sources(*libname_info)
File "/home/iulian/Downloads/numpy-1.22.0/numpy/distutils/command/build_src.py", line 288, in build_library_sources
sources = self.generate_sources(sources, (lib_name, build_info))
File "/home/iulian/Downloads/numpy-1.22.0/numpy/distutils/command/build_src.py", line 378, in generate_sources
source = func(extension, build_dir)
File "numpy/core/setup.py", line 701, in get_mathlib_info
raise RuntimeError(
RuntimeError: Broken toolchain: cannot link a simple C program.
My building system is Ubuntu 18.04.6.
I'm using python3.9.10 to build numpy 1.22.0.
I need to generate the module's files to use them for an arm device, which has no internet connection.
I already tried to change the gcc/g++ version from gcc/++-6 to gcc/++-7/8
Please, if you have any idea about this, I would apreciate the help. Thanks!
EDIT:
I'm building numpy by cross-compiling with the following commands: `python3 setup.py build_ext' 'python3 setup.py install --prefix=./install/'
UPDATE:
I solved the problem with BROKEN TOOLCHAIN, by setting the CC and CXX flags:
export CC=arm-cortexa9-linux-gnueabi-gcc
export CXX=arm-cortexa9-linux-gnueabi-g++
but i got another error:
/usr/lib/python3.9/distutils/dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building py_modules sources
building library "npymath" sources
adding 'build/src.linux-x86_64-3.9/numpy/core/src/npymath' to include_dirs.
None - nothing done with h_files = ['build/src.linux-x86_64-3.9/numpy/core/src/npymath/npy_math_internal.h']
building library "npyrandom" sources
building extension "numpy.core._multiarray_tests" sources
building extension "numpy.core._multiarray_umath" sources
Traceback (most recent call last):
File "/home/iulian/Downloads/test/numpy-1.20.0/setup.py", line 513, in <module>
setup_package()
File "/home/iulian/Downloads/test/numpy-1.20.0/setup.py", line 505, in setup_package
setup(**metadata)
File "/home/iulian/Downloads/test/numpy-1.20.0/numpy/distutils/core.py", line 169, in setup
return old_setup(**new_attr)
File "/home/iulian/.local/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/iulian/Downloads/test/numpy-1.20.0/numpy/distutils/command/build.py", line 61, in run
old_build.run(self)
File "/usr/lib/python3.9/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/lib/python3.9/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/iulian/Downloads/test/numpy-1.20.0/numpy/distutils/command/build_src.py", line 144, in run
self.build_sources()
File "/home/iulian/Downloads/test/numpy-1.20.0/numpy/distutils/command/build_src.py", line 161, in build_sources
self.build_extension_sources(ext)
File "/home/iulian/Downloads/test/numpy-1.20.0/numpy/distutils/command/build_src.py", line 318, in build_extension_sources
sources = self.generate_sources(sources, ext)
File "/home/iulian/Downloads/test/numpy-1.20.0/numpy/distutils/command/build_src.py", line 378, in generate_sources
source = func(extension, build_dir)
File "numpy/core/setup.py", line 444, in generate_config_h
moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir)
File "numpy/core/setup.py", line 49, in check_types
out = check_types(*a, **kw)
File "numpy/core/setup.py", line 294, in check_types
raise SystemError(
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
I'm using an arm cross compiler: arm-cortexa9-linux-gnueabi
The error says that I have to install python-dev(python3-dev in my situation). But I already installed both with: sudo apt-get install python3-dev python-dev
and still not working.
python
numpy
compiler-errors
toolchain
building
0 Answers
Your Answer