- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- -mt linker flag causing crash
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-12-2010 10:33 PM
тАО07-12-2010 10:33 PM
-mt linker flag causing crash
We use log4cplus for logging.
My application crashes at runtime and the gdb stack trace points to the following line of code.
APPLOGGER_INITIALIZE("logging.properties");
where
#define APPLOGGER_INITIALIZE(filename) log4cplus::PropertyConfigurator::doConfigure(LOG4CPLUS_STRING_TO_TSTRING(filename));
The stack trace is included below.
Program terminated with signal 11, Segmentation fault.
SEGV_MAPERR - Address not mapped to object
#0 0xc0000000000ec090:0 in pthread_mutex_lock+0x610 ()
from /usr/lib/hpux64/libpthread.so.1
(gdb) where
#0 0xc0000000000ec090:0 in pthread_mutex_lock+0x610 ()
from /usr/lib/hpux64/libpthread.so.1
#1 0xc000000000359fb0:0 in __thread_mutex_lock+0xb0 ()
from /usr/lib/hpux64/libc.so.1
#2 0xc000000002046be0:0 in _HPMutexWrapper::lock(void*)+0x80 ()
from /usr/lib/hpux64/libstd_v2.so.1
#3 0xc00000000211f160:0 in std::basic_istream
#4 0xc0000001136db9f0:0 in std::basic_istream
#5 0xc0000001136debe0:0 in log4cplus::helpers::Properties::init ()
at property.cxx:104
#6 0xc0000001136dfd40:0 in log4cplus::helpers::Properties::Properties ()
at property.cxx:90
#7 0xc0000001136e01d0:0 in log4cplus::helpers::Properties::Properties(std::basic_string
at property.cxx:0
#8 0xc0000001135e96a0:0 in log4cplus::PropertyConfigurator::PropertyConfigurator () at configurator.cxx:204
#9 0xc0000001135ea740:0 in log4cplus::PropertyConfigurator::PropertyConfigurator(std::basic_string
#10 0xc0000001135ec7a0:0 in log4cplus::PropertyConfigurator::doConfigure ()
The linker flags I use to build my application are
aCC -Wl,-N -Wl,+s -Wl,+b,/usr/lib/hpux64:. -Wl,-Brestricted -AA +DD64 -mt
However if I remove the -mt flag I do not get the error.
Can anyone tell me why I get the error if I use the -mt linker flag.
Any help is very much appreciated.
Thanks
Sruthi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-12-2010 10:57 PM
тАО07-12-2010 10:57 PM
Re: -mt linker flag causing crash
If you link against libpthread, every object must be compiled with -mt.
Your stack trace implies that you have compiled some code referencing std::basic_istream without -mt. I.e. when you constructed it.
If your lib needs to be used by applications that are or aren't threaded, compile with -mt but don't link with -mt.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2010 01:29 AM
тАО07-13-2010 01:29 AM
Re: -mt linker flag causing crash
Thanks for the quick response.
Yes my application is multithreaded.
I realized that I had not compiled log4cplus with the -mt flag. So I recompiled log4cplus with -mt and rebuilt my application with log4cplus but my application still crashes when i use the -mt linker flag and the gdb stacktrace is the same as previous.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2010 08:36 AM
тАО07-13-2010 08:36 AM
Re: -mt linker flag causing crash
I do not have access to an IA64/HP-UX machine but I could at least take a look at the source given the call stack and line numbers and version of the source.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2010 08:44 AM
тАО07-13-2010 08:44 AM
Re: -mt linker flag causing crash
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2010 03:52 PM
тАО07-13-2010 03:52 PM
Re: -mt linker flag causing crash
Have you checked EVERY object, archive and shared lib in your application for -mt? Even other third party libs.
Try footprints(1) on your application.
Are you on a thread stack or in the main thread?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-19-2010 06:41 AM
тАО07-19-2010 06:41 AM
Re: -mt linker flag causing crash
@Dennis
I recompiled all the open source libraries with -mt compilation flag, checked if the 3rd party libraries were compiled with -mt...they were.
@Vaclay
We use log4cplus version 1.0.2.
I used --enable-pthread flag while compiling log4cplus. I noticed this did not change the CFLAGS, CXXFLAGS or the compiler options though.
One or both of these steps fixed the problem. Once I finish this task I will isolate them check which one actually worked post it here and close the thread.
Thanks for the help provided in fixing the problem
Regards
Sruthi