MacOS: fix linker flags for SHLIB feature test #6283
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Amends #6034 by @kevinushey.
The problem is that
R CMD SHLIB
actually ignores$LDFLAGS
; you can easily test this with--dry-run
:Above is the
test-omp.c
from the configure script, and then run it with:LDFLAGS="-lomp" R CMD SHLIB --dry-run test-omp.c
You can see there is no
-lomp
in the output at all. The reason why the feature test succeeds anyway on most systems is that R defaults to-undefined dynamic_lookup
so it ignores missing libraries.However, on r-universe we cross compile without
-undefined dynamic_lookup
and therefore the feature test fails. If we set-lomp
in$PKG_LIBS
instead the feature test works.PKG_LIBS="-lomp" R CMD SHLIB --dry-run test-omp.c
I confirmed this fixes the cross compile as well.