8000 build: fix '-ldl' link error on OpenBSD as dlopen lives in libc by pirmd · Pull Request #90 · irmen/pyminiaudio · GitHub
[go: up one dir, main page]

Skip to content

build: fix '-ldl' link error on OpenBSD as dlopen lives in libc - #90

Merged
irmen merged 1 commit into
irmen:masterfrom
pirmd:fix-openbsd-dl-link
Oct 31, 2026
Merged

irmen merged 1 commit into
irmen:masterfrom
pirmd:fix-openbsd-dl-link

Conversation

@pirmd
@pirmd pirmd commented Oct 14, 2026
Copy link
Copy Markdown
Contributor

On OpenBSD, dlopen is available in libc, current build add -ldl flags to all posix platform leding to an error on OpenBSD :

running bdist_wheel
running build
running build_py
running build_ext
generating cffi module 'build/temp.openbsd-7.9-amd64-cpython-313/_miniaudio.c'
already up-to-date
building '_miniaudio' extension
cc -pthread -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -O2 -pipe -g -DXML_DTD -DXML_GE=1 -fPIC -O2 -pipe -g -DXML_DTD -DXML_GE=1 -O2 -pipe -g -DXML_DTD -DXML_GE=1 -fPIC -DMA_NO_GENERATION=1 -DMA_NO_ENCODING=1 -DMA_NO_RESOURCE_MANAGER=1 -DMA_NO_NODE_GRAPH=1 -DMA_NO_ENGINE=1 -I/home/pir/devel/pyminiaudio -I/home/pir/devel/pyminiaudio -I/home/pir/.cache/uv/builds-v0/.tmpV6mRux/include -I/usr/local/include/python3.13 -c build/temp.openbsd-7.9-amd64-cpython-313/_miniaudio.c -o build/temp.openbsd-7.9-amd64-cpython-313/build/temp.openbsd-7.9-amd64-cpython-313/_miniaudio.o -g1 -O3 -ffast-math
cc -pthread -fno-strict-overflow -Wsign-compare -Wunreachable-code -DNDEBUG -O2 -pipe -g -DXML_DTD -DXML_GE=1 -fPIC -O2 -pipe -g -DXML_DTD -DXML_GE=1 -O2 -pipe -g -DXML_DTD -DXML_GE=1 -fPIC -DMA_NO_GENERATION=1 -DMA_NO_ENCODING=1 -DMA_NO_RESOURCE_MANAGER=1 -DMA_NO_NODE_GRAPH=1 -DMA_NO_ENGINE=1 -I/home/pir/devel/pyminiaudio -I/home/pir/devel/pyminiaudio -I/home/pir/.cache/uv/builds-v0/.tmpV6mRux/include -I/usr/local/include/python3.13 -c miniaudio.c -o build/temp.openbsd-7.9-amd64-cpython-313/miniaudio.o -g1 -O3 -ffast-math
cc -pthread -shared -fPIC -L/usr/local/lib/ build/temp.openbsd-7.9-amd64-cpython-313/build/temp.openbsd-7.9-amd64-cpython-313/_miniaudio.o build/temp.openbsd-7.9-amd64-cpython-313/miniaudio.o -L/usr/local/lib -lm -lpthread -ldl -o build/lib.openbsd-7.9-amd64-cpython-313/_miniaudio.abi3.so
ld: error: unable to find library -ldl
cc: error: linker command failed with exit code 1 (use -v to see invocation)
error: Command '['cc', '-pthread', '-shared', '-fPIC', '-L/usr/local/lib/', 'build/temp.openbsd-7.9-amd64-cpython-313/build/temp.openbsd-7.9-amd64-cpython-313/_miniaudio.o', 'build/temp.openbsd-7.9-amd64-cpython-313/miniaudio.o', '-L/usr/local/lib', '-lm', '-lpthread', '-ldl', '-o', 'build/lib.openbsd-7.9-amd64-cpython-313/_miniaudio.abi3.so']' returned non-zero exit status 1.
  × Failed to build `/home/pir/devel/pyminiaudio`
  ├─▶ The build backend returned an error
  ╰─▶ Call to `setuptools.build_meta.build_wheel` failed (exit status: 1)
      hint: This usually indicates a problem with the package or the build environment.

This fix check sys.platform against openbsd to prevent adding '-ldl' to libraries on this platform.

@irmen
irmen merged commit 43eac0b into irmen:master Oct 31, 2026
@irmen
irmen commented Oct 31, 2026
Copy link
Copy Markdown
Owner

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0