[R-pkg-devel] Question about Clang 17 Error

Reed A. Cartwright r@c@rtwr|ght @end|ng |rom gm@||@com
Wed Sep 27 22:37:59 CEST 2023


I was unable to reproduce the error on the rhub's clang17 docker image.

I notice that the linking command is slightly different between systems.
And this suggests that I need to find some way to get CRAN to pass -stdlib
flag at the linking stage.

CRAN:
/usr/local/clang17/bin/clang++ -std=gnu++17 -shared
-L/usr/local/clang/lib64 -L/usr/local/clang17/lib -L/usr/local/gcc13/lib64
-L/usr/local/lib64 -o rbedrock.so actors.o bedrock_leveldb.o dummy.o init.o
key_conv.o nbt.o random.o subchunk.o support.o -L./leveldb-mcpe/build
-pthread -lleveldb -lz

RHUB:
clang++-17 -stdlib=libc++ -std=gnu++14 -shared -L/opt/R/devel/lib/R/lib
-L/usr/local/lib -o rbedrock.so actors.o bedrock_leveldb.o dummy.o init.o
key_conv.o nbt.o random.o subchunk.o support.o -L./leveldb-mcpe/build
-pthread -lleveldb -lz -L/opt/R/devel/lib/R/lib -lR

On Wed, Sep 27, 2023 at 11:36 AM Gábor Csárdi <csardi.gabor using gmail.com>
wrote:

> You might be able to reproduce it with the clang17 container here:
>
> https://urldefense.com/v3/__https://r-hub.github.io/containers/__;!!IKRxdwAv5BmarQ!a5vkX68B5unua6_Zsh92b99AXfbJiewU7Mp0nqAKE0JDT8v3g2d08JZ8Yq_0ubp0j4GeTWWLjLVAN-FoLqhhk9c$
> You can either run it directly or with the rhub2 package:
>
> https://urldefense.com/v3/__https://github.com/r-hub/rhub2*readme__;Iw!!IKRxdwAv5BmarQ!a5vkX68B5unua6_Zsh92b99AXfbJiewU7Mp0nqAKE0JDT8v3g2d08JZ8Yq_0ubp0j4GeTWWLjLVAN-FoxPbUQlE$
>
> Gabor
>
> On Wed, Sep 27, 2023 at 8:29 PM Reed A. Cartwright
> <racartwright using gmail.com> wrote:
> >
> > My package, RBedrock, is now throwing an error when compiled against
> > Clang17. The error log is here:
> >
> >
> https://urldefense.com/v3/__https://www.stats.ox.ac.uk/pub/bdr/clang17/rbedrock.log__;!!IKRxdwAv5BmarQ!a5vkX68B5unua6_Zsh92b99AXfbJiewU7Mp0nqAKE0JDT8v3g2d08JZ8Yq_0ubp0j4GeTWWLjLVAN-FoNhThuZA$
> >
> > The important part is
> > """
> > Error: package or namespace load failed for ‘rbedrock’ in dyn.load(file,
> > DLLpath = DLLpath, ...):
> >  unable to load shared object
> >
> '/data/gannet/ripley/R/packages/tests-clang-trunk/rbedrock.Rcheck/00LOCK-rbedrock/00new/rbedrock/libs/rbedrock.so':
> >
> >
> /data/gannet/ripley/R/packages/tests-clang-trunk/rbedrock.Rcheck/00LOCK-rbedrock/00new/rbedrock/libs/rbedrock.so:
> > undefined symbol: _ZNSt3__122__libcpp_verbose_abortEPKcz
> > Error: loading failed
> > """
> >
> > From what I can gather through googling, this error can be caused by
> using
> > the C linker when one of the dependent libraries is a C++ library.
> >
> > I cannot tell if this is an issue with my package (likely) or CRAN's
> > clang17 setup (less likely).
> >
> > Background about the package: rbedrock is written in C but links against
> a
> > C++ library (Mojang's leveldb fork)  via the library's C-API functions. I
> > use a dummy .cpp file in the source directory to trigger R into using the
> > C++ linker. That does still seem to be happening according to the log.
> >
> > Has anyone seen this before and know where I should start looking to fix
> it?
> >
> > Thanks.
> >
> > --
> > Reed A. Cartwright, PhD
> > Associate Professor of Genomics, Evolution, and Bioinformatics
> > School of Life Sciences and The Biodesign Institute
> > Arizona State University
> > ==================
> > Address: The Biodesign Institute, PO Box 876401, Tempe, AZ 85287-6401 USA
> > Packages: The Biodesign Institute, 1001 S. McAllister Ave, Tempe, AZ
> > 85287-6401 USA
> > Office: Biodesign B-220C, 1-480-965-9949
> > Website:
> https://urldefense.com/v3/__http://cartwrig.ht/__;!!IKRxdwAv5BmarQ!a5vkX68B5unua6_Zsh92b99AXfbJiewU7Mp0nqAKE0JDT8v3g2d08JZ8Yq_0ubp0j4GeTWWLjLVAN-Fo7waq1VI$
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-package-devel using r-project.org mailing list
> >
> https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-package-devel__;!!IKRxdwAv5BmarQ!a5vkX68B5unua6_Zsh92b99AXfbJiewU7Mp0nqAKE0JDT8v3g2d08JZ8Yq_0ubp0j4GeTWWLjLVAN-FocAOfF7A$
>


More information about the R-package-devel mailing list