NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

link shlib which depends on shlib



What is the correct way to link an executable to shared library which
depends on another shared library?

I'm trying to build espeakedit which links against wxwidgets which eg depends
on gtk.

I built the wxwidgets such that eg:

% objdump -x /usr/local/lib/libwx_gtk2u_xrc-2.9.so | more

/usr/local/lib/libwx_gtk2u_xrc-2.9.so:     file format elf32-i386
/usr/local/lib/libwx_gtk2u_xrc-2.9.so
architecture: i386, flags 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
start address 0x00068aa0
...
Dynamic Section:
  NEEDED      libgtk-x11-2.0.so.0
  NEEDED      libgdk-x11-2.0.so.0
...
  SONAME      libwx_gtk2u_xrc-2.9.so.0
  RPATH       /usr/X11R7/lib:/usr/pkg/lib:/usr/local/lib
...

and then tried to build the executable with

PROG_CXX=espeakedit
SRCS=   espeakedit.cpp spect.cpp spectdisplay.cpp extras.cpp compiledata.cpp
SRCS+=  options.cpp menus.cpp transldlg.cpp vowelchart.cpp spectseq.cpp
SRCS+=  formantdlg.cpp voicedlg.cpp prosodydisplay.cpp
MKMAN=no
CPPFLAGS=       -I/usr/local/lib/wx/include/gtk2-unicode-release-2.9
CPPFLAGS+=      -I/usr/local/include/wx-2.9
CPPFLAGS+=      -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -DWXUSINGDLL -D__WXGTK__
CPPFLAGS+=      -I/usr/local/include/espeak
CXXFLAGS=       -pthread
LDFLAGS=        -Wl,-R/usr/pkg/lib -L/usr/pkg/lib
LDFLAGS+=       -Wl,-R/usr/X11R7/lib -L/usr/X11R7/lib
LDFLAGS+=       -Wl,-R/usr/local/lib -L/usr/local/lib
LDADD=          -lwx_gtk2u_xrc-2.9 -lwx_gtk2u_html-2.9 -lwx_gtk2u_qa-2.9
LDADD+=         -lwx_gtk2u_adv-2.9 -lwx_gtk2u_core-2.9 -lwx_baseu_xml-2.9
LDADD+=         -lwx_baseu_net-2.9 -lwx_baseu-2.9 
LDADD+=         -lespeak
.include <bsd.prog.mk>

which gives e.g.

/usr/obj/.i386/tooldir.NetBSD-5.99.11-i386/bin/../lib/gcc/i486--netbsdelf/4.1.3/../../../../i486--netbsdelf/bin/ld:
 warning: libgtk-x11-2.0.so.0, needed by /usr/local/lib/libwx_gtk2u_xrc-2.9.so, 
not found (try using -rpath or -rpath-link)


adding
LDFLAGS+=        -Wl,-rpath-link,/usr/pkg/lib -Wl,-rpath-link,/usr/X11R7/lib 
-Wl,-rpath-link,/usr/local/lib

gets rid of the link stage warnings, but running the executable gives:

./espeakedit: Unsupported relocation type 14 in non-PLT relocations

yet ldd espeakedit shows gtk found as well as wx_*.

Is there eg a fpic/fPIC flag I'm missing? (A link to definitive documentation
would be appreciated!)

Cheers,

Patrick
(this is -current/i386)


Home | Main Index | Thread Index | Old Index