Looking for saved searches? click on "Search Bugs" above.

cannot find -lmozalloc when building with gcc-4.4

RESOLVED FIXED in mozilla1.9.3a5

Status

()

Core
Build Config
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: Micah Gersten, Assigned: Micah Gersten)

Tracking

Trunk
mozilla1.9.3a5
All
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 4 obsolete attachments)

(Assignee)

Description

8 years ago
Here's a link to the full build log with the snippet that fails below:
http://launchpadlibrarian.net/40466981/buildlog_ubuntu-karmic-i386.xulrunner-1.9.3_1.9.3~a3~hg20100308r39057%2Bnobinonly-0ubuntu1~umd1~karmic_FAILEDTOBUILD.txt.gz

c++  -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -Wno-long-long -pedantic -g -fno-strict-aliasing -fshort-wchar -pthread -pipe  -DNDEBUG -DTRIMMED -Os -freorder-blocks -fno-reorder-functions  -fPIC -shared -Wl,-z,defs -Wl,-h,libjsctypes-test.so -o libjsctypes-test.so  jsctypes-test.o     -lpthread -Wl,-Bsymbolic-functions  -Wl,-rpath-link,/build/buildd/xulrunner-1.9.3-1.9.3~a3~hg20100308r39057+nobinonly/build-tree/obj/dist/bin -Wl,-rpath-link,/usr/lib  /build/buildd/xulrunner-1.9.3-1.9.3~a3~hg20100308r39057+nobinonly/build-tree/obj/dist/lib/libxpcomglue.a -lmozalloc -L/usr/lib -lplds4 -lplc4 -lnspr4 -lpthread -ldl  -ldl -lm    
/usr/bin/ld.real: cannot find -lmozalloc
collect2: ld returned 1 exit status
make[5]: *** [libjsctypes-test.so] Error 1

I believe that the library is installed in dist/bin here:
c++  -fno-rtti -fno-exceptions -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -Wno-long-long -pedantic -g -fno-strict-aliasing -fshort-wchar -pthread -pipe  -DNDEBUG -DTRIMMED -Os -freorder-blocks -fno-reorder-functions  -fPIC -shared -Wl,-z,defs -Wl,-h,libmozalloc.so -o libmozalloc.so  mozalloc.o mozalloc_oom.o     -lpthread -Wl,-Bsymbolic-functions  -Wl,-rpath-link,/build/buildd/xulrunner-1.9.3-1.9.3~a3~hg20100308r39057+nobinonly/build-tree/obj/dist/bin -Wl,-rpath-link,/usr/lib   -ldl -lm    
chmod +x libmozalloc.so
/build/buildd/xulrunner-1.9.3-1.9.3~a3~hg20100308r39057+nobinonly/build-tree/obj/config/nsinstall -R -m 755 libmozalloc.so ../../dist/lib
/build/buildd/xulrunner-1.9.3-1.9.3~a3~hg20100308r39057+nobinonly/build-tree/obj/config/nsinstall -R -m 755 libmozalloc.so ../../dist/bin

So I'm not sure why this isn't working, but it seems to build fine with gcc before 4.4.

I added bug 441324 as blocking as I believe the third commit for it was responsible:
http://hg.mozilla.org/mozilla-central/rev/81bd90ae5899

Comment 1

8 years ago
The link line in question has -rpath-link for dist/bin, but it doesn't have -Ldist/bin... it really needs to have -L. -rpath-link should only tell the linker where to look for dependent sharedlibs, not for objects specified explicitly on the command line.
Assignee: nobody → jones.chris.g
(Assignee)

Comment 2

8 years ago
Created attachment 434479 [details] [diff] [review]
Add $(DIST)/bin to EXTRA_DSO_LDOPTS in js/ctypes/tests/Makefile.in v1

It built fine for me with this change.
Assignee: jones.chris.g → mozilla-bugs
Attachment #434479 - Flags: review?(benjamin)

Comment 3

8 years ago
Comment on attachment 434479 [details] [diff] [review]
Add $(DIST)/bin to EXTRA_DSO_LDOPTS in js/ctypes/tests/Makefile.in v1

I think you should put this in MOZALLOC_LIBS, not in this particular makefile.
Attachment #434479 - Flags: review?(benjamin) → review-
(Assignee)

Comment 4

8 years ago
Created attachment 434763 [details] [diff] [review]
Add $(DIST)/bin to MOZALLOC_LIB v1

Moved -L$(DIST)/bin to MOZALLOC_LIB in config/config.mk
Attachment #434479 - Attachment is obsolete: true
Attachment #434763 - Flags: review?(benjamin)
(Assignee)

Comment 5

8 years ago
Tested with gcc-4.4 and gcc-4.2

Updated

