building error when linking to one more library

Yuhao <[email protected]> Fri, 25 May 2012 06:37:30 -0700 (PDT)
Newsgroups gmane.comp.mozilla.devel.embedding
Organization http://groups.google.com
Message-ID <73b44931-e15d-47b0-998c-8a816d9edd07@b21g2000yqn.googlegroups.com>
Hi All,

I met some problem when linking to libpfm. The error message was:

/usr/bin/python2.7 /home/yuhao/Documents/mozilla-release/config/
pythonpath.py -I../../config /home/yuhao/Documents/mozilla-release/
config/expandlibs_exec.py --uselist -- c++ -o firefox -fno-rtti -
pedantic -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 -I/usr/local/
include -fno-exceptions -fno-strict-aliasing -std=gnu++0x -pthread -
ffunction-sections -fdata-sections -pipe -DNDEBUG -DTRIMMED -g -Os -
freorder-blocks -fomit-frame-pointer nsBrowserApp.o -lpthread -Wl,-
rpath-link,/home/yuhao/Documents/mozilla-release/firefox-release/dist/
bin -Wl,-rpath-link,/usr/local/lib -Wl,--whole-archive /home/yuhao/
Documents/mozilla-release/firefox-release/dist/lib/libmozglue.a -Wl,--
no-whole-archive -rdynamic -L../../dist/bin -L../../dist/lib -lpfm -L/
usr/local/lib /home/yuhao/Documents/mozilla-release/firefox-release/
dist/lib/libxpcomglue.a -ldl -lpfm

nsBrowserApp.o: In function `main':
/home/yuhao/Documents/mozilla-release/browser/app/nsBrowserApp.cpp:
218: undefined reference to `pfm_initialize'
/usr/bin/ld.bfd.real: firefox: hidden symbol `pfm_initialize' isn't
defined
/usr/bin/ld.bfd.real: final link failed: Bad value
collect2: ld returned 1 exit status

This doesn't make sense to me. I specified the library name (-lpfm),
as well as the path for the linker to find it (-L/usr/local/lib). I am
sure these paths are correct.

I also tried not to use the python script, but just normal building:

c++ -o firefox -fno-rtti -pedantic -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 -I/usr/local/include -fno-exceptions -fno-strict-
aliasing -std=gnu++0x -pthread -ffunction-sections -fdata-sections -
pipe -DNDEBUG -DTRIMMED -g -Os -freorder-blocks -fomit-frame-pointer
nsBrowserApp.o -lpthread -Wl,-rpath-link,/home/yuhao/Documents/mozilla-
release/firefox-release/dist/bin -Wl,-rpath-link,/usr/local/lib -Wl,--
whole-archive /home/yuhao/Documents/mozilla-release/firefox-release/
dist/lib/libmozglue.a -Wl,--no-whole-archive -rdynamic -L../../dist/
bin -L../../dist/lib -lpfm -L/usr/local/lib /home/yuhao/Documents/
mozilla-release/firefox-release/dist/lib/libxpcomglue.a -ldl -lpfm

And it just worked. So I assume the problem was with the python
script. I am not familiar with python, so could anyone help me with
this?

Thanks,
Yuhao