Opened 10 years ago

Closed 10 years ago

#3472 closed bug (fixed)

gcc4 and shared libraries

Reported by: kaliber Owned by: mmlr
Priority: normal Milestone: R1
Component: Build System Version: R1/pre-alpha1
Keywords: Cc: planche2k@…, umccullough@…, eric.petit@…
Blocked By: Blocking:
Has a Patch: no Platform: All


1) gcc4 doesn't support '-shared', patch included

2) g++4 does link against libstdc++ statically and a size of hello word program is over 1Mb (g++2 is 5kb only), in my opinion there should be available

Attachments (4)

gcc-haiku-shared.patch (644 bytes) - added by kaliber 10 years ago.
gcc -shared
shared_crosstools.patch (610 bytes) - added by aljen 10 years ago.
shared_libstdcpp.patch (8.9 KB) - added by aljen 10 years ago.
gcc hack
specs (3.9 KB) - added by andreasf 10 years ago.
specs file for the lazy

Download all attachments as: .zip

Change History (13)

Changed 10 years ago by kaliber

Attachment: gcc-haiku-shared.patch added

gcc -shared

comment:1 Changed 10 years ago by bonefish

Owner: changed from bonefish to mmlr

comment:2 Changed 10 years ago by aljen

I investigated shared version of libstdc++ yesterday (see patches, with kaliber patch already applied) and there is a chicken egg problem, when building gcc with --enable-shared=libstdc++ (according to gcc docs it's builded as shared, rest is static like with --disable-shared)
It fails to build because of missing crti.o crtn.o start_dyn.o init_term_dyn.o which are haiku specific. I moved them from src/system/glue to gcc dir and now it builds fine, but linker wants libroot which isn't available yet.
I think we have two choices if we want to have shared libstdc++:

  • cross-build gcc with static libstdc++, build libroot and rebuild libstdc++
  • move building haiku to haiku itself

Maybe i missed something, but that's so far i get into trying to make it work

Changed 10 years ago by aljen

Attachment: shared_crosstools.patch added


Changed 10 years ago by aljen

Attachment: shared_libstdcpp.patch added

gcc hack

comment:3 Changed 10 years ago by mmlr

I've adapted the specs in hrev29297. Note that just adding -shared to the linkspecs isn't enough, but also excluding start_dyn.o is required.

About the shared libstdc++. It will be provided as a binary when the package is updated. I don't think it's really worth the effort to build it as shared when building the cross-compiler. Therefore it's not really necessary to hack in the Haiku specific files into the gcc build system.

GCC as well as Haiku can be built just fine under Haiku, so it's not really a problem to just build the shared libstdc++ afterwards. The GCC4 package will provide it once it is updated.

comment:4 Changed 10 years ago by andreasf

Cc: planche2k@… added

comment:5 Changed 10 years ago by andreasf

Is it possible that the Optional Package has not been updated with this change?

If so, are there instructions how to configure gcc 4.3 on Haiku to overwrite the one from the Optional Package to try this out?

comment:6 Changed 10 years ago by umccullough

Cc: umccullough@… added

comment:7 Changed 10 years ago by mmlr

People, don't panic. The optional package hasn't been updated yet. The GCC build system, being quite complex, currently triggers a severe bug in Haiku that I'd like to find and fix. So my priority is to fix the problem and not to actually build a new GCC. It will be made available soon, probably during the next week. For now if you're really desperate you can still overwrite the specs by supplying a specs file and applying the changes from hrev29297 to that one:

gcc -dumpspecs > /boot/develop/gnupro/lib/gcc/i586-pc-haiku/4.3.3/specs
open /boot/develop/gnupro/lib/gcc/i586-pc-haiku/4.3.3/specs

Changed 10 years ago by andreasf

Attachment: specs added

specs file for the lazy

comment:8 Changed 10 years ago by titer

Cc: eric.petit@… added

comment:9 Changed 10 years ago by mmlr

Resolution: fixed
Status: newclosed

Updated the optional package in hrev29501.

Note: See TracTickets for help on using tickets.