error while loading shared libraries

Added by Stefano Manni 4 months ago

Hi everyone I'm new with Wt and I have a problem with my first toy app (Hello world).

I'm using Fedora 16 (Verne) ad wt-3.2.0. Examples contained in the archive work fine.

But a writing a "new" HelloWorld program I get an error during execution.

Here is my CMakeLists.txt:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

SET(WT_PROJECT_SOURCE
hello.C
)

SET(WT_PROJECT_TARGET hello.wt)

ADD_EXECUTABLE(${WT_PROJECT_TARGET} ${WT_PROJECT_SOURCE})

LINK_DIRECTORIES(/usr/local/lib)

INCLUDE_DIRECTORIES(/usr/local/include/Wt /usr/local/lib)

TARGET_LINK_LIBRARIES(${WT_PROJECT_TARGET} wt wthttp boost_signals-mt)

Code correctly compiles, but launching it with:

sudo ./hello.wt --docroot . --http-address 0.0.0.0 -http-port 8080

I get this error :

./hello.wt: error while loading shared libraries: libwt.so.31: cannot open shared object file: No such file or directory

that changes in:

./hello.wt: error while loading shared libraries: libwthttp.so.31: cannot open shared object file: No such file or directory

if I move 'wt' after 'wthttp' in TARGET_LINK_LIBRARIES(..) CMakeLists.txt file row.

It is apparently a linker problem but ldd gets:

[smanni@fedora obj]$ ldd ./hello.wt 

    linux-gate.so.1 =>  (0x00da5000)
    libwthttp.so.31 => /usr/local/lib/libwthttp.so.31 (0x009db000)
    libwt.so.31 => /usr/local/lib/libwt.so.31 (0x00110000)
    libboost_signals-mt.so.1.47.0 => /usr/lib/libboost_signals-mt.so.1.47.0 (0x0069e000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x49820000)
    libm.so.6 => /lib/libm.so.6 (0x487ce000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x487fb000)
    libc.so.6 => /lib/libc.so.6 (0x485f0000)
    libz.so.1 => /lib/libz.so.1 (0x4883c000)
    libboost_thread-mt.so.1.47.0 => /usr/lib/libboost_thread-mt.so.1.47.0 (0x00f7d000)
    libboost_filesystem-mt.so.1.47.0 => /usr/lib/libboost_filesystem-mt.so.1.47.0 (0x006b4000)
    libboost_program_options-mt.so.1.47.0 => /usr/lib/libboost_program_options-mt.so.1.47.0 (0x00f04000)
    libboost_date_time-mt.so.1.47.0 => /usr/lib/libboost_date_time-mt.so.1.47.0 (0x006d2000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x4879e000)
    libboost_random-mt.so.1.47.0 => /usr/lib/libboost_random-mt.so.1.47.0 (0x006e1000)
    libboost_regex-mt.so.1.47.0 => /usr/lib/libboost_regex-mt.so.1.47.0 (0x006e5000)
    libboost_system-mt.so.1.47.0 => /usr/lib/libboost_system-mt.so.1.47.0 (0x007d8000)
    librt.so.1 => /lib/librt.so.1 (0x487c2000)
    /lib/ld-linux.so.2 (0x485cb000)
    libicuuc.so.46 => /usr/lib/libicuuc.so.46 (0x4bbb3000)
    libicui18n.so.46 => /usr/lib/libicui18n.so.46 (0x4b9e2000)
    libicudata.so.46 => /usr/lib/libicudata.so.46 (0x4ab6b000)
    libdl.so.2 => /lib/libdl.so.2 (0x487bb000)

and I cannot figure out which is the problem in the ldd response.

Any suggestions? Thanks in advance


Replies

RE: error while loading shared libraries - Added by Koen Deforche 4 months ago

IHey,

You shouldn't sudo. This runs as root which does not have /usr/local/lib in its ld library path.
There is no need either since 8080 is no a privileged port.

Try sudo ldd to see why it fails.

Koen

RE: error while loading shared libraries - Added by Stefano Manni 4 months ago

Thanks man!!!! It works now