PocoFoundation static build on linux error

Please post support and help requests here.
Cyril
Posts: 6
Joined: 28 Nov 2012, 21:48

PocoFoundation static build on linux error

Postby Cyril » 08 Feb 2013, 21:20

Hii, i just succesfully built Poco statically on linux.

I am trying to compile my first project but i receive the following errors:

libPocoFoundationd.a(Mutex.o): In function `MutexImpl':
data/poco-1.4.6-all/Foundation/src/Mutex_POSIX.cpp:71: undefined reference to `pthread_mutexattr_init'
data/poco-1.4.6-all/Foundation/src/Mutex_POSIX.cpp:75: undefined reference to `pthread_mutexattr_settype'
data/poco-1.4.6-all/Foundation/src/Mutex_POSIX.cpp:79: undefined reference to `pthread_mutexattr_destroy'
data/poco-1.4.6-all/Foundation/src/Mutex_POSIX.cpp:82: undefined reference to `pthread_mutexattr_destroy'
data/poco-1.4.6-all/Foundation/src/Mutex_POSIX.cpp:96: undefined reference to `pthread_mutexattr_init'
ddata/poco-1.4.6-all/Foundation/src/Mutex_POSIX.cpp:100: undefined reference to `pthread_mutexattr_settype'
data/poco-1.4.6-all/Foundation/src/Mutex_POSIX.cpp:104: undefined reference to `pthread_mutexattr_destroy'
data/poco-1.4.6-all/Foundation/src/Mutex_POSIX.cpp:107: undefined reference to `pthread_mutexattr_destroy'
data/poco-1.4.6-all/lib/Linux/i686/libPocoFoundationd.a(Mutex.o): In function `Poco::MutexImpl::tryLockImpl(long)':
data/poco-1.4.6-all/Foundation/src/Mutex_POSIX.cpp:130: undefined reference to `pthread_mutex_timedlock'
collect2: ld returned 1 exit status
make: *** [Poco] Error 1


The code is from the dir example.

I am able to compile the DateTime example just fine.

Cyril
Posts: 6
Joined: 28 Nov 2012, 21:48

Re: PocoFoundation static build on linux error

Postby Cyril » 08 Feb 2013, 23:35

Strangely i can compile fine if i use the shared libs.

Cyril
Posts: 6
Joined: 28 Nov 2012, 21:48

Re: PocoFoundation static build on linux error

Postby Cyril » 09 Feb 2013, 21:26

I just tried Poco 1.5.1.

Compiling with shared libraries is fine but static libraries throws a lot more errors than 1.4.6

This is how i build my project:
g++ -L/data/poco-1.5.1-all/lib/Linux/static -L/usr/lib/i386-linux-gnu -o "Poco" Poco.cpp -lPocoFoundationd -lPocoNetd -lPocoUtild -lPocoXMLd -lPocoJSONd -lpthread -I/data/poco-1.5.1-all/Foundation/include
-I/data/poco-1.5.1-all/Net/include -I/data/poco-1.5.1-all/Foundation/include -I/data/poco-1.5.1-all/JSON/include


When building with static libs do i have to include other libs or different include paths?

This is how i build Poco static:
sudo ./configure --static --no-tests --no-samples --omit=Data/ODBC
sudo make

alex
Posts: 1294
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: PocoFoundation static build on linux error

Postby alex » 09 Feb 2013, 23:18

Cyril wrote:When building with static libs do i have to include other libs or different include paths?

yes, you have to link all the libraries your application uses, directly or indirectly (i.e. if poco libraries need them). Look at any sample of testsuite Makefile to see what libraries poco needs for static build.

Cyril
Posts: 6
Joined: 28 Nov 2012, 21:48

Re: PocoFoundation static build on linux error

Postby Cyril » 10 Feb 2013, 00:25

Now i get other kind of errors:

Description Resource Path Location Type
undefined reference to `Poco::NumberFormatter::append(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int)' SocketClient line 127, external location: /data/poco-1.4.6-all/Net/src/IPAddress.cpp C/C++ Problem
undefined reference to `Poco::NumberFormatter::append(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int)' SocketClient line 129, external location: /data/poco-1.4.6-all/Net/src/IPAddress.cpp C/C++ Problem
undefined reference to `Poco::NumberFormatter::append(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int)' SocketClient line 131, external location: /data/poco-1.4.6-all/Net/src/IPAddress.cpp C/C++ Problem
undefined reference to `Poco::NumberFormatter::append(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, int)' SocketClient line 133, external location: /data/poco-1.4.6-all/Net/src/IPAddress.cpp C/C++ Problem
undefined reference to `Poco::Bugcheck::assertion(char const*, char const*, int)' SocketClient line 266, external


Return to “Support”

Who is online

Users browsing this forum: No registered users and 1 guest

cron