Last Comment Bug 675396 - Fennec Desktop: error while loading shared libraries: libmozsqlite3.so
: Fennec Desktop: error while loading shared libraries: libmozsqlite3.so
Status: RESOLVED FIXED
[inbound]
:
Product: Core
Classification: Components
Component: Build Config (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla8
Assigned To: Mounir Lamouri (:mounir)
:
: Gregory Szorc [:gps]
Mentors:
Depends on: 677146 677247
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-29 18:34 PDT by Mounir Lamouri (:mounir)
Modified: 2011-08-10 22:58 PDT (History)
4 users (show)
mounir: in‑testsuite-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
LD_DEBUG output (5.96 KB, text/plain)
2011-08-01 16:02 PDT, Mounir Lamouri (:mounir)
no flags Details
Attempt (8.69 KB, patch)
2011-08-02 00:22 PDT, Mounir Lamouri (:mounir)
no flags Details | Diff | Splinter Review
WIP Patch (9.04 KB, patch)
2011-08-02 00:55 PDT, Mounir Lamouri (:mounir)
no flags Details | Diff | Splinter Review
Patch v1 (9.04 KB, patch)
2011-08-02 01:06 PDT, Mounir Lamouri (:mounir)
no flags Details | Diff | Splinter Review
Patch v1 (9.68 KB, patch)
2011-08-02 01:11 PDT, Mounir Lamouri (:mounir)
no flags Details | Diff | Splinter Review
Patch v1.1 (9.66 KB, patch)
2011-08-02 01:12 PDT, Mounir Lamouri (:mounir)
mh+mozilla: review+
Details | Diff | Splinter Review

Description Mounir Lamouri (:mounir) 2011-07-29 18:34:13 PDT
When trying to run fennec on desktop, I got this error:
./fennec: error while loading shared libraries: libmozsqlite3.so: cannot open shared object file: No such file or directory

ldd, as expected shows:
libmozsqlite3.so => not found

But the file is in '.'.

A workaround is to use LD_LIBRARY_PATH=".", though I would expect this to work as well as Firefox Desktop.

My mozconfig is:
ac_add_options --enable-application=mobile
mk_add_options MOZ_MAKE_FLAGS="-s -j5"
ac_add_options --enable-tests
export MOZ_DEBUG_SYMBOLS=1
ac_add_options --enable-debug
ac_add_options --disable-optimize
Comment 1 Mike Hommey [:glandium] 2011-07-29 23:37:40 PDT
works for me.

What do the following commands say?
  readelf -d objdir/dist/bin/fennec
  make -C objdir/mobile/app echo-variable-GNU_LD
Comment 2 Mounir Lamouri (:mounir) 2011-07-30 12:26:49 PDT
(In reply to comment #1)
> What do the following commands say?
>   readelf -d objdir/dist/bin/fennec

readelf returns:
Dynamic section at offset 0x1dd28 contains 35 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libxpcom.so]
 0x0000000000000001 (NEEDED)             Shared library: [libmozalloc.so]
 0x0000000000000001 (NEEDED)             Shared library: [libplds4.so]
 0x0000000000000001 (NEEDED)             Shared library: [libplc4.so]
 0x0000000000000001 (NEEDED)             Shared library: [libnspr4.so]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libxul.so]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN]
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN]
 0x000000000000000c (INIT)               0x401500
 0x000000000000000d (FINI)               0x419308
 0x0000000000000004 (HASH)               0x4002e8
 0x000000006ffffef5 (GNU_HASH)           0x400490
 0x0000000000000005 (STRTAB)             0x400b20
 0x0000000000000006 (SYMTAB)             0x4004f0
 0x000000000000000a (STRSZ)              1060 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x61dfe8
 0x0000000000000002 (PLTRELSZ)           1176 (bytes)
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000017 (JMPREL)             0x401068
 0x0000000000000007 (RELA)               0x401038
 0x0000000000000008 (RELASZ)             48 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffffe (VERNEED)            0x400fc8
 0x000000006fffffff (VERNEEDNUM)         3
 0x000000006ffffff0 (VERSYM)             0x400f44
 0x0000000000000000 (NULL)               0x0

>   make -C objdir/mobile/app echo-variable-GNU_LD

1
Comment 3 Mike Hommey [:glandium] 2011-07-30 14:27:48 PDT
Can you try running fennec with LD_DEBUG set to libs and paste the output?
Comment 4 Mounir Lamouri (:mounir) 2011-08-01 16:02:29 PDT
Created attachment 549955 [details]
LD_DEBUG output

Here is the output of LD_DEBUG=lib ./fennec. It seems that mozsqlite3 has a very specific treatment and is never searched inside the current directory. I hope you will understand why, Mike! :)
Comment 5 Mike Hommey [:glandium] 2011-08-01 23:02:25 PDT
Comment on attachment 549955 [details]
LD_DEBUG output

Looks like the problem is that the rpath on fennec is not enough, and there needs to be an rpath on libxul.so as well.

