Skip to content

BUG: Cannot install from source on macOS 12.1 with ld: library not found for -lSystem #20677

@corneliusroemer

Description

@corneliusroemer

Describe the issue:

I'm trying to contribute and thus build from source but I can't get it to work.

I get the following error:

ld: library not found for -lSystem
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)

I created a conda environment using

conda env create -n numpydev

and this seems to be where ld was installed:

  - ld64                            530  hd2e7500_21         installed         
  - ld64_osx-64                     530  he8994da_21         installed         
  - ldid                          2.1.2  h6a69015_3          installed 
❯ which ld
/usr/local/Caskroom/mambaforge/base/envs/numpydev/bin/ld

❯ ld -v
@(#)PROGRAM:ld  PROJECT:ld64-530
BUILD 16:51:25 Apr  5 2021
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em (tvOS)
LTO support using: LLVM version 11.1.0 (static support for 27, runtime is 27)
TAPI support using: TAPI version 11.0.0 (tapi-1100.0.11)

❯ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.30)
Target: x86_64-apple-darwin21.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Reproduce the code example:

python runtests.py -vv

Error message:

This is the full stack trace:

Full stack trace
python runtests.py -vv
Building, see build.log...
Running from numpy source directory.
numpy/random/_bounded_integers.pxd.in has not changed
numpy/random/_philox.pyx has not changed
numpy/random/_bounded_integers.pyx.in has not changed
numpy/random/_sfc64.pyx has not changed
numpy/random/_mt19937.pyx has not changed
numpy/random/bit_generator.pyx has not changed
numpy/random/_bounded_integers.pyx has not changed
numpy/random/mtrand.pyx has not changed
numpy/random/_generator.pyx has not changed
numpy/random/_pcg64.pyx has not changed
numpy/random/_common.pyx has not changed
Cythonizing sources
INFO: blas_opt_info:
INFO: blas_armpl_info:
INFO: customize UnixCCompiler
INFO:   libraries armpl_lp64_mp not found in ['/usr/local/Caskroom/mambaforge/base/envs/numpydev/lib', '/usr/local/lib', '/usr/lib']
INFO:   NOT AVAILABLE
INFO: 
INFO: blas_mkl_info:
INFO:   libraries  not found in ['']
INFO:   NOT AVAILABLE
INFO: 
INFO: blis_info:
INFO:   libraries blis not found in ['']
INFO:   NOT AVAILABLE
INFO: 
INFO: openblas_info:
INFO:   libraries  not found in ['']
INFO:   NOT AVAILABLE
INFO: 
INFO: accelerate_info:
INFO:   libraries accelerate not found in ['/usr/local/Caskroom/mambaforge/base/envs/numpydev/lib', '/usr/local/lib', '/usr/lib']
INFO: Library accelerate was not found. Ignoring
INFO:   libraries veclib not found in ['/usr/local/Caskroom/mambaforge/base/envs/numpydev/lib', '/usr/local/lib', '/usr/lib']
INFO: Library veclib was not found. Ignoring
INFO:   FOUND:
INFO:     extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
INFO:     extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
INFO:     define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]
INFO: 
INFO:   FOUND:
INFO:     extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
INFO:     extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
INFO:     define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]
INFO: 
INFO: lapack_opt_info:
INFO: lapack_armpl_info:
INFO:   libraries armpl_lp64_mp not found in ['/usr/local/Caskroom/mambaforge/base/envs/numpydev/lib', '/usr/local/lib', '/usr/lib']
INFO:   NOT AVAILABLE
INFO: 
INFO: lapack_mkl_info:
INFO:   libraries  not found in ['']
INFO:   NOT AVAILABLE
INFO: 
INFO: openblas_lapack_info:
INFO:   libraries  not found in ['']
INFO:   NOT AVAILABLE
INFO: 
INFO: openblas_clapack_info:
INFO:   libraries  not found in ['']
INFO:   NOT AVAILABLE
INFO: 
INFO: flame_info:
INFO:   libraries  not found in ['']
INFO:   NOT AVAILABLE
INFO: 
INFO:   FOUND:
INFO:     extra_compile_args = ['-msse3', '-I/System/Library/Frameworks/vecLib.framework/Headers']
INFO:     extra_link_args = ['-Wl,-framework', '-Wl,Accelerate']
INFO:     define_macros = [('NO_ATLAS_INFO', 3), ('HAVE_CBLAS', None)]
INFO: 
Warning: attempted relative import with no known parent package
/usr/local/Caskroom/mambaforge/base/envs/numpydev/lib/python3.10/distutils/dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
  warnings.warn(msg)
running build
running config_cc
INFO: unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
INFO: unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
INFO: build_src
INFO: building py_modules sources
INFO: building library "npymath" sources
ld: library not found for -lSystem
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
Traceback (most recent call last):
  File "/Users/cr/code/numpy/setup.py", line 455, in <module>
    setup_package()
  File "/Users/cr/code/numpy/setup.py", line 447, in setup_package
    setup(**metadata)
  File "/Users/cr/code/numpy/numpy/distutils/core.py", line 169, in setup
    return old_setup(**new_attr)
  File "/usr/local/Caskroom/mambaforge/base/envs/numpydev/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/Caskroom/mambaforge/base/envs/numpydev/lib/python3.10/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/local/Caskroom/mambaforge/base/envs/numpydev/lib/python3.10/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/usr/local/Caskroom/mambaforge/base/envs/numpydev/lib/python3.10/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/Users/cr/code/numpy/numpy/distutils/command/build.py", line 62, in run
    old_build.run(self)
  File "/usr/local/Caskroom/mambaforge/base/envs/numpydev/lib/python3.10/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/usr/local/Caskroom/mambaforge/base/envs/numpydev/lib/python3.10/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/usr/local/Caskroom/mambaforge/base/envs/numpydev/lib/python3.10/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/Users/cr/code/numpy/numpy/distutils/command/build_src.py", line 144, in run
    self.build_sources()
  File "/Users/cr/code/numpy/numpy/distutils/command/build_src.py", line 155, in build_sources
    self.build_library_sources(*libname_info)
  File "/Users/cr/code/numpy/numpy/distutils/command/build_src.py", line 288, in build_library_sources
    sources = self.generate_sources(sources, (lib_name, build_info))
  File "/Users/cr/code/numpy/numpy/distutils/command/build_src.py", line 378, in generate_sources
    source = func(extension, build_dir)
  File "/Users/cr/code/numpy/numpy/core/setup.py", line 702, in get_mathlib_info
    raise RuntimeError(
RuntimeError: Broken toolchain: cannot link a simple C program. 

Build failed!

NumPy/Python version information:

Not applicable

Metadata

Metadata

Assignees

No one assigned

    Labels

    00 - Bug57 - Close?Issues which may be closable unless discussion continued

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions