Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile: fix ar flags #79

Conversation

barracuda156
Copy link
Contributor

On macOS the current code may produce a broken static library due to missing table of contents – because ranlib is not being run. As a substitute for that, s can be added to ar flags.

@barracuda156
Copy link
Contributor Author

Otherwise I am getting this when installing BoomSpikeSlab:

/opt/local/bin/g++-mp-13 -std=gnu++17 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/opt/local/Library/Frameworks/R.framework/Resources/lib -Wl,-headerpad_max_install_names -L/opt/local/lib -lMacportsLegacySupport -Wl,-rpath,/opt/local/lib/libgcc -arch ppc -o BoomSpikeSlab.so boom_spike_slab_init.o logit_spike_slab_wrapper.o mlm_spike_slab_wrapper.o nested_regression_wrapper.o nnet_wrapper.o poisson_spike_slab_wrapper.o probit_spike_slab_wrapper.o quantile_spike_wrapper.o shrinkage_regression_wrapper.o spike_slab_wrapper.o splines.o /opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Boom/lib/libboom.a -F/opt/local/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: in /opt/local/Library/Frameworks/R.framework/Versions/4.3/Resources/library/Boom/lib/libboom.a, archive has no table of contents
collect2: error: ld returned 1 exit status
make: *** [BoomSpikeSlab.so] Error 1
ERROR: compilation failed for package ‘BoomSpikeSlab’

After running ranlib on libboom.a, everything works fine, and tests for BoomSpikeSlab pass. I am not sure why Boom installation succeeds despite a broken lib.

@steve-the-bayesian
Copy link
Owner

steve-the-bayesian commented Dec 18, 2023 via email

@barracuda156
Copy link
Contributor Author

@steve-the-bayesian Thank you for responding. I actually got the error with 0.9.14. CRAN tarball for it still seems to have rc without s and without ranlib.

@steve-the-bayesian
Copy link
Owner

steve-the-bayesian commented Dec 18, 2023 via email

@barracuda156
Copy link
Contributor Author

@steve-the-bayesian It is not needed on every platform, but it is needed on some.

See, for example, this issue: PolMine/RcppCWB#80 (comment)
And commit that fixed it: PolMine/RcppCWB@c6df1cc

@barracuda156
Copy link
Contributor Author

Builds fine with updated ar flags on every macOS: https://ports.macports.org/port/R-Boom/details

@steve-the-bayesian
Copy link
Owner

steve-the-bayesian commented Dec 20, 2023 via email

@barracuda156
Copy link
Contributor Author

@steve-the-bayesian Well, if the point is just fixing it for Macports, that has been done already locally. However, that leaves the build broken for anyone who tries to build it on affected platforms without Macports. Unfortunately, it does not even fail as such, but leaves the library unusable, which can be frustrating for someone who is not familiar with the issue.

Of course, if there is a known case where adding s breaks the library for some other platform, it should be avoided in a general case. On macOS it is fine across the board, this is pretty sure. I cannot guarantee the same for every possible Unix-like OS, but it seems it is universally supported.

CRAN's heavy portability rules as a constraint

While I am aware that CRAN normally does not bother about anything besides a few bleeding edge versions, I do not think they have a policy of breaking something out of principle :)
Having said that, this is of course up to you to decide whether better portability matters or not. IMO, the fix is trivial and does not introduce any complications in terms of future efforts to support it.

@steve-the-bayesian
Copy link
Owner

steve-the-bayesian commented Dec 20, 2023 via email

@barracuda156
Copy link
Contributor Author

Thank you!

@steve-the-bayesian steve-the-bayesian merged commit 4db34ae into steve-the-bayesian:master Apr 5, 2024
@barracuda156 barracuda156 deleted the unbreak_darwin_lib branch April 5, 2024 17:00
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