I'd however suggest updating nsBrowserApp.cpp from what is currently in browser/app instead (be aware it requires some changes in Makefile.in)
Comment 6 Mounir Lamouri (:mounir) 2011-08-02 00:22:24 PDT
Created attachment 550017 [details] [diff] [review]
Attempt
Comment 7 Mounir Lamouri (:mounir) 2011-08-02 00:55:09 PDT
Created attachment 550021 [details] [diff] [review]
WIP Patch
Comment 8 Mounir Lamouri (:mounir) 2011-08-02 01:06:51 PDT
Created attachment 550025 [details] [diff] [review]
Patch v1
Comment 9 Mounir Lamouri (:mounir) 2011-08-02 01:11:21 PDT
Created attachment 550026 [details] [diff] [review]
Patch v1
Comment 10 Mounir Lamouri (:mounir) 2011-08-02 01:12:32 PDT
Created attachment 550028 [details] [diff] [review]
Patch v1.1

Styling changes.
Comment 11 Mike Hommey [:glandium] 2011-08-02 01:19:58 PDT
Comment on attachment 550028 [details] [diff] [review]
Patch v1.1

Review of attachment 550028 [details] [diff] [review]:
-----------------------------------------------------------------

::: mobile/app/Makefile.in
@@ +77,5 @@
>  endif
>  endif #LIBXUL_SDK
>  
> +# This switches $(INSTALL) to copy mode, like $(SYSINSTALL), so things that
> +# shouldn't get 755 perms need $(IFLAGS1) for either way of calling nsinstall.

The reason here is different: it is so that the standalone glue doesn't try to get libxpcom.so from mobile/app. The reason in browser/app is the same now, but the comment is older than that.

r=me with this comment changed.

(for those scared by the nsBrowserApp.cpp changes, it's just a copy of the current browser/app/nsBrowserApp.cpp, and is only used for desktop fennec)
Comment 12 Mark Finkle (:mfinkle) (use needinfo?) 2011-08-02 06:07:45 PDT
(In reply to comment #11)

> (for those scared by the nsBrowserApp.cpp changes, it's just a copy of the
> current browser/app/nsBrowserApp.cpp, and is only used for desktop fennec)

And Maemo
Comment 13 Mike Hommey [:glandium] 2011-08-02 06:42:59 PDT
(In reply to comment #12)
> And Maemo


Ah true. We may want to disable XPCOMGlueEnablePreload on Maemo.
Comment 14 Mounir Lamouri (:mounir) 2011-08-02 21:25:23 PDT
(In reply to comment #13)
> (In reply to comment #12)
> > And Maemo
> 
> 
> Ah true. We may want to disable XPCOMGlueEnablePreload on Maemo.

Mark, do you confirm that?
Comment 15 Mike Hommey [:glandium] 2011-08-02 23:21:59 PDT
As said on IRC:
A simple #ifdef on whatever distinguishes maemo to avoid enabling preloading might be good ; though maybe preloading would have a positive impact on maemo
Comment 16 Mark Finkle (:mfinkle) (use needinfo?) 2011-08-03 06:30:45 PDT
We could just land the patch without Maemo #ifdef, and watch the tests. If a problem occurs, you could land a followup with some #ifdef MOZ_PLATFORM_MAEMO in the right places.
Comment 17 Mounir Lamouri (:mounir) 2011-08-03 11:27:32 PDT
(In reply to comment #16)
> We could just land the patch without Maemo #ifdef, and watch the tests. If a
> problem occurs, you could land a followup with some #ifdef
> MOZ_PLATFORM_MAEMO in the right places.

Pushed then :)
Comment 18 Mike Hommey [:glandium] 2011-08-03 11:30:56 PDT
(In reply to comment #17)
> Pushed then :)

You didn't change the comment for NSDISTMODE...
Comment 19 Mounir Lamouri (:mounir) 2011-08-03 11:34:47 PDT
OUPS! I just pushed a follow-up to fix that.
Sorry :(
Comment 21 Mark Finkle (:mfinkle) (use needinfo?) 2011-08-04 21:27:22 PDT
Not sure if it is expected or not, but I do see ~100ms Ts regression on Maemo when this patch, and a few others from m-i, landed on m-c.

The regression isn't horrible, but maybe we should try to disable preloading, as Mike suggested. What does preloading do exactly?
Comment 22 Mike Hommey [:glandium] 2011-08-04 23:00:22 PDT
(In reply to Mark Finkle (:mfinkle) from comment #21)
> Not sure if it is expected or not, but I do see ~100ms Ts regression on
> Maemo when this patch, and a few others from m-i, landed on m-c.
> 
> The regression isn't horrible, but maybe we should try to disable
> preloading, as Mike suggested. What does preloading do exactly?

It reads all the libraries listed in dependentlibs.list before dlopen()ing them.
On hard drives, that makes a huge difference, but on flash, it ranges from limited improvement to slower.
Comment 23 Mounir Lamouri (:mounir) 2011-08-05 08:42:41 PDT
Mark, if you open a follow-up and assign the bug to me, I can write the patch ;)
Comment 24 Mark Finkle (:mfinkle) (use needinfo?) 2011-08-07 20:56:46 PDT
(In reply to Mounir Lamouri (:volkmar) from comment #23)
> Mark, if you open a follow-up and assign the bug to me, I can write the
> patch ;)

Filed bug 677146

Note You need to log in before you can comment on or make changes to this bug.