Skip to content

Link the dual-build static library with libm - #1097

Open
fhgffy wants to merge 1 commit into
DaveGamble:masterfrom
fhgffy:fix-dual-static-libm
Open

fhgffy wants to merge 1 commit into
DaveGamble:masterfrom
fhgffy:fix-dual-static-libm

Conversation

@fhgffy

@fhgffy fhgffy commented Oct 5, 2026

Copy link
Copy Markdown

With BUILD_SHARED_AND_STATIC_LIBS=ON, only the shared cjson target links to m. The sibling cjson-static target therefore loses the math dependency, including through cjson_utils-static and the installed CMake exports.

Link the static target to m under the existing non-Windows condition. Add a dual-build static-link test and run it in the Linux GCC/Clang CI jobs with -fno-builtin-fabs, so compiler builtins cannot hide the missing dependency.

Verified locally with GCC 14.2 and CMake 3.31.6: the new test and installed static consumers fail on the original code with undefined references to fabs, then pass with this change. Shared-only, static-only, dual-build, utils on/off, and ordinary compiler-flag controls pass. The full dual-build suite passes all 23 tests. Clang, Windows, macOS, the minimum CMake 3.5 version, and hosted CI were not run locally.

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.

1 participant