Opened 3 months ago

Closed 3 months ago

#15090 closed bug (invalid)

Some linker situations able to crash a simple C++ program

Reported by: jpcima Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: - General Version: R1/Development
Keywords: gcc c++ linker Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

On attempt to compile a simple C++ hello world with iostream, one can cause a mix of c++ libraries which crashes before reaching main. It's based on the situation of a build using hpkg libraries and pkg-config.

Example

This works: g++ -std=c++11 -o hello hello.cc && ./hello

But this crashes: g++ -std=c++11 -o hello hello.cc pkg-config sdl2 libuv uchardet --libs && ./hello

The trouble makers are -L flags expanded by pkg-config, which add a path containing a libstdc++.a static library.

The two tests show different readelf -d hello output. The working case indicated a dynamic link with libstdc++.so, the crashing case does not.

Details

Haiku shredder 1 hrev53167 May 26 2019 19:04:45 x86_64 x86_64 Haiku gcc version 8.3.0 (2019_05_24)

libsdl2_devel-2.0.9-1 libsdl2-2.0.9-1 libuv_debuginfo-1.29.1-1 libuv_devel-1.29.1-1 libuv-1.29.1-1 uchardet_devel-0.0.6-2 uchardet-0.0.6-2 libiconv_devel-1.15-4 libiconv-1.15-4

Additional notes https://git.io/fjRxD Report of program hit by linking bug https://git.io/fjRAH

Change History (2)

comment:1 Changed 3 months ago by waddlesplash

I don't think we should ship a static libstdc++ at all, probably (or at least not in a default search path.)

comment:2 Changed 3 months ago by waddlesplash

Resolution: invalid
Status: newclosed

This seems to just be a bug in our GCC or libstdc++ ports, so please open a ticket at https://github.com/haikuports/haikuports instead of here.

Note: See TracTickets for help on using tickets.