# I need linux-gate.so.1?



## frankit60 (Apr 22, 2009)

Hello guys,
I am try to port ocilib http://orclib.sourceforge.net/.

The ldd output of the library is:

```
ldd ./libocilib.so
        linux-gate.so.1 =>  (0xffffe000)
        libclntsh.so.10.1 => /data/oracle/10g/lib/libclntsh.so.10.1 (0xb7124000)
        libc.so.6 => /lib/libc.so.6 (0xb6fd5000)
        libnnz10.so => /data/oracle/10g/lib/libnnz10.so (0xb6dd1000)
        libdl.so.2 => /lib/libdl.so.2 (0xb6dcd000)
        libm.so.6 => /lib/libm.so.6 (0xb6da7000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xb6d90000)
        libnsl.so.1 => /lib/libnsl.so.1 (0xb6d79000)
        /lib/ld-linux.so.2 (0x80000000)
```
My questions are:

what is linux-gate.so.1?
I need of linux-gate.so.1?

Thanks
Franco


----------



## SirDice (Apr 22, 2009)

What linux_base are you running?



> What is linux-gate.so.1?
> 
> When you use the ldd utility on a reasonably recent Linux system you'll frequently see a reference to an ethereal entity known as linux-gate.so.1:
> 
> ...


http://www.trilithium.com/johan/2005/08/linux-gate/


----------



## SirDice (Apr 22, 2009)

Why don't you try porting it to native Freebsd?

http://orclib.sourceforge.net/download/


----------



## frankit60 (Apr 22, 2009)

The FreeBSD version is 7.1 i386
The linux-base is linux_base-fc4 


I have compile and install with success the ocilib and only this warning: libc.so.7, needed by /usr/local/lib/libocilib.so, may
conflict with libc.so.6

But when run demo I have a segmentation fault.

The gdb output is:

```
10.0.1.26/usr/compat/linux/usr/lib/oracle/10.2.0.3/client/ocilib-3.1.0/demo#
gdb ocilib_demo ocilib_demo.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...
Core was generated by `ocilib_demo'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from
/usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib/libclntsh.so.10.1...done.
Loaded symbols for
/usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
Reading symbols from /usr/local/lib/libocilib.so.4...done.
Loaded symbols for /usr/local/lib/libocilib.so.4
Reading symbols from /lib/libc.so.7...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from
/usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib/libnnz10.so...done.
Loaded symbols for
/usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib/libnnz10.so
Reading symbols from /usr/compat/linux/lib/libdl.so.2...done.
Loaded symbols for /usr/compat/linux/lib/libdl.so.2
Reading symbols from /usr/compat/linux/lib/libm.so.6...done.
Loaded symbols for /usr/compat/linux/lib/libm.so.6
Reading symbols from /usr/compat/linux/lib/libpthread.so.0...done.
Loaded symbols for /usr/compat/linux/lib/libpthread.so.0
Reading symbols from /usr/compat/linux/lib/libnsl.so.1...done.
Loaded symbols for /usr/compat/linux/lib/libnsl.so.1
Reading symbols from /usr/compat/linux/lib/libc.so.6...done.
Loaded symbols for /usr/compat/linux/lib/libc.so.6
Reading symbols from /usr/compat/linux/lib/ld-linux.so.2...done.
Loaded symbols for /usr/compat/linux/lib/ld-linux.so.2
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x292aeb41 in __init_misc () from /usr/compat/linux/lib/libc.so.6
(gdb)
```
I think that the problem is that:

```
/usr/local/lib/libocilib.so need libc.so.7
/usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib/libclntsh.so need libc.so.6
```

and now I want to try to test the use libocilib from linux emulation

any idea?

Ciao
Franco


----------



## SirDice (Apr 22, 2009)

Try a more recent linux_base like f8.

And again, why don't you try compiling it natively on freebsd? Why use the linux emulation at all?


----------



## frankit60 (Apr 22, 2009)

The linux-oracle-instantclient need fc4.
Still trying to replace and to continue with the native port.

Thanks
Franco


----------



## SirDice (Apr 22, 2009)

frankit60 said:
			
		

> The linux-oracle-instantclient need fc4.


Set in /etc/make.conf

```
OVERRIDE_LINUX_BASE_PORT=f8
OVERRIDE_LINUX_NONBASE_PORTS=f8
```
And it'll use f8


----------



## frankit60 (Apr 22, 2009)

Well,

1) create a new virtual machine for test
2) install linux_base-f8
3) change /rc/conf
4) install instantclient
5) recompile ocilib with demo
6) send you a feedback

Two hour from now 

Thanks
Franco


----------



## frankit60 (Apr 22, 2009)

Sorry!!


1) create a new virtual machine for test
2) install linux_base-f8
3) change /etc/make.conf
4) install instantclient
5) recompile ocilib with demo
6) send you a feedback


----------



## frankit60 (Apr 22, 2009)

In a new machine I have this error.
Have any idea?

Thanks
Franco

```
bsd71-base# make install clean
===>  Installing for linux-oracle-instantclient-basic-10.2.0.3.20061115_2
===>   linux-oracle-instantclient-basic-10.2.0.3.20061115_2 depends on file: /compat/linux/bin/sh - not found
===>    Verifying install for /compat/linux/bin/sh in /usr/ports/emulators/linux_base-f8
===>  linux_base-f8-8_11 compat.linux.osrelease: 2.4.2 is not supported.
*** Error code 1

