Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with dynamically loaded 'libe-loader.so' #50

Open
alx123 opened this issue May 11, 2015 · 5 comments
Open

Problem with dynamically loaded 'libe-loader.so' #50

alx123 opened this issue May 11, 2015 · 5 comments

Comments

@alx123
Copy link

alx123 commented May 11, 2015

I compiled the Lazarus environment incl. FPC on a headless Parallella board with the image 01/30/2015. I want to access the functions of the Epiphany SDK via the dynamically loaded libraries libehal.so and libe-loader.so. So I converted the headers and implement the sample program of the third chronicle.
All the used functions of libe-hal.so are successful. But calling a function of the libe-loader.so gives a crash of the program with the following message:
symbol lookup error: /opt/adapteva/esdk/tools/host/lib/libe-loader.so: undefined symbol: e_alloc.
Obviously the second library needs the first one, but cannot or do not load the functions.
How can I resolve this conflict?
I do not have static libraries in order to write a wrapper with all exported functions in one library.

Thanks in advance
Alex

@olajep
Copy link
Contributor

olajep commented May 12, 2015

You need to pass these options to the linker somehow:
-L/opt/adapteva/esdk/host/lib
-le-hal
-le-loader

I'm not familiar with lazarus in any way but maybe this helps, seems similar to what you want to do:
http://wiki.lazarus.freepascal.org/Macros_and_Conditionals#Examples

HTH,

Ola

@alx123
Copy link
Author

alx123 commented May 26, 2015

Thanks for your advice, but I can't it running. I tried to copile a wrapper library with Geany, the light C environment:
Compile:
gcc -fPIC -c epiphany.c -o epiphany.o -I /opt/adapteva/esdk/tools/host/include
Build:
gcc -shared epiphany.o -o libepiphany.so -L /opt/adapteva/esdk/tools/host/lib -le-hal -le-loader

But it cannot be loaded, nevertheless nm -D .. shows the exported functions.

I also checked the cputimer example program. An executable works, but the compiled library cannot be loaded by LoadLibrary.

But on the other side, using of the dynamic library libe-hal.so works fine. Only the three not so unimportant functions from libe-loader.so cannot access to the other library.

What about recreate these only 3 functions in the pascal code. It cannot be so much code. But where are the source of the libe-loader library?

Thanks in advance
Alex

@alx123 alx123 closed this as completed May 26, 2015
@alx123 alx123 reopened this May 26, 2015
@olajep
Copy link
Contributor

olajep commented May 30, 2015

Are you cross-compiling?

You probably need to add the -le-hal and -le-loader when you link your library too. Also you need to set
-L/opt/adapteva/esdk/tools/host/lib.

@alx123
Copy link
Author

alx123 commented Jun 4, 2015

Hello,
no, I'm not cross-compiling.
By the example I know, that the not found functions are because of the non set environment variable LD_LIBRARY_PATH.
So I try to recompile the libs by build-libs.sh. But where the environment variable PARALLELLA_LINUX_HOME should set to, in order to compile not only e-loader and e-xml.
All things on the Parallella-Board with E16 and the headless image with preconfigured sdk.

Thanks
Alex

@Urhixidur
Copy link

The e-loader.c source is found in epiphany-libs/src/e-loader/src/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants