Skip to content

CMake: use BUILD_SHARED_LIBS in simd/ and fuzz/ - #456

Open
skal65535 wants to merge 2 commits into
mozilla:masterfrom
skal65535:fix-simd-pic-shared-build
Open

skal65535 wants to merge 2 commits into
mozilla:masterfrom
skal65535:fix-simd-pic-shared-build

Conversation

@skal65535

Copy link
Copy Markdown

simd/CMakeLists.txt and fuzz/CMakeLists.txt still test ENABLE_SHARED /
ENABLE_STATIC, which no longer exist — the top level uses BUILD_SHARED_LIBS
(default TRUE), so both conditions are dead.

simd: no -fPIC on the objects, no -DPIC for NASM, so linking
libjpeg.so fails on x86_64 — static __thread simd_support gets local-exec
TLS relocations:

relocation R_X86_64_TPOFF32 against `simd_support' can not be used when
making a shared object

This breaks a plain cmake && make on a fresh clone. Fixes #449.

fuzz: if(NOT ENABLE_STATIC) is always true, so -DWITH_FUZZ=1 aborts at
configure even with -DBUILD_SHARED_LIBS=OFF.

libjpeg-turbo defines ENABLE_SHARED itself, so the rename is mozjpeg-only.

Verified on Ubuntu 26.04 / gcc 15.2 / nasm 3.01: default build links,
cjpeg/djpeg round-trip OK.

simd/CMakeLists.txt still tests ENABLE_SHARED, which no longer exists:
the top level now uses BUILD_SHARED_LIBS (default TRUE). The condition
is always false, so the simd objects are built without -fPIC and linking
libjpeg.so fails on x86_64:

  relocation R_X86_64_TPOFF32 against `simd_support' can not be used
  when making a shared object

This breaks a default cmake && make on a fresh clone (issue mozilla#449).
ENABLE_STATIC was removed along with ENABLE_SHARED, so the guard is
always true and WITH_FUZZ=1 aborts at configure time. The fuzz targets
link jpeg-static and turbojpeg-static, which exist when
BUILD_SHARED_LIBS is off.
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.

Build error on master, on Ubuntu 24.04 vanilla

1 participant