Opened 2 months ago

#70683 new defect

db62 @6.2.32+universal: x86_64 symbols omitted from libdb_cxx.dylib

Reported by: gfiumara (Greg Fiumara) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: universal Cc:
Port: db62

Description

Although seemingly a universal library, libdb_cxx.dylib appears to not have any x86_64 symbols when built on an ARM Mac.

$ file /opt/local/lib/db62/libdb_cxx.dylib 
/opt/local/lib/db62/libdb_cxx.dylib: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit dynamically linked shared library x86_64] [arm64:Mach-O 64-bit dynamically linked shared library arm64]
/opt/local/lib/db62/libdb_cxx.dylib (for architecture x86_64):	Mach-O 64-bit dynamically linked shared library x86_64
/opt/local/lib/db62/libdb_cxx.dylib (for architecture arm64):	Mach-O 64-bit dynamically linked shared library arm64

$ lipo -archs /opt/local/lib/db62/libdb_cxx.dylib 
x86_64 arm64

$ nm -arch x86_64  /opt/local/lib/db62/libdb_cxx.dylib  
/opt/local/lib/db62/libdb_cxx.dylib: no symbols

This is not the case for the static library.

$ nm -x -arch x86_64 /opt/local/lib/db62/libdb_cxx.a | grep -m 1 DbEnv 
0000000000000000 01 00 0000 0000015f __ZN5DbEnv13runtime_errorEPS_PKcii

$ nm -x -arch arm64 /opt/local/lib/db62/libdb_cxx.a | grep -m 1 DbEnv 
0000000000000000 01 00 0000 00000166 __ZN5DbEnv13runtime_errorEPS_PKcii

Attaching minimal example that exercises C++ API for BerkeleyDB, which will have both sets of symbols. Compile with the following, and uncomment the CMakeLists.txt line to force the static lib over the missing symbol dynamic lib.

mkdir build
cd build
CMAKE_OSX_ARCHITECTURES="x86_64;arm64" cmake ..
make

Tested on macOS 14.6.1 (23G93), MacPorts 2.10.1, Apple M1 Max CPU

Attachments (2)

db62_cxx_test.cpp (283 bytes) - added by gfiumara (Greg Fiumara) 2 months ago.
CMakeLists.txt (697 bytes) - added by gfiumara (Greg Fiumara) 2 months ago.

Download all attachments as: .zip

Change History (2)

Changed 2 months ago by gfiumara (Greg Fiumara)

Attachment: db62_cxx_test.cpp added

Changed 2 months ago by gfiumara (Greg Fiumara)

Attachment: CMakeLists.txt added
Note: See TracTickets for help on using tickets.