Bug 245048 - emulators/virtualbox-ose: failed with message "version CXXABI_1.3.9 required by /usr/local/lib/virtualbox/VBoxRT.so not found"
Summary: emulators/virtualbox-ose: failed with message "version CXXABI_1.3.9 required ...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: Virtualbox Team (Nobody)
URL:
Keywords:
Depends on: 182468 183085
Blocks:
  Show dependency treegraph
 
Reported: 2020-03-25 10:32 UTC by Hiroyuki Une
Modified: 2020-04-04 09:21 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (vbox)


Attachments
build log of virtualbox-ose (until DynamicConfig.kmk on early stage of build) (60.30 KB, text/plain)
2020-03-25 10:32 UTC, Hiroyuki Une
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hiroyuki Une 2020-03-25 10:32:48 UTC
Created attachment 212694 [details]
build log of virtualbox-ose (until DynamicConfig.kmk on early stage of build)

After I upgraded virtualbox-ose to 5.3.34_1 (ports r528258) built by poudriere (I attached the build log until DynamicConfig.kmk was build), it failed with the following error messages.  

=== begin error messages
% virtualbox
VirtualBox: Error -610 in supR3HardenedMainInitRuntime!
VirtualBox: dlopen("/usr/local/lib/virtualbox/VBoxRT.so",) failed: /usr/lib/libstdc++.so.6: version CXXABI_1.3.9 required by /usr/local/lib/virtualbox/VBoxRT.so not found

VirtualBox: Tip! It may help to reinstall VirtualBox.

=== end error messages

IMHO, /usr/local/lib/virtualbox/VBoXRT.so dlopen(3)ed by virtualbox should be linked with /usr/local/lib/gcc9/libstdc++.so.6 installed by lang/gcc9 which is used to build virtualbox-ose.  However, rtld(1) chooses /usr/lib/libstdc++.so.6 to link due to the following configuration by ldconfig(8).  

=== begin the output of ldconfig -r for libstdc++.so.6
% ldconfig -r | grep libstdc\+\+
        105:-lstdc++.6 => /usr/lib/libstdc++.so.6
        1189:-lstdc++.6 => /usr/local/lib/gcc7/libstdc++.so.6
        1201:-lstdc++.6 => /usr/local/lib/gcc8/libstdc++.so.6
        1207:-lstdc++.6 => /usr/local/lib/gcc9/libstdc++.so.6

=== end the output of ldconfig -r for libstdc++.so.6

I tried using LD_LIBRARY_PATH, but it had no effect.  I would appreciate if someone gives any suggestion.
Comment 1 Volodymyr Kostyrko 2020-03-30 09:27:12 UTC
Actually the last change to GCC brought a number of issues.

Right now port is unbuildable in presence of GCC 4.8:

kBuild: Linking VBoxDDR0
filesplitter: Out of 165 files: 165 rewritten, 0 unchanged. (/tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.2.34/out/freebsd.amd64/release/obj/VirtualBox/include)
kmk_builtin_append "/tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.2.34/out/freebsd.amd64/release/obj/VirtualBox/include/COMWrappers"
kBuild: Linking VBoxDDRC
kBuild: Generating /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.2.34/out/freebsd.amd64/release/obj/Runtime/oiddb.h.ts
ld-elf.so.1: /usr/local/lib/gcc48/libstdc++.so.6: version GLIBCXX_3.4.21 required by /tmp/ports/usr/ports/emulators/virtualbox-ose/work/VirtualBox-5.2.34/out/freebsd.amd64/release/obj/oiddb2c/oiddb2c not found

I.e. it does pull GCC 9.3, but if GCC 4.8 is also present it's used also for linking.

As I'm running 12-STABLE I have no /usr/lib/libstdc++.so.6 (and probably you shouldn't have it too). Please post your `uname -a`, system upgrade path used if any and if you are using source build whether you cleaned up local system by `make -C /usr/src delete-old`.
Comment 2 Bryan Drewery freebsd_committer freebsd_triage 2020-03-30 21:41:10 UTC
The required -rpath from bsd.gcc.mk isn't making it into the build properly.
Comment 3 Bryan Drewery freebsd_committer freebsd_triage 2020-03-30 21:55:55 UTC
I'm testing a patch to resolve this.
Comment 4 commit-hook freebsd_committer freebsd_triage 2020-03-31 17:41:46 UTC
A commit references this bug:

Author: bdrewery
Date: Tue Mar 31 17:41:05 UTC 2020
New revision: 529993
URL: https://svnweb.freebsd.org/changeset/ports/529993

Log:
  - Fix runtime for gcc rpath. [1]
    This is a regression of something that was working in the past. Please
    keep the _GCC_RUNTIME handling even if removing USE_GCC as it may
    come back again in the future and be forgotten.
  - Fix build on 11.3 with ports ssl. [2]

  PR:		245048 [1]
  PR:		243315 [2]
  Submitted by:	John Hein <jcfyecrayz at liamekaens.com> [2]

Changes:
  head/emulators/virtualbox-ose/Makefile
  head/emulators/virtualbox-ose/files/patch-src_VBox_RDP-client-1.8.4-Makefile.kmk
Comment 5 commit-hook freebsd_committer freebsd_triage 2020-03-31 18:06:53 UTC
A commit references this bug:

Author: bdrewery
Date: Tue Mar 31 17:46:10 UTC 2020
New revision: 529997
URL: https://svnweb.freebsd.org/changeset/ports/529997

Log:
  MFH: r529993

  - Fix runtime for gcc rpath. [1]
    This is a regression of something that was working in the past. Please
    keep the _GCC_RUNTIME handling even if removing USE_GCC as it may
    come back again in the future and be forgotten.
  - Fix build on 11.3 with ports ssl. [2]

  PR:		245048 [1]
  PR:		243315 [2]
  Submitted by:	John Hein <jcfyecrayz at liamekaens.com> [2]

  Approved by:	portmgr (implicit)

Changes:
_U  branches/2020Q1/
  branches/2020Q1/emulators/virtualbox-ose/Makefile
  branches/2020Q1/emulators/virtualbox-ose/files/patch-src_VBox_RDP-client-1.8.4-Makefile.kmk
Comment 6 Hiroyuki Une 2020-04-01 10:38:52 UTC
I'm sorry that it's too late to say thank you.  
And also, I'm afraid to say that gcc 4.8 didn't cause the error.   

As Mr. Volodymyr Kostyrko pointed out, 
FreeBSD (include my 11-stable:r359231 box) doesn't have 
/usr/lib/libstdc++.so.6.  That might be installed into my box by accident.  
After removing that library, virtualbox works correctly.  

Anyway, it was great pleasure to hear that 
the bug caused by gcc 4.8 was fixed.  

Best regards,
Comment 7 wolfgang 2020-04-04 09:21:48 UTC
Just a note: This problem did happen on 12.1-STABLE for me even without gcc4.8 installed, due to the presence of port misc/compat9x. The changes by bdrewery did NOT fix the build for me. Removing misc/compat9x fixed the build.