Opened 15 years ago

Closed 15 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:
Platform: All

Description

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 libstdc++.so.5 available

Attachments (4)

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

Download all attachments as: .zip

Change History (13)

by kaliber, 15 years ago

Attachment: gcc-haiku-shared.patch added

gcc -shared

comment:1 by bonefish, 15 years ago

Owner: changed from bonefish to mmlr

comment:2 by aljen, 15 years ago

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

by aljen, 15 years ago

Attachment: shared_crosstools.patch added

enable-shared=libstdc++

by aljen, 15 years ago

Attachment: shared_libstdcpp.patch added

gcc hack

comment:3 by mmlr, 15 years ago

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 by andreasf, 15 years ago

Cc: planche2k@… added

comment:5 by andreasf, 15 years ago

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 by umccullough, 15 years ago

Cc: umccullough@… added

comment:7 by mmlr, 15 years ago

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

by andreasf, 15 years ago

Attachment: specs added

specs file for the lazy

comment:8 by titer, 15 years ago

Cc: eric.petit@… added

comment:9 by mmlr, 15 years ago

Resolution: fixed
Status: newclosed

Updated the optional package in hrev29501.

Note: See TracTickets for help on using tickets.