Skip to content

Commit

Permalink
expat: Link against Protobuf and libstdc++ statically
Browse files Browse the repository at this point in the history
.. for a chance at passing the bad build checker.

Symptom was:
> error while loading shared libraries: libstdc++.so.6:
> cannot open shared object file: No such file or directory
  • Loading branch information
hartwork committed Feb 21, 2025
1 parent ed94309 commit ad785cf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions projects/expat/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
# rather than Clang's own libstdc++
CXXFLAGS="${CXXFLAGS/-stdlib=libc++/ }"

# NOTE: Without -static-libstdc++, the bad build checker in base-runner
# will fail with output:
# > error while loading shared libraries: libstdc++.so.6:
# > cannot open shared object file: No such file or directory
# The addition of -Wno-unused-command-line-argument silences Clang's
# misleading output on argument -static-libstdc++ appearing as unused.
CXXFLAGS="${CXXFLAGS} -static-libstdc++ -Wno-unused-command-line-argument"

: ${LD:="${CXX}"}
: ${LDFLAGS:="${CXXFLAGS}"} # to make sure we link with sanitizer runtime

Expand All @@ -33,6 +41,7 @@ cmake_args=(
-DEXPAT_BUILD_TOOLS=OFF
-DEXPAT_OSSFUZZ_BUILD=ON
-DEXPAT_SHARED_LIBS=OFF
-DProtobuf_USE_STATIC_LIBS=ON

# C compiler
-DCMAKE_C_COMPILER="${CC}"
Expand Down

0 comments on commit ad785cf

Please sign in to comment.