Stop in /usr/ports/emulators/linux_base-f8.
*** Error code 1

Stop in /usr/ports/databases/linux-oracle-instantclient-basic.
```


----------



## frankit60 (Apr 22, 2009)

resolve

sysctl compat.linux.osrelease=2.6.16


----------



## SirDice (Apr 22, 2009)

Correct :e


----------



## frankit60 (Apr 22, 2009)

I have compile and installed the library 
But there is a problem with make the demo 

This is the Makefile_demo generate from configure script


```
INCS =  -I/usr/local/include
CFLAGS = -DOCI_IMPORT_LINKAGE -DOCI_CHARSET_ANSI
LDFLAGS= -L/usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib -lclntsh  -L/usr/local/lib -locilib
CC = gcc
SRCS = ocilib_demo.c
OBJS = $(SRCS:.c=.o)

all: ocilib_demo

demo: $(OBJS)
        $(CC) $(LDFLAGS) -o $@ $(OBJS)

.c.o:
        $(CC) $(INCS) $(CFLAGS) -c -o $@ $<

clean: 
        rm -f *~ $(OBJS)
```

This is the error, do not use the Include path, what is wrong?


```
bsd71-base# make -f Makefile_demo
gcc -DOCI_IMPORT_LINKAGE -DOCI_CHARSET_ANSI -L/usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib -lclntsh  -L/usr/local/lib -locilib ocilib_demo.c  -o ocilib_demo
In file included from ocilib_demo.c:34:
ocilib_demo.h:89:20: error: ocilib.h: No such file or directory
ocilib_demo.c:40: error: expected ')' before '*' token
```


----------



## DutchDaemon (Apr 22, 2009)

frankit60, use code tags around system output; I've edited four posts, and it's getting annoying.


----------



## richardpl (Apr 22, 2009)

frankit60 said:
			
		

> ```
> bsd71-base# make -f Makefile_demo
> gcc -DOCI_IMPORT_LINKAGE -DOCI_CHARSET_ANSI -L/usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib -lclntsh  -L/usr/local/lib -locilib ocilib_demo.c  -o ocilib_demo
> In file included from ocilib_demo.c:34:
> ...



ocilib.h is located in /usr/local/include?

Hmm, what are you trying to do?
It doesnt make sense to build demo for FreeBSD if there is no native library for FreeBSD.

Either port complete code to FreeBSD or use binaries via linux emulation.


----------



## frankit60 (Apr 23, 2009)

Ciao richardpl,

ocilib.h is here

```
bsd71-test1# ll /usr/local/include/ocilib.h 
-rw-r--r--  1 root  wheel  274472 Apr 22 18:21 /usr/local/include/ocilib.h
```

I try to compile with this command

```
bsd71-test1# gcc -DOCI_IMPORT_LINKAGE -DOCI_CHARSET_ANSI -g -I/usr/local/include -L/usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib -lclntsh -L/usr/local/lib -locilib ocilib_demo.c -o ocilib_demo
/usr/bin/ld: warning: libc.so.6, needed by /usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib/libclntsh.so, may conflict with libc.so.7
bsd71-test1#
```
I try to run program but have segmentation dump

```
bsd71-test1# ./ocilib_demo 
Segmentation fault (core dumped)
bsd71-test1#
```
This is the output of gdb

```
bsd71-test1# gdb ocilib_demo.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"..."/usr/compat/linux/usr/lib/oracle/10.2.0.3/client/ocilib-3.2.0/demo/ocilib_demo.core": not in executable format: File format not recognized

(gdb) q
bsd71-test1#
```

libclntsh.so is oracle-linux library from instantclient port

