Skip to content

Building sharedmods fails with any dangling symlink in include path #101778

@jmroot

Description

@jmroot

Bug report

I am the maintainer of the Python ports in MacPorts. Ports generally install their headers to /opt/local/include, and that is the case for several of Python's dependencies, so we configure the Python build to use it. It appears that Python will fail to build if any dangling symlink exists in that include directory, even if it's not a header that Python uses at all. The build output ends like this:

DYLD_FRAMEWORK_PATH=/opt/local/var/macports/build/<…>_ports_lang_python311/python311/work/Python-3.11.2 ./python.exe -E -S -m sysconfig --generate-posix-vars ;\
	if test $? -ne 0 ; then \
		echo "generate-posix-vars failed" ; \
		rm -f ./pybuilddir.txt ; \
		exit 1 ; \
	fi
DYLD_FRAMEWORK_PATH=/opt/local/var/macports/build/<…>_ports_lang_python311/python311/work/Python-3.11.2 ./python.exe -E -c 'import sys ; from sysconfig import get_platform ; print("%s-%d.%d" % (get_platform(), *sys.version_info[:2]))' >platform
DYLD_FRAMEWORK_PATH=/opt/local/var/macports/build/<…>_ports_lang_python311/python311/work/Python-3.11.2 CC='/usr/bin/clang' LDSHARED='/usr/bin/clang -bundle -undefined dynamic_lookup -L/opt/local/lib -Wl,-headerpad_max_install_names -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -arch x86_64  -flto -Wl,-export_dynamic -g -fprofile-instr-generate' OPT='-DNDEBUG -g -fwrapv -O3 -Wall' 	./python.exe -E ./setup.py --no-user-cfg  build
running build
running build_ext
error: [Errno 2] No such file or directory: '/opt/local/include/lapacke_utils.h'
make[3]: *** [sharedmods] Error 1

There is no reference to lapacke_utils.h anywhere in the configured sources, so I can only assume something must be scanning the entire include path. Of course our OpenBLAS port should not be installing dangling symlinks, but I think the Python build system should be able to tolerate them when they are not something that is needed or used at all.

I think this was the first downstream report of this issue, and has a full log attached: https://trac.macports.org/ticket/66242

Your environment

  • CPython versions tested on: 3.11.2
  • Operating system and architecture: macOS 13.2 x86_64

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-macbuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions