LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 11-12-2014, 11:03 PM   #1
gauravpathak129
LQ Newbie
 
Registered: Jan 2014
Location: Pune, Maharashtra
Distribution: Fedora 17, Ubuntu 12.04
Posts: 18

Rep: Reputation: Disabled
Issue with libdl


Hello Experts,

I am using TAO3530 having TI OMAP 3530 processor with Tsunami Basebaord form TechNexion. I have created a custom rootfs using buildroot but I am using their kernel image.
I have cross-compiled a simple "Hello World" program using "arm-buildroot-linux-uclibcgnueabi-gcc" which executed flawlessly on target board but when I am trying to execute a cross-compiled application to print the value of Cosine of 2
the program is not getting executed, infact I am not getting any error or output.
The program is:

Code:
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>

int main(int argc, char **argv)
{
	void *handle;
	double (*cosine)(double);
	char *error;

	handle = dlopen("libm.so", RTLD_LAZY);
	if (!handle) 
	{
		fprintf(stderr, "%s\n", dlerror());
		exit(EXIT_FAILURE);
	}

	dlerror();    /* Clear any existing error */

	/* Writing: cosine = (double (*)(double)) dlsym(handle, "cos");
	would seem more natural, but the C99 standard leaves
	casting from "void *" to a function pointer undefined.
	The assignment used below is the POSIX.1-2003 (Technical
	Corrigendum 1) workaround; see the Rationale for the
	POSIX specification of dlsym(). */

	*(void **) (&cosine) = dlsym(handle, "cos");

	if ((error = dlerror()) != NULL)  
	{
		fprintf(stderr, "%s\n", error);
		exit(EXIT_FAILURE);
	}

	printf("The COSINE of 2.0 is %f\n", (*cosine)(2.0));
	dlclose(handle);
	exit(EXIT_SUCCESS);
}
I am not getting any idea why programs which are using libdl and dlopen, dlcolse are not getting executed but the same program is getting executed on HOST.
 
  


Reply

Tags
buildroot, lib



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
dlopen failed to open 'libdl.so ERROR viperpaki007 Linux - Newbie 7 10-14-2018 04:45 AM
AWK (could be JVM?) Error - libdl.so.2/libc.so.6 revof11 Linux - Software 14 08-29-2014 02:34 PM
[SOLVED] libdl problems alexbrui Slackware 2 04-12-2011 07:04 AM
linking with libdl.so in Linux George2 Programming 2 05-07-2006 03:46 AM
Make target libdl.so.2 missing? hjohnson Linux From Scratch 1 04-23-2005 02:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 12:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration