Archived
This forum has been archived. Please start a new discussion on GitHub.
Ice on FreeBSD
Does anybody run Ice apps written in c++ on FreeBSD? I have built Ice-3.3.1 from the ports tree, but all programs using libIce fails with the following message:
terminate called after throwing an instance of 'IceUtil::ThreadSyscallException'
what(): RecMutex.cpp:96: IceUtil::ThreadSyscallException:
syscall exception: Unknown error: -1
zsh: abort (core dumped)
The error comes from this line (RecMutex.cpp:96):
rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutexattr_settype() fails with the only possible error code according to the man page - "Invalid value for attr, or invalid value for type". The same pthreads function call works fine in a standalone application.
Here is the stack trace from the core file:
#0 0x28631087 in kill () from /lib/libc.so.7
#1 0x28630fe6 in raise () from /lib/libc.so.7
#2 0x2862fbfa in abort () from /lib/libc.so.7
#3 0x284b7b80 in __gnu_cxx::__verbose_terminate_handler ()
from /usr/lib/libstdc++.so.6
#4 0x284bc02a in std::set_unexpected () from /usr/lib/libstdc++.so.6
#5 0x284bc072 in std::terminate () from /usr/lib/libstdc++.so.6
#6 0x284bbf6a in __cxa_throw () from /usr/lib/libstdc++.so.6
#7 0x2834b17d in IceUtil::RecMutex::RecMutex ()
from /usr/local/lib/libIceUtil.so.33
#8 0x28179a34 in __static_initialization_and_destruction_0 ()
from /usr/local/lib/libIce.so.33
#9 0x282b2fe5 in __do_global_ctors_aux () from /usr/local/lib/libIce.so.33
#10 0x281144d9 in _init () from /usr/local/lib/libIce.so.33
#11 0x2805c96b in dl_iterate_phdr () from /libexec/ld-elf.so.1
#12 0x28060673 in dlopen () from /libexec/ld-elf.so.1
#13 0x2805b3fe in ?? () from /libexec/ld-elf.so.1
All I have to do to get this error is to link the application with -lIce, no actual function calls are made yet.
terminate called after throwing an instance of 'IceUtil::ThreadSyscallException'
what(): RecMutex.cpp:96: IceUtil::ThreadSyscallException:
syscall exception: Unknown error: -1
zsh: abort (core dumped)
The error comes from this line (RecMutex.cpp:96):
rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutexattr_settype() fails with the only possible error code according to the man page - "Invalid value for attr, or invalid value for type". The same pthreads function call works fine in a standalone application.
Here is the stack trace from the core file:
#0 0x28631087 in kill () from /lib/libc.so.7
#1 0x28630fe6 in raise () from /lib/libc.so.7
#2 0x2862fbfa in abort () from /lib/libc.so.7
#3 0x284b7b80 in __gnu_cxx::__verbose_terminate_handler ()
from /usr/lib/libstdc++.so.6
#4 0x284bc02a in std::set_unexpected () from /usr/lib/libstdc++.so.6
#5 0x284bc072 in std::terminate () from /usr/lib/libstdc++.so.6
#6 0x284bbf6a in __cxa_throw () from /usr/lib/libstdc++.so.6
#7 0x2834b17d in IceUtil::RecMutex::RecMutex ()
from /usr/local/lib/libIceUtil.so.33
#8 0x28179a34 in __static_initialization_and_destruction_0 ()
from /usr/local/lib/libIce.so.33
#9 0x282b2fe5 in __do_global_ctors_aux () from /usr/local/lib/libIce.so.33
#10 0x281144d9 in _init () from /usr/local/lib/libIce.so.33
#11 0x2805c96b in dl_iterate_phdr () from /libexec/ld-elf.so.1
#12 0x28060673 in dlopen () from /libexec/ld-elf.so.1
#13 0x2805b3fe in ?? () from /libexec/ld-elf.so.1
All I have to do to get this error is to link the application with -lIce, no actual function calls are made yet.
0
Comments
-
Sorry, forgot. The FreeBSD version is 7.0-RC1 i386 (I also got this error on 7.1).0
-
Usually you shouldn't use -lpthread, but pass -pthread (no "l") to gcc for compiling and linking (this will compile thread safe and link to preferred threading library of the current release).
Please note that FreeBSD 7.0 has a severe threading bug, so you should upgrade to 7.1 or 7.2 asap (in my case this hit me when using omniORB, exceptions weren't propagated properly as a side effect of this and caused horrible runaways - also dump hang on 7.0 which I assume was also caused by this problem).0 -
I agree with grembo. use -pthread as your compile option rather then -lpthread. -pthread will implicitly link the thread safe c library and other thread safe dependancies for you. I do the same with Solaris and
it is a requirement when using boost_thread library.. if you end up using it in the future0