Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#527 Static build link error

closed
General (27)
5
2014-02-18
2012-05-16
Alex Fabijanic
No

$POCO_BASE/.configure --static
make -s poco

...

Building executable (release) /home/parallels/trunk/Foundation/testsuite/bin/Linux/x86_64/static/testrunner
/home/parallels/trunk/lib/Linux/x86_64/libPocoFoundation.a(SharedLibrary.o): In function Poco::SharedLibraryImpl::loadImpl(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)': SharedLibrary.cpp:(.text+0x123): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /home/parallels/trunk/lib/Linux/x86_64/libPocoFoundation.a(Path.o): In functionPoco::PathImpl::homeImpl()':
Path.cpp:(.text+0x218): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
Creating dependency info for src/TestLibrary.cpp
Compiling src/TestPlugin.cpp (debug, shared)
Compiling src/TestLibrary.cpp (debug, shared)
Building dynamic library (debug, static) /home/parallels/trunk/Foundation/testsuite/bin/Linux/x86_64/static/TestLibraryd.so
/usr/bin/ld: /home/parallels/trunk/lib/Linux/x86_64/libPocoFoundationd.a(Exception.o): relocation R_X86_64_32S against `vtable for Poco::Exception' can not be used when making a shared object; recompile with -fPIC
/home/parallels/trunk/lib/Linux/x86_64/libPocoFoundationd.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]:
[/home/parallels/trunk/Foundation/testsuite/bin/Linux/x86_64/static/TestLibraryd.so] Error 1
make[1]:
[projects] Error 2
make: * [Foundation-tests] Error 2
parallels@ubuntu:~/trunk$ g++ --version
g++ (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1

Discussion

  • Alex Fabijanic
    Alex Fabijanic
    2012-07-21

    Compilation error can be avoided by omitting TestLibrary for static builds. This has been fixed in the trunk and 1.4.4 branches.
    Warnings will not prevent compilation but there appears to be no (simple) way to avoid them at this time; see

    http://fixunix.com/unix/84269-questions-about-static-linking.html

    for details.

     
  • Alex Fabijanic
    Alex Fabijanic
    2012-07-21

    I meant, of course, linking warnings and errors, not compilation.