# Firefox from ports: does not start, missing library



## Snurg (Aug 22, 2016)

I apologize, didn't find anything in the web about that:

```
usr/ports/www/firefox # setenv FORCE_PKG_REGISTER
usr/ports/www/firefox # make reinstall

<snip>

===>   Registering installation for firefox-47.0.1_2,1
Installing firefox-47.0.1_2,1...
```
which (to me) looks unconspicious so far, but then:


```
~ % firefox
XPCOMGlueLoad error for file /usr/local/lib/firefox-47.0.1/libxul.so:
Shared object "liblgpllibs.so" not found, required by "libxul.so"
Couldn't load XPCOM.
~  %
```
Any idea what I am doing wrong?
Is there maybe any package with "liblgpllibs.so" available that I just can install?


----------



## tobik@ (Aug 22, 2016)

Snurg said:


> Is there maybe any package with "liblgpllibs.so" available that I just can install?


Firefox installs that library. Try running `service ldconfig restart` as root and see if that helps.



Snurg said:


> /usr/local/lib/firefox-47.0.1/libxul.so


On my system libxul is in /usr/local/lib/firefox/libxul.so. Odd that this is different for you. What do you see in `pkg -l firefox`?


----------



## Snurg (Aug 22, 2016)

Thank you Tobik for your suggestions!
Running `service ldconfig restart` didn't change anything.
The output of `pkg -l firefox` gives me the commands I can use. Without the second option the output looks identically. I guess the -l option was a typo and you meant some other option?


----------



## tobik@ (Aug 22, 2016)

Snurg said:


> The output of "pkg -l firefox" gives me the commands I can use. Without the second option the output looks identically. I guess the -l option was a typo and you meant some other option?


Yeah, I meant `pkg info -l firefox`


----------



## SirDice (Aug 22, 2016)

Please don't set FORCE_PKG_REGISTER unless you know what you are doing!


----------



## talsamon (Aug 22, 2016)

What shows `less /usr/local/lib/firefox/dependentlibs.list` ?
And which version shows `pkg info libvpx`? (should be 1.5.0_1).


----------



## Snurg (Aug 22, 2016)

SirDice said:


> Please don't set FORCE_PKG_REGISTER unless you know what you are doing!


I thought this would let me just overwrite the existing installation from the previous build, instead of first deinstalling and (re)installing again.
To make sure it does not have any influence I turned this off for my further experimenting below.

Anyway, I tried a few times to build Firefox using the `make deinstall`, `make clean`, `make rmconfig`, `make extract`, `make config`, `make`, `make install` sequence.
I suspected that some option changes (for example using Gtk2 instead of using Gtk3) could have introduced the problem.

But the "improvement" only was that the error message when trying to start Firefox changed slightly to:

```
% firefox
XPCOMGlueLoad error for file /usr/local/lib/firefox-47.0.1/libxul.so:
/usr/local/lib/firefox-47.0.1/libxul.so: Undefined symbol "_ZN10soundtouch10SoundTouch12getVersionIdEv"
Couldn't load XPCOM.
%
```

This indicated that the soundtouch functions were missing in liblgpllibs.so.
No improvement even after I made sure that I built+installed the port with the default options.
Finally this made me ask where the libraries get placed when doing `make install`.

So I asked the PC:

```
# find / -print | grep -i liblgpllibs.so
/usr/local/lib/firefox/liblgpllibs.so
/usr/local/lib/firefox-47.0.1/liblgpllibs.so
/usr/local/lib/thunderbird/liblgpllibs.so
/usr/ports/www/firefox/work/stage/usr/local/lib/firefox-47.0.1/liblgpllibs.so
/usr/ports/www/firefox/work/firefox-47.0.1/obj-x86_64-portbld-freebsd11.0/dist/firefox/liblgpllibs.so
/usr/ports/www/firefox/work/firefox-47.0.1/obj-x86_64-portbld-freebsd11.0/dist/bin/liblgpllibs.so
/usr/ports/www/firefox/work/firefox-47.0.1/obj-x86_64-portbld-freebsd11.0/config/external/lgpllibs/liblgpllibs.so
# ll /usr/local/lib/firefox/liblgpllibs.so
-rwxr-xr-x  1 root  wheel  38394 Aug 18 08:48 /usr/local/lib/firefox/liblgpllibs.so*
# ll /usr/local/lib/firefox-47.0.1/liblgpllibs.so
-rwxr-xr-x  1 root  wheel  82880 Aug 22 14:38 /usr/local/lib/firefox-47.0.1/liblgpllibs.so*
# ll /usr/local/lib/thunderbird/liblgpllibs.so
-rwxr-xr-x  1 root  wheel  38332 Aug 18 05:10 /usr/local/lib/thunderbird/liblgpllibs.so*
# ll /usr/ports/www/firefox/work/stage/usr/local/lib/firefox-47.0.1/liblgpllibs.so
-rwxr-xr-x  1 root  wheel  82880 Aug 22 14:38 /usr/ports/www/firefox/work/stage/usr/local/lib/firefox-47.0.1/liblgpllibs.so*
# ll /usr/ports/www/firefox/work/firefox-47.0.1/obj-x86_64-portbld-freebsd11.0/dist/firefox/liblgpllibs.so
-rwxr-xr-x  1 root  wheel  82880 Aug 22 14:38 /usr/ports/www/firefox/work/firefox-47.0.1/obj-x86_64-portbld-freebsd11.0/dist/firefox/liblgpllibs.so*
# ll /usr/ports/www/firefox/work/firefox-47.0.1/obj-x86_64-portbld-freebsd11.0/dist/bin/liblgpllibs.so
lrwxr-xr-x  1 root  wheel  45 Aug 22 14:38 /usr/ports/www/firefox/work/firefox-47.0.1/obj-x86_64-portbld-freebsd11.0/dist/bin/liblgpllibs.so@ -> ../../config/external/lgpllibs/liblgpllibs.so
# ll /usr/ports/www/firefox/work/firefox-47.0.1/obj-x86_64-portbld-freebsd11.0/config/external/lgpllibs/liblgpllibs.so
-rwxr-xr-x  1 root  wheel  82880 Aug 22 14:38 /usr/ports/www/firefox/work/firefox-47.0.1/obj-x86_64-portbld-freebsd11.0/config/external/lgpllibs/liblgpllibs.so*
#
```

