You are not logged in.

#1 2024-03-24 20:01:52

commutator
Member
From: Ontario
Registered: 2022-11-23
Posts: 2

[SOLVED] rstudio-desktop fails to build: undefined reference to soci

Hello,

I'm trying to build the AUR's rstudio-desktop (archive) package. Running makepkg in the directory returns several errors involving undefined references to soci (archive) functions, which I will link to below.

For this build, I followed the process in DeveloperWiki:Building in a clean chroot (for demonstration purposes) (archive) as well as in the Arch User Repository (archive) ArchWiki page.

Here is the script that I wrote for this (chroot) install.
Note: the soci dependency for rstudio-desktop is resolved by linking to a tarball in my home directory, rather than that of the chroot; hopefully this isn't the cause of any issue.

#!/bin/bash
mkdir ~/chroot
CHROOT=$HOME/chroot
mkarchroot $CHROOT/root base-devel
arch-nspawn $CHROOT/root pacman -Syu
cd ~
# soci is the single required package for rstudio-desktop that is only provided in the AUR
# I build it first, so I can resolve that dependency
git clone https://aur.archlinux.org/soci.git
cd ~/soci
makechrootpkg -c -r $CHROOT
cd ~
git clone https://aur.archlinux.org/rstudio-desktop.git
cd rstudio-desktop
makechrootpkg -c -r $CHROOT -I $HOME/soci/soci-4.0.3-1-x86_64.pkg.tar.zst

The errors appear towards the end of the terminal output (archive). For example:

/usr/bin/ld: /tmp/ccwcJs4D.ltrans88.ltrans.o: in function `rstudio::session::modules::zotero::collections::(anonymous namespace)::execQuery(boost::shared_ptr<rstudio::core::database::IConnection>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::function<void (soci::row const&)>)':
/usr/src/debug/rstudio-desktop/rstudio-2023.12.1-402/src/cpp/core/include/core/Database.hpp:126:(.text+0x209f): undefined reference to `soci::row::row()'

Info:

$ cat /proc/sys/kernel/osrelease
6.8.1-arch1-1
$ cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 78
model name      : Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
stepping        : 3
microcode       : 0xf0
cpu MHz         : 2900.014
cache size      : 3072 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 22
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl smx est tm2 ssse3 sdbg cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit srbds mmio_stale_data retbleed gds
bogomips        : 5001.23
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 78
model name      : Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
stepping        : 3
microcode       : 0xf0
cpu MHz         : 2899.999
cache size      : 3072 KB
physical id     : 0
siblings        : 2
core id         : 1
cpu cores       : 2
apicid          : 2
initial apicid  : 2
fpu             : yes
fpu_exception   : yes
cpuid level     : 22
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl smx est tm2 ssse3 sdbg cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit srbds mmio_stale_data retbleed gds
bogomips        : 5001.23
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

I've looked through my journalctl but haven't found anything in the least bit informative there.

In the soci directory, I found

