Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`-static-libstdc++` breaks build

Closed Beginner friendly
#552 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp, perl
Domain
build-system

Research direction

Inspect lib/LcovUtil/Makefile.PL around the cxx_runtime_flags logic and the -static-libstdc++ check. Reproduce the NetBSD shared-object build, compare the linker command with and without that flag, and consider the issue complete when the LcovUtil.so build succeeds without the incompatible relocation error.

Written by the indexing model from the issue text.

Description

Updating lcov in pkgsrc from 2.5 to 2.6 I see new build breakage on NetBSD 11.99.9/x86_64:

c++  -shared  -Wl,-zrelro -Wl,-znow -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -static-libstdc++  LcovUtil.o  -o blib/arch/auto/LcovUtil/LcovUtil.so  \
    "-L/usr/pkg/lib/perl5/5.44.0/x86_64-netbsd-thread-multi/CORE" "-Wl,-R/usr/pkg/lib/perl5/5.44.0/x86_64-netbsd-thread-multi/CORE" "-Wl,-R/usr/pkg/lib/perl5/5.44.0/x86_64-netbsd-thread-multi/CORE" -lperl   \

ld: /usr/lib/libstdc++.a(eh_globals.o): relocation R_X86_64_TPOFF32 against `_ZZN12_GLOBAL__N_110get_globalEvE6global' can not be used when making a shared object; local-exec is incompatible with -shared
ld: failed to set dynamic section sizes: bad value
gmake[1]: *** [Makefile:490: blib/arch/auto/LcovUtil/LcovUtil.so] Error 1

I hacked around this with:

--- lib/LcovUtil/Makefile.PL.orig       2026-10-04 08:54:16.488088210 +0000
+++ lib/LcovUtil/Makefile.PL
@@ -191,7 +191,7 @@ my $cxx_runtime_flags = '';
     # Look for libc++ as well as libstdc++: clang spells the option the same
     # way but may be using libc++ instead, in which case that is the library to
     # ask about.
-    if ($find_lib->('libstdc++.a', 'libc++.a') &&
+    if (0 && $find_lib->('libstdc++.a', 'libc++.a') &&
         $can_link->('-static-libstdc++')) {
         $cxx_runtime_flags = ' -static-libstdc++';
     } else {

and the build succeeded:

c++  -shared  -Wl,-zrelro -Wl,-znow -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib -L/usr/pkg/lib  LcovUtil.o  -o blib/arch/auto/LcovUtil/LcovUtil.so  \
    "-L/usr/pkg/lib/perl5/5.44.0/x86_64-netbsd-thread-multi/CORE" "-Wl,-R/usr/pkg/lib/perl5/5.44.0/x86_64-netbsd-thread-multi/CORE" "-Wl,-R/usr/pkg/lib/perl5/5.44.0/x86_64-netbsd-thread-multi/CORE" -lperl   \

chmod 755 blib/arch/auto/LcovUtil/LcovUtil.so

Dominant language
Perl
Stars
1.1k
Forks
271
Avg merge
2d 4h
Merged PRs (30d)
9

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from linux-test-project/lcov

All issues in linux-test-project/lcov

Similar issues

More Perl issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.