[R-pkg-devel] Package builds on all systems except on Fedora with clang
Ivan Krylov
|kry|ov @end|ng |rom d|@root@org
Sun Jan 19 22:23:17 CET 2025
В Sun, 19 Jan 2025 20:42:17 +0000
Pepijn de Vries <pepijn.devries using outlook.com> пишет:
> I think I could write a similar test as used by `cpp11tesseract`:
>
> https://github.com/pachadotdev/cpp11tesseract/blob/2ea8287ef2c27901446bafa402728014d99904d4/configure#L66-L85
I should have replied to that thread too, but got swamped. If the
compiler flags are right, $CXX -c conftest.cpp will succeed the same way
that the individual object files currently successfully compile on
Fedora-clang [1]:
>> /usr/local/clang19/bin/clang++ -stdlib=libc++ -std=gnu++17
>> -I"/data/gannet/ripley/R/R-clang/include" -DNDEBUG -pthread
>> -I'/data/gannet/ripley/R/test-clang/cpp11/include' -isystem
>> /usr/local/clang19/include -I/usr/local/clang/include -fpic -O3
>> -Wall -pedantic -frtti -Wp,-D_FORTIFY_SOURCE=3
>> -Wno-missing-template-arg-list-after-template-kw -DR_NO_REMAP -c
>> audio.cpp -o audio.o
Even linking the shared library is not enough, because that step
succeeds on Fedora-clang too:
>> /usr/local/clang19/bin/clang++ -stdlib=libc++ -std=gnu++17 -shared
>> -L/usr/local/clang/lib64 -L/usr/local/clang19/lib
>> -L/usr/local/clang19/lib/x86_64-unknown-linux-gnu
>> -L/usr/local/gcc14/lib64 -L/usr/local/lib64 -o openmpt.so audio.o
>> cpp11.o ctl.o format.o get_mod.o helpers.o info.o io.o module_ext.o
>> names.o render.o render_params.o repeat.o setpos.o state.o subsong.o
>> -lopenmpt -lportaudiocpp -lportaudio -lm -lpthread -lasound
Testing only the previous two steps will succeed during ./configure on
the Fedora-clang check and then fail to load the shared library during
package installation, like it currently does. Using R CMD SHLIB, on the
other hand, spares the effort of trying to figure out the right
compiler and giving it all the right flags.
Unrelated, but speaking of the default linker flags,
>> PKG_LIBS="-llibportaudio -llibportaudiocpp -llibopenmpt"
These are a bit counter-intuitive. When you ask the linker to link with
-lfoo, it tries to link with libfoo.a or libfoo.so, i.e. it prepends
the "lib" by itself.
Also unrelated, but is there OpenMPT in the macOS 'recipes' system? I
think it's the recommended way of making use of third-party code in
CRAN packages [2].
--
Best regards,
Ivan
[1]
https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-fedora-clang/openmpt-00install.html
[2]
https://cran.r-project.org/web/packages/external_libs.html
More information about the R-package-devel
mailing list