```
bsd71-test1# find /usr -name libclntsh.so
/usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib/libclntsh.so
bsd71-test1# ll /usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib/libclntsh.so
lrwxr-xr-x  1 root  wheel  17 Apr 22 18:20 /usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib/libclntsh.so -> libclntsh.so.10.1
bsd71-test1# ll /usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib/libclntsh.so.10.1 
-r--r--r--  1 root  wheel  18825267 Apr 22 17:48 /usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib/libclntsh.so.10.1
bsd71-test1#
```

libocilib.so is compiled in freebsd from source

```
bsd71-test1# find /usr -name libocilib.so
/usr/local/lib/libocilib.so
/usr/compat/linux/usr/lib/oracle/10.2.0.3/client/ocilib-3.2.0/src/.libs/libocilib.so
bsd71-test1# ll /usr/local/lib/libocilib.so
lrwxr-xr-x  1 root  wheel  14 Apr 22 18:21 /usr/local/lib/libocilib.so -> libocilib.so.5
bsd71-test1# ll /usr/compat/linux/usr/lib/oracle/10.2.0.3/client/ocilib-3.2.0/src/.libs/libocilib.so
```
This are the env variable

```
bsd71-test1# echo $ORACLE_HOME/
/usr/compat/linux/usr/lib/oracle/10.2.0.3/client/
bsd71-test1# echo $LD_LIBRARY_PATH 
/usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib:/usr/compat/linux/lib:/usr/local/lib
bsd71-test1#
```


Any idea?

Thanks
Franco


----------



## SirDice (Apr 23, 2009)

You need to run the whole deal inside the linux environment. The ocilib was compiled using that. linux-oracle-instantclient is there too.

As far as I understood it you probably need to copy the .h files from ocilib to /compat/linux/usr/include. Perhaps the ocilib install already put them there, I didn't look that far..


----------



## frankit60 (Apr 23, 2009)

I move ocilib.h inside linux environment but the problem is the same  


```
bsd71-test1# mv /usr/local/include/ocilib.h /usr/compat/linux/usr/include/.
bsd71-test1#
bsd71-test1# gcc -DOCI_IMPORT_LINKAGE -DOCI_CHARSET_ANSI -g -I/usr/compat/linux/usr/include -L/usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib -lclntsh -L/usr/local/lib -locilib ocilib_demo.c -o ocilib_demo
/usr/bin/ld: warning: libc.so.6, needed by /usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib/libclntsh.so, may conflict with libc.so.7
bsd71-test1#
bsd71-test1# ./ocilib_demo 
Segmentation fault (core dumped)
bsd71-test1#
```


----------



## frankit60 (Apr 23, 2009)

*OCILib ports*

I think that the problem is libocilib.so not compiled in linux environment.
How I can force libocilib.so to link with libc.so.6 (linux env) instead of libc.so.7 (fbsd env) ?

I try to swap (for test only) /usr/lib/libc.so to libc.s0.6 but the gcc require libc.so.7


----------



## SirDice (Apr 23, 2009)

Not sure but I think just starting /compat/linux/bin/bash will drop you in the linux emulated bit. Run the compiler from there.


----------



## frankit60 (Apr 23, 2009)

The same error.
I reinstall ocilib from bash.
When compile and run demo obtain a core dumped


```
bash-3.2# gcc -DOCI_IMPORT_LINKAGE -DOCI_CHARSET_ANSI -I/usr/compat/linux/usr/include -L/usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib -lclntsh -L/usr/local/lib -locilib -L/usr/compat/linux/usr/lib  ocilib_demo.c  -o ocilib_demo
/usr/bin/ld: warning: libc.so.6, needed by /usr/compat/linux/usr/lib/oracle/10.2.0.3/client/lib/libclntsh.so, may conflict with libc.so.7
bash-3.2# ./ocilib_demo
Segmentation fault (core dumped)
bash-3.2#
```


----------



## richardpl (Apr 23, 2009)

So you are trying to compile it using linux emulation.
For that you will need to first set up linux jail inside FreeBSD. (but I doubt how this could be usefull)

Either use binaries for Linux or port whole stuff to FreeBSD.


----------



## frankit60 (Apr 24, 2009)

richardpl said:
			
		

> ....
> Either use binaries for Linux or port whole stuff to FreeBSD.


I can not port oracle instantclient to FreeBSD 
I try to use libocilib.so compiled in linux that the author sendme.
I need only to brandelf library?


----------



## SirDice (Apr 24, 2009)

Mind you I've never developed...

This may provide a little more information about cross developing, it does look a bit outdated though..

http://wiki.freebsd.org/linux-xdev


----------