This made me wonder whether the problem could be caused by the fact that the newly-built library for some reason only gets installed in
/usr/local/lib/firefox-47.0.1, but *not* in /usr/local/lib/firefox.

To verify whether this caused the problem, I entered this:

```
# mv /usr/local/lib/firefox/liblgpllibs.so /usr/local/lib/firefox/liblgpllibs.so.oldcrap
# cp /usr/local/lib/firefox-47.0.1/liblgpllibs.so /usr/local/lib/firefox/liblgpllibs.so
#
```

Now Firefox starts without any complaints.
I still don' t know which mistake I made caused these problems.

At least now I know what I have to fix to make Firefox from ports work after `make` + `make install`.  

Thanks again to all for your help and input!


----------



## Snurg (Aug 23, 2016)

I didn't find out yet why the  www/firefox   port installs into  /usr/local/lib/firefox-47.0.1  and  even some files into /usr/local/lib/firefox-devel-47.0.1.
So I backed up the old /usr/local/lib/firefox directory and set a symbolic link from /usr/local/lib/firefox to /usr/local/lib/firefox-47.0.1 to make all things work smoothly.

It's default config. No changes in Makefiles.
I expected it to `make install` into /usr/local/lib/firefox, and to make uninstall from there.

What could I have done wrong?
Or, could there even be a bug in the port or the like?

(I modified only one of the Javascript files in Firefox which I guess it is completely unrelated to the actual build.)


----------



## ronaldlees (Aug 28, 2016)

```
# mv /usr/local/lib/firefox/liblgpllibs.so /usr/local/lib/firefox/liblgpllibs.so.oldcrap
# cp /usr/local/lib/firefox-47.0.1/liblgpllibs.so /usr/local/lib/firefox/liblgpllibs.so
#
```

Yeah - I had the same problem.   So much adieu over an audio pitch changing library.  Why do I want any pitches changed?  Anyway, maybe the library is handled differently than other Firefox libraries because it's where Mozilla puts the LGPL code it uses (IIRC).  They only started doing this recently, so maybe it somehow figures into all of this.  The only bits in it now are the pitch changing functions (dubious value for me), but I guess they think they may add more stuff later ...

Speaking of Firefox, when it is killed unexpectedly I sometimes lose my configuration settings.  I see this as a potential security angle (that's just my humble opinion).  For instance, I usually keep javascript "turned off," due to security worries.  If Firefox is killed unexpectedly, the config sometimes reverts back to the "installation config," and javascript is then turned back on.  I may or may not notice this fact when I restart FIrefox.  So, I'd recommend always checking your config after Firefox is killed, especially if you have made any changes that you think may affect security issues.  For the most part I see this happening when the power goes out and there is no proper shutdown.


----------



## Snurg (Aug 28, 2016)

Good to know that I am not the only one experiencing this behavior.
Guess I should file a bug report about the port installing libraries etc into the wrong directories.
Thus I would like to ask you which version of FreeBSD you use.

Regarding the lost settings, this might be caused by the ~/.mozilla/firefox/<your_GUID>/prefs.js file disappearing.
Firefox maintains backup session restore files in case should newer one get corrupted or get lost.
It apparently does no such with its configuration file!

I will have to check this as I am currently working on a script that repairs Firefox session data in sessionstore.js [1] or alternatively start a stored, preconfigured default session in case of no usable session file.
Thus thank you very much for pointing me to the disappearances of the configuration file, as my script should catch this also.


[1] In particular, screen coordinates are being stored as relative, not absolute coordinates, hindering windows being restored where they were at the end of the last session.


----------

