You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] libpulsarwithdeps.a misses some symbols on Linux or macOS #512
Download the macos-arm64.zip and follow the guide here to verify it.
What did you expect to see?
The application run successfully
What did you see instead?
% clang++ main.cc ./lib/libpulsarwithdeps.a -std=c++11 -I./include
Undefined symbols for architecture arm64:
"_bitset_resize", referenced from:
_roaring_bitmap_to_bitset in libpulsarwithdeps.a[1287](roaring.c.o)
_roaring_bitmap_to_bitset in libpulsarwithdeps.a[1287](roaring.c.o)
ld: symbol(s) not found for architecture arm64
Anything else?
This should be caused by the static library of roaring is not included in the *.a file.
This dependency was introduced since #497, so it's a regression
# g++ main.cc -std=c++11 /usr/lib/libpulsarwithdeps.a
/usr/bin/ld: /usr/lib/libpulsarwithdeps.a(roaring.c.o): in function `roaring_bitmap_to_bitset':
roaring.c:(.text+0xe79c): undefined reference to `bitset_resize'
collect2: error: ld returned 1 exit status
The root cause is we use ar -x to uncompress static libraries to object files (*.o). However, libroaring has duplicated bitset.c.o. For example, on my macOS laptop,
% ar t vcpkg/packages/roaring_arm64-osx/lib/libroaring.a
__.SYMDEF SORTED
isadetection.c.o
array_util.c.o
bitset_util.c.o
art.c.o
bitset.c.o
array.c.o
bitset.c.o
changed the title [-][Bug] libpulsarwithdeps.a misses some symbols[/-][+][Bug] libpulsarwithdeps.a misses some symbols on Linux or macOS[/+]on Oct 16, 2025
The workaround is not to use ar -x to extract *.a files to *.o files. For example, on macOS, the following trick works:
diff --git a/build-support/merge_archives.sh b/build-support/merge_archives.sh
index 065130d..d7e3c53 100755
--- a/build-support/merge_archives.sh+++ b/build-support/merge_archives.sh@@ -20,6 +20,7 @@
set -e
+ROOT="$pwd/.."
MERGED_LIBRARY=$1
shift
ITEMS=$*
@@ -44,7 +45,9 @@ for ITEM in $ITEMS; do
LIBS="$LIBS $LIB_NAME/*.o"
cd ..
done
+LIBS="$LIBS $ROOT/vcpkg/buildtrees/roaring/arm64-osx-dbg/src/CMakeFiles/roaring.dir/bitset.c.o"+set -x
ar -qc $MERGED_LIBRARY $LIBS
P.S. Change dbg to rel in release.
However, it's a bit complicated that we need to write a new script to scan object files (*.o) from dependencies directly under the vcpkg/buildtrees directory. In addition, the build on Windows is different that I don't have time to verify if the Windows library has the same issue.
A quick fix is to remove the libroaring dependency and use an alternative for Roaring64Map from libroaring for now. /cc @shibd
Activity
[-][Bug] libpulsarwithdeps.a on macOS misses some symbols[/-][+][Bug] libpulsarwithdeps.a misses some symbols[/+]BewareMyPower commentedon Oct 16, 2025
The debian package also misses the symbol.
The root cause is we use
ar -xto uncompress static libraries to object files (*.o). However, libroaring has duplicatedbitset.c.o. For example, on my macOS laptop,After
ar -x, only onebitset.c.ois retained, which means the other one is lost[-][Bug] libpulsarwithdeps.a misses some symbols[/-][+][Bug] libpulsarwithdeps.a misses some symbols on Linux or macOS[/+]BewareMyPower commentedon Oct 16, 2025
The workaround is not to use
ar -xto extract*.afiles to*.ofiles. For example, on macOS, the following trick works:P.S. Change
dbgtorelin release.However, it's a bit complicated that we need to write a new script to scan object files (
*.o)from dependencies directly under thevcpkg/buildtreesdirectory. In addition, the build on Windows is different that I don't have time to verify if the Windows library has the same issue.A quick fix is to remove the libroaring dependency and use an alternative for
Roaring64Mapfrom libroaring for now. /cc @shibd