Need to use -fPIC when building shared libraries

RESOLVED FIXED in mozilla0.9.9

Status

SeaMonkey
Build Config
P2
normal
RESOLVED FIXED
16 years ago
13 years ago

People

(Reporter: Patrick Smith, Assigned: hacker formerly known as seawood@netscape.com)

Tracking

Trunk
mozilla0.9.9
PowerPC
Linux

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

16 years ago
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:0.9.8) Gecko/20020226
BuildID:    20020227

When building a shared library with gcc or g++, the -fPIC option should be
included on the command that actually builds the library.  It's not enough to
use it when making the .o files, as gcc also compiles some code when building
the library (or so says the gcc FAQ, anyway).

When using gcc/g++ to build Mozilla, I get an error (see below).  This is
running Linux on a PowerMac Cube, with gcc 2.95.* (either 2.95.3 or the latest
from the 2.95 branch in the gcc CVS repository).  To get around this, I've
created little scripts that invoke gcc or g++ with -fPIC, and told the Mozilla
build to use those scripts as the compilers.

Reproducible: Always
Steps to Reproduce:
1. Untar the 0.9.8 mozilla source.
2. Put in .mozconfig:

ac_add_options --enable-optimize=-O2
ac_add_options --disable-debug
ac_add_options --enable-crypto

3. make -f client.mk
4. cd xpinstaller/packager; make
5. cd somewhere and untar the mozilla .tar.gz file created in step 4
6. cd mozilla
7. set MOZILLA_FIVE_HOME and LD_LIBRARY_PATH to `pwd`
8. `pwd`/regxpcom

Actual Results:  The output of regxpcom was:

*** Deferring registration of sample JS components
*** Registering -venkman handler.
*** Registering smime account manager extension.
*** Registering sample JS components
*** Unloading sample JS components
**************************************************
nsNativeComponentLoader:
SelfRegisterDll(/wup/builds/mozilla-0.9.8-2/mozilla/components/libtransformiix.so)
Load FAILED with error:
/wup/builds/mozilla-0.9.8-2/mozilla/components/libtransformiix.so: R_PPC_REL24
relocation at 0x0d91e664 for symbol `' out of range
**************************************************


Expected Results:  The error message should not have appeared.
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Keywords: mozilla0.9.9
Priority: -- → P2
Target Milestone: --- → mozilla0.9.9
Created attachment 71986 [details] [diff] [review]
Add DSO_PIC_CFLAGS to MKSHLIB/MKCSHLIB

This patch add`s DSO_PIC_CFLAGS to MKSHLIB & MKCSHLIB. I removed the setting of
MKSHLIB in places where it duplicated the default setting.
Comment on attachment 71986 [details] [diff] [review]
Add DSO_PIC_CFLAGS to MKSHLIB/MKCSHLIB

r=bryner
Attachment #71986 - Flags: review+

Comment 3

16 years ago
Comment on attachment 71986 [details] [diff] [review]
Add DSO_PIC_CFLAGS to MKSHLIB/MKCSHLIB

a=asa (on behalf of drivers) for checkin to the 0.9.9 branch and the 1.0 trunk
Attachment #71986 - Flags: approval+
The patch has been checked into the 0.9.9 branch and the trunk.
Status: ASSIGNED → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → FIXED
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.