All of lore.kernel.org
 help / color / mirror / Atom feed
* [prelink-cross] error while loading shared libraries: ld-linux.so.3
@ 2015-06-16  7:01 Florian Boehmak
  2015-06-16 19:12 ` Mark Hatle
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Boehmak @ 2015-06-16  7:01 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/plain, Size: 1881 bytes --]

Hi,

I am having difficulties to cross-prelink a simple hello world program.
Prelinking for my x86 machine works fine (host system) but when using the
arm cross-compile toolchain I get the error:

prelink: bin_arm/hello: Could not parse `/usr/local/sbin//prelink-rtld:
error while loading shared libraries: ld-linux.so.3'

If I understand it correctly then prelink-rtld emulates ld-linux.so but why
is it parsed by rtld?

Here are my files:

# main.cpp

#include <stdio.h>
#include "world.h"
int main (int argc, char *argv[])
{
fprintf(stdout, "hello\n");
World w;
w.Str();
return 0;
}


# world.cpp

#include "world.h"
void World::Str()
{
fprintf(stdout, "world\n");
}


# prelink_arm.conf

-l arm-2012.03/arm-none-linux-gnueabi/libc/lib
-h arm-2012.03/arm-none-linux-gnueabi/libc/lib
-l arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib
-h arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib


# compiling

../arm-2012.03/bin/arm-none-linux-gnueabi-gcc -Wall -fPIC -shared -Iinclude
-o lib_arm/libworld.so src/world.cpp
arm-2012.03/bin/arm-none-linux-gnueabi-gcc -Wall -Iworld/include
-Lworld/lib_arm/ -lworld -o bin_arm/hello src/main.cpp


# prelink-cross

PATH=/usr/local/sbin prelink --verbose --cache-file=cache/prelink_arm.cache
--config-file=prelink_arm.conf
--ld-library-path="world/lib_arm;arm-2012.03/arm-none-linux-gnueabi/libc/lib;arm-2012.03/arm-none-linux-gnueabi/libc/usr/lib;"
-h bin_arm/hello


I am sort of stuck. Could you point me in the right direction. What am I
missing or doing wrong?
Thank you.

Cheers
Florian

Ps. I have put together the code on github this would be the
"shared-library" branch.
https://github.com/fnbk/prelink-cross-example

Ps. I posted a similar question on stackoverflow, cross-prelinking but
without shared libraries.
http://stackoverflow.com/q/30849060/5011904

[-- Attachment #2: Type: text/html, Size: 3125 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [prelink-cross] error while loading shared libraries: ld-linux.so.3
@ 2015-06-16 16:39 Florian Boehmak
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Boehmak @ 2015-06-16 16:39 UTC (permalink / raw)
  To: yocto

[-- Attachment #1: Type: text/plain, Size: 2126 bytes --]

Hi, I tried to track down the error message which comes from rtld. This is
the call stack:

rtld.c:main()
    rtld.c:process_one_dso()
        dl-version.c:_dl_check_map_versions()



This is the code that produces the error message:

Elf64_Vernaux *aux;
struct link_map *needed = find_needed (strtab + ent->vn_file, map);

/* If NEEDED is NULL this means a dependency was not found
 and no stub entry was created.  This should never happen.  */
if (needed == NULL)
{
  _dl_signal_error (errval, NULL, NULL, strtab + ent->vn_file);
  printf("error while loading shared libraries: %s", strtab + ent->vn_file);
  exit (1);
}



This code loops through the needed versions of the link_map (Elf64_Verneed
*ent) and calls find_needed for each entry. find_needed calls
_dl_name_match_p and compares the library name. I have captured the
individual calls in debug statements and this is the result:

_dl_name_match_p name:libc.so.6
_dl_name_match_p name:libc.so.6
_dl_name_match_p name:libc.so.6
_dl_check_map_versions needed:1, file:libc.so.6

_dl_name_match_p name:libgcc_s.so.1
_dl_name_match_p name:libgcc_s.so.1
_dl_check_map_versions needed:1, file:libgcc_s.so.1

_dl_name_match_p name:libc.so.6
_dl_name_match_p name:libc.so.6
_dl_check_map_versions needed:1, file:libc.so.6

_dl_name_match_p name:ld-linux.so.3
_dl_name_match_p name:ld-linux.so.3
_dl_check_map_versions needed:NULL, file:ld-linux.so.3



As I can see the dependencies libc.so.6 and libgcc_s.so.1 are met. Only
ld-linux.so.3 is not. libc.so.6, libgcc_s.so.1 and ld-linux.so.3 are all in
the same location, so I don't understand what this error means.

arm-2012.03/arm-none-linux-gnueabi/libc/lib:
-rwxr-xr-x 1 developer users  177212 10. Jun 18:43 ld-2.15.so
lrwxrwxrwx 1 developer users      10 10. Jun 18:43 ld-linux.so.3 ->
ld-2.15.so
lrwxrwxrwx 1 developer users      12 10. Jun 18:43 libc.so.6 -> libc-2.15.so
-rw-r--r-- 1 developer users     135 10. Jun 18:43 libgcc_s.so
-rw-r--r-- 1 developer users 3190583 10. Jun 18:43 libgcc_s.so.1
...


Any hints? :-)
Thank you.

Cheers
Florian

[-- Attachment #2: Type: text/html, Size: 2923 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-17 20:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-16  7:01 [prelink-cross] error while loading shared libraries: ld-linux.so.3 Florian Boehmak
2015-06-16 19:12 ` Mark Hatle
2015-06-16 22:56   ` Florian Boehmak
2015-06-17 13:28     ` Florian Boehmak
2015-06-17 20:35     ` Mark Hatle
  -- strict thread matches above, loose matches on Subject: below --
2015-06-16 16:39 Florian Boehmak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.