# LDD: Not a FreeBSD ELF shared object



## maxi0250 (Aug 10, 2022)

Hello,

I am currently trying to run a linux-application via linux-binary-compatibility on FreeBSD.
Linux-binary-compatibility has been set up by using the guideline and it seems to work as intended.
However, a library I want to use can't be linked, as stated by "ldd" with the errorcode:

```
ldd: /compat/linux/usr/lib/oracle/21/client/lib/libsqora.so.21.1: not a FreeBSD ELF shared object
```

The library I am addressing here is a linux-driver from Oracle. I do know Oracle does not support FreeBSD, but we are trying to get it running out of curiosity.

Is there any way to resolve this error and use the library?

Additional Information:
FreeBSD-Version: 12.2 release p9
Architecture: amd64
Oracle-Driver: 32bit


----------



## cmoerz (Aug 10, 2022)

I'm not an expert on the linux emulation layer; obviously, you cannot mix FreeBSD compiled binaries with linux libraries. If you want to run an application that makes use of linux libraries, said app will need to be compiled as linux binary.

There are some tricks for branding binaries to tell the kernel to run them in the linux emulation layer directly, if I'm not misremembering. However, this might not be applicable for your case, I think.

I recommend setting up a linux jail and running your app in that instead; I successfully managed to run a linux binary with Oracle db drivers this way - which is what you're attempting to do, I'm guessing.

This post should give you some pointers on setting up a jail:








						Setting up a (Debian) Linux jail on FreeBSD
					

Hi gang!  Prerequisites: I am assuming that you know how to install software on FreeBSD and also have some basic understanding about FreeBSD jails.  Editorial  I'm going to be very honest here: I started disliking Linux for a while, and I've worked with it for a long time. For various reasons...




					forums.freebsd.org


----------



## maxi0250 (Aug 10, 2022)

Thank you for your response.



cmoerz said:


> I recommend setting up a linux jail and running your app in that instead; I successfully managed to run a linux binary with Oracle db drivers this way - which is what you're attempting to do, I'm guessing.


That's true, we are trying to connect to a oracle DB from Freebsd.
However, from my understanding, I can't access files/apps outside the jail when operating inside it.
One of our apps cannot be moved inside the jail because it runs on the outer layer (don't know how to describe it, I hope you get it), so installing the Oracle db drivers in a jail would be useless, because the driver can't access the data outside of the jail, or can it?


----------



## shkhln (Aug 10, 2022)

maxi0250 said:


> I am currently trying to run a linux-application via linux-binary-compatibility on FreeBSD.
> Linux-binary-compatibility has been set up by using the guideline and it seems to work as intended.
> However, a library I want to use can't be linked, as stated by "ldd" with the errorcode:
> 
> ...


Linked to what exactly? Are you trying to build a Linux or FreeBSD binary?


----------



## jbo (Aug 10, 2022)

maxi0250 said:


> FreeBSD-Version: 12.2 release p9


FreeBSD 12.2 has been EOL for a couple of months already.


----------



## zirias@ (Aug 10, 2022)

Uhm, it's pretty simple, FreeBSD's ldd(1) does not work on Linux shared objects. Use the Linux version e.g. like this:
`/compat/linux/bin/bash ldd /usr/lib/oracle/21/client/lib/libsqora.so.21.1`.
(The Linux `ldd` is a shell script, therefore you have to run a Linux shell to execute it)


----------



## cmoerz (Aug 10, 2022)

maxi0250 said:


> the driver can't access the data outside of the jail, or can it?


depends on what you're attempting to achieve. If you're referring to file level access - you could do a simple nullfs mount to accomplish a "shared" space between host and jail. 

If you're attempting to run a FreeBSD binary with a linux library you're probably better off to use a socket to share data between a linux and FreeBSD binary. Not sure, if the first one is even technically supported/possible. Well, it might be possible with a "lot" of coding, but still probably an exercise in futility.


----------



## shkhln (Aug 10, 2022)

cmoerz said:


> If you're attempting to run a FreeBSD binary with a linux library you're probably better off to use a socket to share data between a linux and FreeBSD binary. Not sure, if the first one is even technically supported/possible. Well, it might be possible with a "lot" of coding, but still probably an exercise in futility.


We've been doing that for years. My attempt is coded from scratch, though.


----------

