Intel® System Studio
Share information with other developers using Intel® System Studio.

Library compatibility between GNU and WindRiver 4.2.0.0

eric_s_3
Beginner
1,344 Views

Building a POSIX multi-thread C code application targeting Atom E6xx, running a pre-built (board-vendor supplied kernel) WindRiver Linux 4.2.0.0. (to be completely clear , we are not building the kernel, only the application)

Using Fedora 14 to perform application builds using GNU gcc ver. 4.5.1.

Application uses only std GNU/Linux calls. Application uses POSIX thread libs.

Application currently runs correctly on the Atom processor board, running the vendor supplied WR Linux.

Currently working on running a System Studio 2013 Inspector dynamic analysis on our code.

As an intermediate step, when trying to run our code in the GNU gdb debugger, on the Atom processor (WR Linux OS), the following warnings appear in the console window:

  warning: File "/lib/libthread_db-1.0.so" auto-loading has been declined by your auto-load safe-path set to "$debugdir:$datadir/auto-load"

  warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.

These warnings appear after entering the gdb run command (after setting a breakpoint).

Also tried a simple threaded hello-world test on the Atom processor board, built in the same manner as our application. It too generated the same warnings.

The sequence I execute is as follows:

gdb threads

b main

run

At this point, the warnings appear.

Is this caused by an incompatility between the WR libraries (libthread_db...) and those on the Fedora 14 host where the build was done?

Is there another possible cause?

Is there a solution short of purchasing the WR Workbench?

Thank you.

 

0 Kudos
6 Replies
Rob_Mueller-Albrecht
1,344 Views

Hi Eric,

I think the warnings you see are just a side effect of slighlty above average security settings on your targets Wind River Linux and nothing more serious.

To enable thread debugging in GDB you can add

add-auto-load-safe-path /lib/libthread_db-1.0.so

line to your configuration file "/home/root/.gdbinit".

To completely disable this security protection add

set auto-load safe-path /

line to your configuration file "/home/root/.gdbinit".

For more information about this security protection see the "Auto-loading safe path" section in the GDB manual.

E.g., run from the > shell:

info "(gdb)Auto-loading safe path" warning: Unable to find libthread_db matching inferior's thread library, > thread debugging will not be available.

Thanks, Rob

0 Kudos
eric_s_3
Beginner
1,344 Views

Thank you for the fast response.

There was no .gdbinit file anywhere in the WR Linux target file system.

I added a .gdbinit file as  you specified, in the /root and /home (there is currently no /home/root).

Also set $sdir to /lib (for default location to load libthread-db).

Now, only the second warning appears,
  warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.

Following is what transpired in gdb:

(gdb) show auto-load libthread-db
Auto-loading of inferior specific libthread_db is on.
(gdb) show debug libthread-db
libthread-db debugging is 0.
(gdb) set debug libthread-db 1
(gdb) b main
Breakpoint 1 at 0x8048560: file thread.cpp, line 15.
(gdb) run
Starting program: /home/TestGDB/thread

Trying host libthread_db library: libthread_db.so.1.
Host libthread_db.so.1 resolved to: /lib/libthread_db.so.1.
td_ta_new failed: application not linked with libthread
thread_db_load_search returning 0

Trying host libthread_db library: libthread_db.so.1.
Host libthread_db.so.1 resolved to: /lib/libthread_db.so.1.
td_ta_new failed: application not linked with libthread

Trying host libthread_db library: /lib/libthread_db.so.1.
td_ta_new failed: application not linked with libthread
thread_db_load_search returning 0

warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.

 

At this point, no thread info was available.

Further checks in gdb:

(gdb) show auto-load safe-path
List of directories ... $debugdir:$datadir/auto-load:/lib/libthread_db-1.0.so

(gdb) show print thread-events
Printing of thread events is on.
(gdb) info auto-load
gdb-scripts:  No auto-load scripts.
libthread-db:  No auto-loaded libthread-db.
local-gdbinit:  Local .gdbinit file was not found.
python-scripts:  No auto-load scripts.

 

So it didn't find the .gdbinit. It didn't load libtread-db, even tho auto-load was set to true and the default path ($sdir) was set, and also the auto-load safe-path returned /lib/libthread_db-1.0.so which I think is what we want(?).

I spent the last couple of hours digging around gdb forums but can't seem to figure this out. Will keep banging on it. Hoping someone here has some ideas?

 

 

 

0 Kudos
Rob_Mueller-Albrecht
1,344 Views

Hmmm,

warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.

literally means that your /lib/libthread_db.so.1 does not match your /lib/libpthread.so.0

I would recommend checking whether the use of

set libthread-db-search-path [path]

to define the search path for those shared objects explictly does help.

Only if that doesn't work  am I willing to concede that we may be looking at a libc and/or libthread_db package mismatch between host and target ....

Thanks, Rob

0 Kudos
eric_s_3
Beginner
1,344 Views

Hi Rob,

Thanks again.

I entered the setting you suggested. Following is the sequence copied from GDB session:

[Inferior 1 (process 4040) exited normally]

(gdb) n

The program is not being run.

(gdb)

The program is not being run.

(gdb)

The program is not being run.

(gdb)

The program is not being run.

(gdb)

The program is not being run.

(gdb) set libthread-db-search-path /lib

(gdb) run

Starting program: /home/TestGDB/thread

Trying host libthread_db library: /lib/libthread_db.so.1.

td_ta_new failed: application not linked with libthread

thread_db_load_search returning 0

Trying host libthread_db library: /lib/libthread_db.so.1.

td_ta_new failed: application not linked with libthread

thread_db_load_search returning 0

warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.

Breakpoint 1, main (argc=1, argv=0xbffffaf4) at thread.cpp:15

15 pthread_create(&thread,0,doit,0);

(gdb)

 

No change in behavior.

Can you provide the WR libraries to replace the corresponding ones on my target?

Side Note:

The version of WR Linux running on the target is 4.2.0.0.

The compiler version used to build the application: gcc ver. 4.5.1

Thank you.

 

ES.

 

0 Kudos
Rob_Mueller-Albrecht
1,344 Views

Hi Eric,

sorry - I don't own the distribution of Wind River libraries. I assume the Wind River libraries should be somewhere on the target, thus you could copy them over to the host and link against them?

Anyway - I guess the next step is to look at which libraries you actually linked in.

Using ldd on your executable should provide you a list of linked in dependencies. I guess you could copy those libraries including your host libthread_db to the target along with the app.

Thanks, Rob

 

0 Kudos
Baba_T_
Beginner
1,344 Views
I have run to the very same issue, and i figured it out by two steps: step 1, add "add-auto-load-safe-path ~/src/gdb" to {HOME}/.gdbinit to solved the first problem step 2, that is not a problem in fact, i found it just because i have used different cross compiler tool chain to compile gdb on board and the executable respectively.
0 Kudos
Reply