8 years ago
Attachment #434763 - Flags: review?(benjamin) → review+

Comment 6

8 years ago
Comment on attachment 434763 [details] [diff] [review]
Add $(DIST)/bin to MOZALLOC_LIB v1

You should switch the order so the -Lfoo comes first, but r=me with that change
(Assignee)

Comment 7

8 years ago
Comment on attachment 434763 [details] [diff] [review]
Add $(DIST)/bin to MOZALLOC_LIB v1

>---
> config/config.mk |    2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>Index: mozilla/config/config.mk
>===================================================================
>--- mozilla.orig/config/config.mk
>+++ mozilla/config/config.mk
>@@ -170,17 +170,17 @@
>   _DEBUG_CFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
>   XULPPFLAGS += $(MOZ_DEBUG_DISABLE_DEFS)
>   ifdef MOZ_DEBUG_SYMBOLS
>     _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS)
>     _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS)
>   endif
> endif
> 
>-MOZALLOC_LIB = $(call EXPAND_MOZLIBNAME,mozalloc)
>+MOZALLOC_LIB = -L$(DIST)/bin $(call EXPAND_MOZLIBNAME,mozalloc)
> 
> OS_CFLAGS += $(_DEBUG_CFLAGS)
> OS_CXXFLAGS += $(_DEBUG_CFLAGS)
> OS_LDFLAGS += $(_DEBUG_LDFLAGS)
> 
> # XXX: What does this? Bug 482434 filed for better explanation.
> ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
> ifdef MOZ_DEBUG
(Assignee)

Comment 8

8 years ago
Created attachment 437755 [details] [diff] [review]
Add $(DIST)/bin to MOZALLOC_LIB v2
Attachment #434763 - Attachment is obsolete: true
(Assignee)

Comment 9

8 years ago
Created attachment 437756 [details] [diff] [review]
Add $(DIST)/bin to MOZALLOC_LIB v3

Hopefully third time's the charm here...
Attachment #437755 - Attachment is obsolete: true
(Assignee)

Updated

8 years ago
Whiteboard: checkin-needed
(Assignee)

Comment 10

8 years ago
Sorry for all the noise...this is my first patch here
Keywords: checkin-needed
Whiteboard: checkin-needed
http://hg.mozilla.org/mozilla-central/rev/476253dabf10
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a5
pushed a followup to sync js/src/config/config.mk
they should always stay in sync
http://hg.mozilla.org/mozilla-central/rev/020a0670ef30
Depends on: 561510

Comment 13

8 years ago
Comment on attachment 437756 [details] [diff] [review]
Add $(DIST)/bin to MOZALLOC_LIB v3

The -L$(DIST)/bin added by this patch causes a linker warning
on Windows:

link -NOLOGO -DLL -OUT:xpcom.dll -PDB:xpcom.pdb -SUBSYSTEM:WINDOWS  nsXPComStub.
obj    ./module.res -NXCOMPAT -DYNAMICBASE -SAFESEH     ../../dist/lib/xul.lib d
:/mozilla-central/ff-opt/dist/lib/nspr4.lib d:/mozilla-central/ff-opt/dist/lib/p
lc4.lib d:/mozilla-central/ff-opt/dist/lib/plds4.lib  -L../../dist/bin ../../dis
t/lib/mozalloc.lib  kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib adva
pi32.lib
LINK : warning LNK4044: unrecognized option '/L../../dist/bin'; ignored
   Creating library xpcom.lib and object xpcom.exp

On Windows, $(call EXPAND_MOZLIBNAME,mozalloc) expands to
../../dist/lib/mozalloc.lib, so even the ../../dist/bin part seems
wrong.

Comment 14

8 years ago
Created attachment 462696 [details] [diff] [review]
Use EXPAND_LIBNAME_PATH instead of EXPAND_MOZLIBNAME

I found that the EXPAND_LIBNAME_PATH function is
designed to solve exactly this problem.

I'm not sure if we should use $(DIST)/lib or
$(LIBXUL_DIST)/lib.  I use $(DIST)/lib in this
patch because it's seems to be where $(IMPORT_LIBRARY)
or $(SHARED_LIBRARY) is installed:
http://mxr.mozilla.org/mozilla-central/source/config/rules.mk#916
Attachment #462696 - Flags: review?(benjamin)

Comment 15

8 years ago
Comment on attachment 462696 [details] [diff] [review]
Use EXPAND_LIBNAME_PATH instead of EXPAND_MOZLIBNAME

I found that bug 561510 is the problem I reported
in comment 13.  So I moved this patch to that bug.
Attachment #462696 - Attachment is obsolete: true
Attachment #462696 - Flags: review?(benjamin)
You need to log in before you can comment on or make changes to this bug.