dlopen failed: file not found
Chris Johns
chrisj at rtems.org
Thu Jul 28 02:22:17 UTC 2016
On 28/07/2016 08:05, Saeed Ehteshamifar wrote:
> Hello,
>
> I followed the instructions Chris posted on using WAF to make a TAR
> object file and linked it to my program. But when I run it, I get "file
> not found" error. I'm using SPARC SIS.
>
> Here is my waf script:
> import rtems_waf.rtems as rtems
>
> def init(ctx):
> rtems.init(ctx)
>
> def options(opt):
> rtems.options(opt)
>
> def configure(conf):
> rtems.configure(conf)
>
> def build(bld):
> rtems.build(bld)
>
> rtems.root_filesystem(bld, 'dl',
> ['init.c',
> 'hello.c'],
> 'dl.tar', 'dl-tar.o')
>
How do you build the tar file into the executable?
>
>
> And here is how I untar the object in my Init task and load the dynamic
> object, which should print "Hello":
> ...
> extern int _binary_dl_tar_start;
> extern int _binary_dl_tar_size;
>
> rtems_task Init(
> rtems_task_argument ignored
> )
> {
> int (*hello)();
>
> int te = Untar_FromMemory((void *)(&_binary_dl_tar_start),
> (size_t)(_binary_dl_tar_size));
> /* error checking. omitted here. */
I suggest you print the error code here.
Chris
>
> void* handle = dlopen ("/hello.o", RTLD_NOW | RTLD_GLOBAL);
> if (!handle)
> {
> printf("dlopen failed: %s\n", dlerror());
> exit(1);
> }
> ...
>
> What am I doing wrong? Using /objdump/ and /nm/ I didn't find ANY
> occurrence of /hello /in the final executable file.
>
> Best Regards,
> Saeed
>
>
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
>
More information about the users
mailing list