Skip to content
Prev 11197 / 12125 Next

[R-pkg-devel] Package builds on all systems except on Fedora with clang

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 at disroot.org>
Verzonden:?zondag 19 januari 2025 20:40
Aan:?Pepijn de Vries <pepijn.devries at outlook.com>
CC:?Ivan Krylov via R-package-devel <r-package-devel at 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 at outlook.com> ?????:
The Fedora-clang test fails with a symbol lookup error:
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