Hi,

Not sure if this really Qt specific problem, but here goes...

I have a Qt gui-project which directory structure after successful build should look like follows (only relevant stuff to my problem, below)

Qt Code:
  1. LibBap/ // Links with muparser
  2. LibBap.pro
  3. <sources>
  4. Bap/ // Links with LibBap
  5. Bap.pro
  6. <sources>
  7. BapPlugin/ // Links with LibBap
  8. BapPlugin.pro
  9. <sources>
  10. Extra/
  11. muparser/
  12. muparser.pro
  13. <sources>
  14. bin/
  15. Bap
  16. lib/
  17. libLibBap.so
  18. libmuparser.so
  19. libBapPlugin.so
To copy to clipboard, switch view to plain text mode 

Build steps before error:

1) libmuparser.so
- built only if system doesn't have this already installed
- compiles/links fine
- moved to bin/lib

2) libLibBap.so
- links with libmuparser.so (either the one in bin/lib or system /usr/lib)
- compiles/links fine
- moved to to bin/lib/

3) Bap
- main executable
- links directly with libLibBap.so (and indirectly on libmuparser.so)
- compiles ok, but linker gives error:

g++ -o ../bin/Bap <objects> -L/usr/lib64/qt4 -L../bin/lib -lBapLib <bunch of -llibs> /usr/lib/gcc/x86_64-pc-linux-gnu/4.3.2/../../../../x86_64-pc-linux-gnu/bin/ld: warning: libmuparser.so.1, needed by ../bin/lib/libBapLib.so, not found (try using -rpath or -rpath-link)
../bin/lib/libBapLib.so: undefined reference to `mupGetErrorMsg(void*)'
../bin/lib/libBapLib.so: undefined reference to `mupCreate()'
../bin/lib/libBapLib.so: undefined reference to `mupRelease(void*)'
../bin/lib/libBapLib.so: undefined reference to `mupError(void*)'
../bin/lib/libBapLib.so: undefined reference to `mupEval(void*)'
../bin/lib/libBapLib.so: undefined reference to `mupSetExpr(void*, char const*)'
../bin/lib/libBapLib.so: undefined reference to `mupDefineVar(void*, char const*, double*)'
../bin/lib/libBapLib.so: undefined reference to `mupSetVarFactory(void*, double* (*)(char const*, void*), void*)'

So from above it seems to me that linker ignores search path (-L../bin/lib) as it resolves dependencies (libmuparser.so) of libraries linked with -l flag (libBapLib.so).

If I do 'LD_LIBRARY_PATH=../bin/lib make' in Bap/ OR install muparser in /bin/lib instead there is no error. But neither of these is suitable solution in long term.

I tried -rpath and -rpath-link in qmake LIBS variable as the linker suggests but no success. I also tried create_prl and link_prl for BapLib.pro and Bap.pro but no effect. But maybe there is some linker flag or qmake variable that sorts these kind of problems ? I hope there is some obvious thing I missed...

What can I do to let linker know of the second library ?

Thanks!