ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi all,
First, I am sorry for double post in this forum, but I just want to express my problem in more detail so that somebody can help.
I've got a problem that I would really appreciate your help. I spent last week trying to build my project on SUSE Linux but did not succeed. I built it with the IDEs : Kdevelop and Eclipse - using "managed/auto make" C++ project. The only thing outside the project that I have to link is the XML parser shared library libxerces-c.so. The Build was ok (compiled and linked) but the Run failed. It was not able to enter even the first line of code inside function main.
It seems to me that the shared library was well recognized at the Build time but was unable to locate/load at run time.
I already google for the issue and asked on some forums and all I got is some think like: It might be a bug of linux kernel 2.6.18 or gdb 6.5 or both. That's why I tried to build the program on several version of SUSE (version 9.3; 10.0; 10.1; 10.2 - which have the linux kernels from 2.6.13 to 2.6.19 and gdb from 6.3 to 6.5 or so) but was not able to solve the problem.
I also tried to build the shared library manually instead of using existing one provided with SUSE. Building the library was ok but the problem remains.
Running the program on debug mode showed the following errors (the debug stopped before going inside the main):
in Eclipse:
....
A syntax error in expression, near `-console'.
Failed to read a valid object file image from memory.
Stopped due to shared library event
[Thread debugging using libthread_db enabled]
warning: Lowest section in /usr/lib/libicudata.so.34 is .hash at 000000b4
[New Thread -1225189680 (LWP 434]
Stopped due to shared library event
[Switching to Thread -1225189680 (LWP 434]
...
in Kdevelop:
...
(gdb) break /home/son/work_space/nicemona03/src/nicemona.cpp:41
Breakpoint 1 at 0x8078a20: file /home/son/work_space/nicemona03/src/nicemona.cpp, line 41.
(gdb) run
Failed to read a valid object file image from memory.
(gdb) backtrace
Stopped due to shared library event
#0 0xb7f0ac70 in _dl_debug_state () from /lib/ld-linux.so.2
#1 0xb7eff6f6 in dl_main () from /lib/ld-linux.so.2
....
Hi Jim,
Thanks alot for your reply. Now I found and solved the problem. I was so stupid that I didn't look thoroughly at the backtrack to see that it was a prolem of static constructors and destructors.
The problem is that I initialized a static const member variable by assigning it to value of another static const. It seems that the compliler is not clever enough to say that it is not allowed (no error, no warning).
Btw, here is the problem. The following program was built ok but was unable to run and debug shows the "stopped due to shared library events" although there is no shared library at all:
#include <string>
#include <iostream>
using namespace std;
class a
{
static const string STR1;
static const string STR2;
};
The order of creation/initialization of static stuff is undefined. Which means all bets are off if you try to do that. I don't get the error you get with g++. It just segfaults while trying to construct one of the statics.
On a slightly unrelated note, I strongly discourage use of Xerces, especially the C++ version. I've personally had to deal with a memory leak from improper implementation of a memory pool technique. Fortunately, they wrapped all their allocations through an object, so I could forcefully clean up memory from under all remaining objects.
Hi,
Dont know too much bout shared libraries. But sounds like your ram is invalid in a memory sector. You can run several scans from the ubcd but its almost impossible to detect. there several million locations...good luck. I'd find an alternate place to compile your program then troubleshoot it
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.