[R-pkg-devel] Package builds on all systems except on Fedora with clang
Pepijn de Vries
pep|jn@devr|e@ @end|ng |rom out|ook@com
Sun Jan 19 21:42:17 CET 2025
Hi Ivan,
Thank you for the quick response. The linked discussion thread was also helpful.
I think I could write a similar test as used by `cpp11tesseract`:
https://github.com/pachadotdev/cpp11tesseract/blob/2ea8287ef2c27901446bafa402728014d99904d4/configure#L66-L85
Kind regards,
Pepijn
________________________________________
Van: Ivan Krylov <ikrylov using disroot.org>
Verzonden: zondag 19 januari 2025 20:40
Aan: Pepijn de Vries <pepijn.devries using outlook.com>
CC: Ivan Krylov via R-package-devel <r-package-devel using r-project.org>
Onderwerp: Re: [R-pkg-devel] Package builds on all systems except on Fedora with clang
В Sun, 19 Jan 2025 17:07:51 +0000
Pepijn de Vries <pepijn.devries using outlook.com> пишет:
> He also mentioned that I "need to check in your configure script that
> the external library you need is available *and* usable with the
> compilers used to compile R and packages."
The Fedora-clang test fails with a symbol lookup error:
>> /data/gannet/ripley/R/packages/tests-clang/openmpt.Rcheck/00LOCK-openmpt/00new/openmpt/libs/openmpt.so:
>> undefined symbol:
>> _ZNK7openmpt6module15ctl_get_integerENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE
Translated using 'c++filt', the missing function turns out to be
openmpt::module::ctl_get_integer(std::__1::basic_string_view<char,
std::__1::char_traits<char> >) const. Why would libopenmpt.so be
missing a method for an std::string_view?
The problem here is that the Clang checks compile C++ code with the
"libc++" standard library that belongs to the LLVM project (same people
who develop Clang). The openmpt library, on the other hand, comes from
Fedora and is compiled and linked with the GNU "libstdc++" standard
library. The two standard libraries have very different internals and
can't be mixed. There's nothing you should do as a package developer to
make it work [1] (thank you Tomas for the clarification!).
I think that Prof. Ripley is asking you to make a configure test that
fails in these circumstances. Here's one that should work:
1. Write a C++ source file that includes OpenMPT headers and exports a
single function that calls the problematic OpenMPT function.
2. During ./configure, export the environment variables PKG_CPPFLAGS,
PKG_LIBS with the same contents that you intend to give to Makevars.
3. From the same ./configure script, call ${R_HOME}/bin/R CMD SHLIB to
compile the source file from (1) and link it into a shared library.
4. Call R again to dyn.load() the shared library. (Use
.Platform$dynlib.ext to figure out the file extension.)
--
Best regards,
Ivan
[1] https://stat.ethz.ch/pipermail/r-package-devel/2024q4/011326.html
More information about the R-package-devel
mailing list