$ cd ~/chroot/nim/usr/include/soci
$ ls -la
total 300
drwxr-xr-x   6 root root  4096 Mar 24 12:41 .
drwxr-xr-x 215 root root 20480 Mar 24 12:42 ..
-rw-r--r--   1 root root  1225 Mar 24 12:38 backend-loader.h
-rw-r--r--   1 root root  6383 Mar 24 12:38 bind-values.h
-rw-r--r--   1 root root  1543 Mar 24 12:38 blob-exchange.h
-rw-r--r--   1 root root  1304 Mar 24 12:38 blob.h
-rw-r--r--   1 root root   878 Mar 24 12:38 boost-fusion.h
-rw-r--r--   1 root root  1117 Mar 24 12:38 boost-gregorian-date.h
-rw-r--r--   1 root root  1280 Mar 24 12:38 boost-optional.h
-rw-r--r--   1 root root   480 Mar 24 12:38 boost-tuple.h
-rw-r--r--   1 root root  1476 Mar 24 12:38 callbacks.h
-rw-r--r--   1 root root  3764 Mar 24 12:38 column-info.h
-rw-r--r--   1 root root  2822 Mar 24 12:38 connection-parameters.h
-rw-r--r--   1 root root   806 Mar 24 12:38 connection-pool.h
drwxr-xr-x   2 root root  4096 Mar 24 12:41 empty
-rw-r--r--   1 root root  1807 Mar 24 12:38 error.h
-rw-r--r--   1 root root  3140 Mar 24 12:38 exchange-traits.h
-rw-r--r--   1 root root  2441 Mar 24 12:38 into.h
-rw-r--r--   1 root root  6206 Mar 24 12:38 into-type.h
-rw-r--r--   1 root root  2635 Mar 24 12:38 logger.h
-rw-r--r--   1 root root   586 Mar 24 12:38 noreturn.h
drwxr-xr-x   2 root root  4096 Mar 24 12:41 odbc
-rw-r--r--   1 root root  3861 Mar 24 12:38 once-temp-type.h
drwxr-xr-x   2 root root  4096 Mar 24 12:41 postgresql
-rw-r--r--   1 root root  1468 Mar 24 12:38 prepare-temp-type.h
-rw-r--r--   1 root root  1816 Mar 24 12:38 procedure.h
-rw-r--r--   1 root root  1380 Mar 24 12:38 query_transformation.h
-rw-r--r--   1 root root  1510 Mar 24 12:38 ref-counted-prepare-info.h
-rw-r--r--   1 root root  2260 Mar 24 12:38 ref-counted-statement.h
-rw-r--r--   1 root root  1736 Mar 24 12:38 row-exchange.h
-rw-r--r--   1 root root  3252 Mar 24 12:38 row.h
-rw-r--r--   1 root root  1591 Mar 24 12:38 rowid-exchange.h
-rw-r--r--   1 root root   658 Mar 24 12:38 rowid.h
-rw-r--r--   1 root root  4059 Mar 24 12:38 rowset.h
-rw-r--r--   1 root root  7290 Mar 24 12:38 session.h
-rw-r--r--   1 root root 13178 Mar 24 12:38 soci-backend.h
-rw-r--r--   1 root root   964 Mar 24 12:38 soci-config.h
-rw-r--r--   1 root root  1650 Mar 24 12:38 soci.h
-rw-r--r--   1 root root  5226 Mar 24 12:38 soci-platform.h
-rw-r--r--   1 root root  7359 Mar 24 12:38 soci-simple.h
drwxr-xr-x   2 root root  4096 Mar 24 12:41 sqlite3
-rw-r--r--   1 root root  9092 Mar 24 12:38 statement.h
-rw-r--r--   1 root root   642 Mar 24 12:38 transaction.h
-rw-r--r--   1 root root 14621 Mar 24 12:38 type-conversion.h
-rw-r--r--   1 root root   996 Mar 24 12:38 type-conversion-traits.h
-rw-r--r--   1 root root  1268 Mar 24 12:38 type-holder.h
-rw-r--r--   1 root root   621 Mar 24 12:38 type-ptr.h
-rw-r--r--   1 root root   804 Mar 24 12:38 type-wrappers.h
-rw-r--r--   1 root root  2847 Mar 24 12:38 unsigned-types.h
-rw-r--r--   1 root root  3620 Mar 24 12:38 use.h
-rw-r--r--   1 root root 10248 Mar 24 12:38 use-type.h
-rw-r--r--   1 root root  3193 Mar 24 12:38 values-exchange.h
-rw-r--r--   1 root root  9425 Mar 24 12:38 values.h
-rw-r--r--   1 root root  1057 Mar 24 12:38 version.h

As relates to this issue, I've found an old Stack Overflow post about similar-looking errors, albeit in a different use case. It's not clear to me whether the accepted solution would work here, nor how I would implement it in my case.

I also found an RStudio GitHub PR related to the system finding soci libraries, but this was merged over a year ago.

Last edited by commutator (2024-03-24 22:38:45)

Offline

#2 2024-03-24 20:45:38

loqs
Member
Registered: 2014-03-06
Posts: 18,101

Re: [SOLVED] rstudio-desktop fails to build: undefined reference to soci

Have you tried building soci with static libraries disabled?  As I suspect the cause of the issue is the static libs in the soci package have been built with LTO but without the -ffat-lto-objects flag.  I suggest removing static libs in preference to adding the compiler flag as Arch's preference is to use shared libraries.

diff --git a/PKGBUILD b/PKGBUILD
index 529a0fd..c6dfd61 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -18,7 +18,6 @@ optdepends=('oracle-instantclient-basic: support for oracle databases'
             'unixodbc: support for ODBC databases'
             'libmysqlclient'
             'boost-libs')
-options=('staticlibs')
 source=("http://downloads.sourceforge.net/project/soci/soci/${pkgname}-${pkgver}/${pkgname}-${pkgver}.zip")
 sha1sums=('e76d5862f90cfa8a0f9fe6ce477c3c7fa669af62')
 
@@ -27,6 +26,7 @@ build() {
     mkdir -p "${srcdir}/${pkgname}-${pkgver}-build"
     cd "${srcdir}/${pkgname}-${pkgver}-build"
     cmake \
+        -DSOCI_STATIC=OFF \
         -DSOCI_TESTS=OFF \
         -DCMAKE_INSTALL_PREFIX="/usr" \
         -DCMAKE_CXX_STANDARD=11       \

Offline

#3 2024-03-24 22:36:52

commutator
Member
From: Ontario
Registered: 2022-11-23
Posts: 2

Re: [SOLVED] rstudio-desktop fails to build: undefined reference to soci

Thank you; making this fix to ~/soci/PKGBUILD resolved my issue. Marking as solved

Offline

Board footer

Powered by FluxBB