Closed Bug 248844 Opened 20 years ago Closed 20 years ago

make install fails with multiple declaration errors when linking libprofile.so

Categories

(Firefox Build System :: General, defect)

x86
Linux
defect
Not set
critical

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 248451

People

(Reporter: bugs, Assigned: bryner)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040601 Firefox/0.8
Build Identifier: CVS (2004-06-26)

The make routine runs without any problems.

In the make install routine, all is good until it gets to profile/build. When
trying to link libprofile.so with

c++ -I/usr/X11R6/include -frtti -fno-exceptions -Wall -Wconversion
-Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy
-Wno-non-virtual-dtor -Wno-long-long -march=athlon-xp -mfpmath=sse -fshort-wchar
-pthread -pipe  -DNDEBUG -DTRIMMED -ffunction-sections -march=athlon-xp -O3
-fPIC -shared -Wl,-h -Wl,libprofile.so -o libprofile.so  nsProfileFactory.o    
  -Wl,--whole-archive ../../dist/lib/libprofile_s.a
../../dist/lib/libprofdirserviceprovider_s.a  -Wl,--no-whole-archive
-L../../dist/bin -L../../dist/lib -L../../dist/bin -lxpcom  -L../../dist/lib
-lxpcom_compat -L../../dist/bin -lmozjs -L/usr/src/mozilla/dist/lib -lplds4
-lplc4 -lnspr4 -lpthread -ldl   -Wl,--version-script
-Wl,../../build/unix/gnu-ld-scripts/components-version-script -Wl,-Bsymbolic
-ldl -lm

it produces a whole load of "multiple definition of `nsProfileLock::xxx` errors,
and fails.

A quick look through the related libraries shows that the problem is that
libprofile.so is made by linking together libprofile_s.a (symlink to
../../toolkit/profile/src/libprofile_s.a) and libprofdirserviceprovider_s.a
(symlink to ../../profile/dirserviceprovider/src/libprofdirserviceprovider_s.a)
from dist/lib. These both include nsProfileLock.o built from
profile/dirserviceprovider/src/nsProfileLock.cpp, and so both contain those
functions.

There is another libprofile_s.a in profile/src which doesn't link against
nsProfileLock.o. Should this be the one libprofile.so links against?

Reproducible: Always
Steps to Reproduce:
1. Get firefox 0.9 or CVS
2. configure
3. make
4. make install
Actual Results:  
../../dist/lib/libprofile_s.a(nsProfileLock.o)(.text._ZN13nsProfileLockD1Ev+0x0):
first defined here
../../dist/lib/libprofdirserviceprovider_s.a(nsProfileLock.o)(.text._ZN13nsProfileLock18RemovePidLockFilesEv+0x0):
In function `nsProfileLock::RemovePidLockFiles()':
: multiple definition of `nsProfileLock::RemovePidLockFiles()'
../../dist/lib/libprofile_s.a(nsProfileLock.o)(.text._ZN13nsProfileLock18RemovePidLockFilesEv+0x0):
first defined here
../../dist/lib/libprofdirserviceprovider_s.a(nsProfileLock.o)(.text._ZN13nsProfileLock18FatalSignalHandlerEi+0x0):
In function `nsProfileLock::FatalSignalHandler(int)':
: multiple definition of `nsProfileLock::FatalSignalHandler(int)'
../../dist/lib/libprofile_s.a(nsProfileLock.o)(.text._ZN13nsProfileLock18FatalSignalHandlerEi+0x0):
first defined here
../../dist/lib/libprofdirserviceprovider_s.a(nsProfileLock.o)(.text._ZN13nsProfileLock13LockWithFcntlERK10nsACString+0x0):
In function `nsProfileLock::LockWithFcntl(nsACString const&)':
: multiple definition of `nsProfileLock::LockWithFcntl(nsACString const&)'
../../dist/lib/libprofile_s.a(nsProfileLock.o)(.text._ZN13nsProfileLock13LockWithFcntlERK10nsACString+0x0):
first defined here
../../dist/lib/libprofdirserviceprovider_s.a(nsProfileLock.o)(.text._ZN13nsProfileLock15LockWithSymlinkERK10nsACString+0x0):
In function `nsProfileLock::LockWithSymlink(nsACString const&)':
: multiple definition of `nsProfileLock::LockWithSymlink(nsACString const&)'
../../dist/lib/libprofile_s.a(nsProfileLock.o)(.text._ZN13nsProfileLock15LockWithSymlinkERK10nsACString+0x0):
first defined here
../../dist/lib/libprofdirserviceprovider_s.a(nsProfileLock.o)(.text._ZN13nsProfileLock4LockEP12nsILocalFile+0x0):
In function `nsProfileLock::Lock(nsILocalFile*)':
: multiple definition of `nsProfileLock::Lock(nsILocalFile*)'
../../dist/lib/libprofile_s.a(nsProfileLock.o)(.text._ZN13nsProfileLock4LockEP12nsILocalFile+0x0):
first defined here
collect2: ld returned 1 exit status
make[2]: *** [libprofile.so] Error 1
make[1]: *** [install] Error 2
make: *** [install] Error 2

Expected Results:  
Linked and installed properly

System setup:

LFS 6.0/BLFS system
Linux 2.6.5
Glibc 2.3.3
GCC 3.3.3

configure options:
--prefix=/opt/firefox-0.9 \
--with-x \
--enable-default-toolkit=gtk2 \
--with-system-jpeg \
--with-system-zlib \
--with-system-png \
--with-system-mng \
--disable-calendar \
--disable-mailnews \
--disable-accessibility \
--enable-xft \
--enable-crypto \
--enable-native-uconv \
--enable-extensions \
--enable-image-decoders=all \
--enable-optimize='-march=athlon-xp -O3' \
--enable-reorder \
--enable-strip \
--enable-elf-dynstr-gc \
--enable-svg \
--enable-svg-renderer-libart \
--with-default-mozilla-five-home \
--enable-cpp-rtti \
--disable-pedantic \
--disable-debug \
--disable-logging \
--disable-tests \
--enable-necko-protocols=all"

Tried a build with just the --prefix option (mainly to use the gtk toolkit
instead of gtk2), but it failed on some unrelated coding bug in
nsPasswordManager.cpp.

Have found one other mention of this, on some IRC logs. Was in Spanish (or
possibly French), though, so  I couldn't work out if they resolved it. It seemed
to be a 2.6 kernel and Glibc 2.3.3, though.
I tried altering the Makefile in profile/build to link against the profile_s.a
in profile/src (I altered $(DIST)/lib to ../src). It linked, but I couldn't
check that it worked properly because of the problem with nsPasswordManager.cpp.

*** This bug has been marked as a duplicate of 248451 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Component: Build Config → General
Product: Firefox → Firefox Build System
You need to log in before you can comment on or make changes to this bug.