Problem building firefox with clang

Hello,

I have installed freebsd9.0 FreeBSD 9.0 the 3rd third time with clang, the first two without any problems. Now my harddisk died, so I have to reinstall it on an another one. The problem is, I get some strange error messages, when I'm trying to build Firefox or Chromium.

Code:
# pwd
/usr/ports/www/firefox

# make install clean

===>   firefox-20.0,1 depends on package: nspr>=4.9.4 - found
===>   firefox-20.0,1 depends on package: nss>=3.14.3 - not found
===>    Verifying install for nss>=3.14.3 in /usr/ports/security/nss
===>  Building for nss-3.14.3
gmake -C ../coreconf
gmake[1]: Entering directory `/usr/ports/security/nss/work/nss-

...

cd lib; gmake libs
gmake[1]: Entering directory `/usr/ports/security/nss/work/nss-3.14.3/mozilla/security/nss/lib'
cd util; gmake libs
gmake[2]: Entering directory `/usr/ports/security/nss/work/nss-3.14.3/mozilla/security/nss/lib/util'
rm -f FreeBSD9.0_OPT.OBJ/libnssutil3.so.1
clang -Wl,-Bsymbolic -shared -Wl,-soname -Wl,libnssutil3.so.1 -pthread -Wl,--version-script,FreeBSD9.0_OPT.OBJ/nssutil.def -o FreeBSD9.0_OPT.OBJ/libnssutil3.so.1 FreeBSD9.0_OPT.OBJ/quickder.o FreeBSD9.0_OPT.OBJ/secdig.o FreeBSD9.0_OPT.OBJ/derdec.o FreeBSD9.0_OPT.OBJ/derenc.o FreeBSD9.0_OPT.OBJ/dersubr.o FreeBSD9.0_OPT.OBJ/dertime.o FreeBSD9.0_OPT.OBJ/errstrs.o FreeBSD9.0_OPT.OBJ/nssb64d.o FreeBSD9.0_OPT.OBJ/nssb64e.o FreeBSD9.0_OPT.OBJ/nssrwlk.o FreeBSD9.0_OPT.OBJ/nssilock.o FreeBSD9.0_OPT.OBJ/oidstring.o FreeBSD9.0_OPT.OBJ/portreg.o FreeBSD9.0_OPT.OBJ/secalgid.o FreeBSD9.0_OPT.OBJ/secasn1d.o FreeBSD9.0_OPT.OBJ/secasn1e.o FreeBSD9.0_OPT.OBJ/secasn1u.o FreeBSD9.0_OPT.OBJ/secitem.o FreeBSD9.0_OPT.OBJ/secload.o FreeBSD9.0_OPT.OBJ/secoid.o FreeBSD9.0_OPT.OBJ/sectime.o FreeBSD9.0_OPT.OBJ/secport.o FreeBSD9.0_OPT.OBJ/templates.o FreeBSD9.0_OPT.OBJ/utf8.o FreeBSD9.0_OPT.OBJ/utilmod.o FreeBSD9.0_OPT.OBJ/utilpars.o    -L../../../../dist/FreeBSD9.0_OPT.OBJ/lib -L../../../../dist/FreeBSD9.0_OPT.OBJ/lib -lplc4 -lplds4 -lnspr4  -pthread
/usr/bin/ld: cannot find -lplc4
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [FreeBSD9.0_OPT.OBJ/libnssutil3.so.1] Error 1
gmake[2]: Leaving directory `/usr/ports/security/nss/work/nss-3.14.3/mozilla/security/nss/lib/util'
gmake[1]: *** [libs] Error 2
gmake[1]: Leaving directory `/usr/ports/security/nss/work/nss-3.14.3/mozilla/security/nss/lib'
gmake: *** [libs] Error 2
*** Error code 1

Stop in /usr/ports/security/nss.
*** Error code 1

Stop in /usr/ports/www/firefox.
*** Error code 1

Stop in /usr/ports/www/firefox.

I have checked if libplc4 exists:

Code:
# ls -l /usr/local/lib/libplc4.*

-rw-r--r--  1 root  wheel   31916 May 12 12:01 /usr/local/lib/libplc4.a
lrwxr-xr-x  1 root  wheel      12 May 12 12:01 /usr/local/lib/libplc4.so -> libplc4.so.1
-r-xr-xr-x  1 root  wheel  205424 May 12 12:01 /usr/local/lib/libplc4.so.1

I have also tried to reinstall devel/nspr, the error still happens. Someone any idea?

Greetz
demonking
 
Code:
<snip>
cd lib; gmake libs
gmake[1]: Entering directory `/usr/ports/security/nss/work/nss-3.14.3/mozilla/security/nss/lib'
cd util; gmake libs
gmake[2]: Entering directory `/usr/ports/security/nss/work/nss-3.14.3/mozilla/security/nss/lib/util'
rm -f FreeBSD9.0_OPT.OBJ/libnssutil3.so.1
clang -Wl,-Bsymbolic -shared -Wl,-soname -Wl,libnssutil3.so.1 -pthread -Wl,--version-script,FreeBSD9.0_OPT.OBJ/nssutil.def -o FreeBSD9.0_OPT.OBJ/libnssutil3.so.1 FreeBSD9.0_OPT.OBJ/quickder.o FreeBSD9.0_OPT.OBJ/secdig.o FreeBSD9.0_OPT.OBJ/derdec.o FreeBSD9.0_OPT.OBJ/derenc.o FreeBSD9.0_OPT.OBJ/dersubr.o FreeBSD9.0_OPT.OBJ/dertime.o FreeBSD9.0_OPT.OBJ/errstrs.o FreeBSD9.0_OPT.OBJ/nssb64d.o FreeBSD9.0_OPT.OBJ/nssb64e.o FreeBSD9.0_OPT.OBJ/nssrwlk.o FreeBSD9.0_OPT.OBJ/nssilock.o FreeBSD9.0_OPT.OBJ/oidstring.o FreeBSD9.0_OPT.OBJ/portreg.o FreeBSD9.0_OPT.OBJ/secalgid.o FreeBSD9.0_OPT.OBJ/secasn1d.o FreeBSD9.0_OPT.OBJ/secasn1e.o FreeBSD9.0_OPT.OBJ/secasn1u.o FreeBSD9.0_OPT.OBJ/secitem.o FreeBSD9.0_OPT.OBJ/secload.o FreeBSD9.0_OPT.OBJ/secoid.o FreeBSD9.0_OPT.OBJ/sectime.o FreeBSD9.0_OPT.OBJ/secport.o FreeBSD9.0_OPT.OBJ/templates.o FreeBSD9.0_OPT.OBJ/utf8.o FreeBSD9.0_OPT.OBJ/utilmod.o FreeBSD9.0_OPT.OBJ/utilpars.o    -L../../../../dist/FreeBSD9.0_OPT.OBJ/lib -L../../../../dist/FreeBSD9.0_OPT.OBJ/lib -lplc4 -lplds4 -lnspr4  -pthread
/usr/bin/ld: cannot find -lplc4
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [FreeBSD9.0_OPT.OBJ/libnssutil3.so.1] Error 1
gmake[2]: Leaving directory `/usr/ports/security/nss/work/nss-3.14.3/mozilla/security/nss/lib/util'
gmake[1]: *** [libs] Error 2
gmake[1]: Leaving directory `/usr/ports/security/nss/work/nss-3.14.3/mozilla/security/nss/lib'
gmake: *** [libs] Error 2
*** Error code 1
<snip>

Add this line in /usr/ports/security/nss/Makefile
Code:
LDFLAGS+=       -L${LOCALBASE}/lib
and remove this one instead:
Code:
MAKE_ENV=      LIBRARY_PATH="${LOCALBASE}/lib" \

Code:
--- Makefile.orig       2013-05-12 18:53:30.000000000 +0200
+++ Makefile    2013-05-12 18:59:47.000000000 +0200
@@ -22,11 +22,11 @@
 USE_LDCONFIG=  ${PREFIX}/lib/nss
 USE_GMAKE=     yes
 USE_PERL5_BUILD=yes
-MAKE_ENV=      LIBRARY_PATH="${LOCALBASE}/lib" \
-               SQLITE_INCLUDE_DIR="${LOCALBASE}/include" \
+MAKE_ENV=      SQLITE_INCLUDE_DIR="${LOCALBASE}/include" \
                NSS_ENABLE_ECC=1 NSS_USE_SYSTEM_SQLITE=1
 ALL_TARGET=    nss_build_all
 CFLAGS+=       -I${LOCALBASE}/include/nspr
+LDFLAGS+=       -L${LOCALBASE}/lib
 
 SUB_FILES=     nss-config nss.pc
 SUB_LIST=      MAJOR_VERSION=${PORTVERSION:R:R} \

Other possible solution is use LD_LIBRARY_PATH instead of LIBRARY_PATH variable, the fundamental difference between these variables are LD_LIBRARY_PATH is searched when the program starts, LIBRARY_PATH is searches at link time.

Note that you should use gcc(1)
Code:
[B]LIBRARY_PATH[/B]
	   The value of LIBRARY_PATH is a colon-separated list of directories,
	   much like PATH.  When configured as a native compiler, GCC tries
	   the directories thus specified when searching for special linker
	   files, if it can't find them using GCC_EXEC_PREFIX.	Linking using
	   GCC also uses these directories when searching for ordinary
	   libraries for the -l option (but directories specified with -L come
	   first).

Compile with clang(1) causes problems as you have, read the following question for an explanation.

Reference: http://www.freebsd.org/doc/en/books/porters-handbook/porting-prefix.html.
 
cpu82 said:
Code:
Other possible solution is use [FILE]LD_LIBRARY_PATH[/FILE] instead of [FILE]LIBRARY_PATH[/FILE] variable, the fundamental difference between these variables are [FILE]LD_LIBRARY_PATH[/FILE] is searched when the program starts, [FILE]LIBRARY_PATH[/FILE] is searches at link time.

Reference: [url=http://www.freebsd.org/doc/en/books/porters-handbook/porting-prefix.html]http://www.freebsd.org/doc/en/books/porters-handbook/porting-prefix.html[/url].[/quote]

Thanks for the reply, [b]I[/b] have tested your solution, but I still get the same error. If [b]I[/b]'m seeing it right, the [FILE]LD_Library_PATH[/FILE] is in the [FILE]Makefile[/FILE].(around line 66).

[quote="pkubaj"]
 9.0 is unsupported, thus packages may not compile. Upgrade to 9.1.
[/quote]

Why should it be unsupported? It's only an linker issue.

Greetz

demonking
 
No, I meant that change line 25 in Makefile
Code:
-MAKE_ENV=      LIBRARY_PATH="${LOCALBASE}/lib" \
+MAKE_ENV=      LD_LIBRARY_PATH="${LOCALBASE}/lib" \

demonking said:
Why should it be unsupported?
It's only an linker issue.

FreeBSD 9.0 reached EOL (End-Of-Life) on March 31, 2013. Update your system is your best bet ;)
 
cpu82 said:
No, I meant that change line 25 in Makefile
Code:
-MAKE_ENV=      LIBRARY_PATH="${LOCALBASE}/lib" \
+MAKE_ENV=      LD_LIBRARY_PATH="${LOCALBASE}/lib" \

Still the same.

cpu82 said:
FreeBSD 9.0 reached EOL (End-Of-Life) on March 31, 2013.

Oh, then I postponed for too long. I will update my system now ;)
 
Back
Top