LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Linker error in cross compiling foomatic filter (https://www.linuxquestions.org/questions/linux-software-2/linker-error-in-cross-compiling-foomatic-filter-733851/)

siva4ever 06-18-2009 05:06 AM

Linker error in cross compiling foomatic filter
 
Hi all,

I want cross compile foomatic-filters-4.0.1 source on 2.6.26.3-olimex kernel.

I am getting some linker errors during cross compilation. I have listed them below.

pdf.o: In function `render_pages':
pdf.c:(.text+0x3e4): undefined reference to `gsapi_new_instance'
pdf.c:(.text+0x44c): undefined reference to `gsapi_set_stdio'
pdf.c:(.text+0x460): undefined reference to `gsapi_init_with_args'
pdf.c:(.text+0x470): undefined reference to `gsapi_exit'
pdf.c:(.text+0x478): undefined reference to `gsapi_delete_instance'
collect2: ld returned 1 exit status
make[1]: *** [foomatic-rip] Error 1

Can any one help me to solve this errors?

knudfl 06-18-2009 07:49 AM

" undefined reference to <gsapi--objects>" in 'libgssapi.so'
from the package 1) rpm systems : libgssapi2-devel ,
libgssapi-devel.
2) .deb = Debian, Ubuntu etc. systems : heimdal-dev
( Debian Etch and older Ubuntu : libgssapi-dev )

Find the source code, and cross compile it for the target.
E.g. libgssapi_0.10.orig.tar.gz,
libgssapi-0.11-4.fc10.src.rpm, libgssapi-0.11.tar.gz.

( You will need libgs (-devel ) too, cross compiled.)
( > > e.g. source = ghostscript-8.61.tar.gz )
.....
.....
It is a good idea to make a test compile for the host
first, to see, how things work, then you will know,
which packages are needed for the cross compiling.
.....

siva4ever 06-19-2009 01:47 AM

Thanks for your reply.

I have downloaded and successfully cross compiled libgssapi-0.11 source.

Then I have downloaded GhostScript-8.62 source. I am getting some linker errors while cross compiling this GhostScript-8.62 source.

./configure --host=arm-unknown-linux-gnu --target=arm-unknown-linux-gnu --build=i686-pc-linux-gnu --prefix=/home/siva/#Desktop/Printer/ --with-includes=/usr/include --enable-threads --without-omni --without-x

/home/siva/Desktop/opt/crosstool/gcc-4.0.1-glibc-2.3.5/arm-unknown-linux-gnu/bin/../lib/gcc/arm-unknown-linux-gnu/4.0.1/../../../../arm-unknown-linux-gnu/bin/ld: ./obj/gs.o: Relocations in generic ELF (EM: 3)
./obj/gs.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [bin/gs] Error 1

Have I missed something?

Can you help me to solve this?

knudfl 06-19-2009 09:53 AM

Quote:

./configure --host=arm-unknown-linux-gnu --target=arm-unknown-linux-gnu --build=i686-pc-linux-gnu --prefix=/home/siva/#Desktop/Printer/ --with-includes=/usr/include --enable-threads --without-omni --without-x
--with-includes=/usr/include will probably mean,
that you are also linking to libs in /usr/lib/ ? ?
If so, you will get the error : 'File in wrong format'.

To link only against libs compiled for arm, please start all
terminal sessions with :
export LD_LIBRARY_PATH=$PATH:/opt/armlibs:/usr/local/armlibs:..etc.
( Please replace everything with actual path.)
The 'export LD_LIBRARY_PATH...' means : only these path's
will be used.
The system PATH:/lib:/usr/lib:/usr/local/lib ... : not used
for this terminal session.
.....
.....
Example ghostscript compiled for arm
http://packages.debian.org/lenny/arm/libgs8/filelist
http://packages.debian.org/lenny/libgs8
And see that it has about 10 dependencies, which again
have about 12 dependencies.
So unless you can use some of these arm libs, you will
have to cross compile a lot of files for ghostscript.

Remark : The mentioned libgs8 is for libc-2.7 or later.
.....
If you want to use some files from Debian packages,
unpack with : ar -x <package.deb>
.....

siva4ever 06-23-2009 04:17 AM

I have added arm libraries path. But this time I getting some strange errors pasted below.

/bin/bash: error while loading shared libraries: /home/siva/Desktop/opt/crosstool/gcc-4.0.1-glibc-2.3.5/arm-unknown-linux-gnu/arm-unknown-linux-gnu/lib/libdl.so.2: ELF file OS ABI invalid

I have pasted my script file below.

PATH=/home/siva/Desktop/opt/crosstool/gcc-4.0.1-glibc-2.3.5/arm-unknown-linux-gnu/bin:$PATH

export LD_LIBRARY_PATH=/home/siva/Desktop/opt/crosstool/gcc-4.0.1-glibc-2.3.5/arm-unknown-linux-gnu/arm-unknown-linux-gnu/lib:$PATH

export AR=arm-unknown-linux-gnu-ar
export CC=arm-unknown-linux-gnu-gcc
export LD=arm-unknown-linux-gnu-ld
export STRIP=arm-unknown-linux-gnu-strip
export RANLIB=arm-unknown-linux-gnu-ranlib
export CXX=arm-unknown-linux-gnu-c++

./configure --host=i686-pc-linux-gnu --target=arm-unknown-linux-gnu --build=i686-pc-linux-gnu --prefix=/home/siva/Desktop/Printer/ --enable-threads --without-omni --without-x && make

Have I misunderstood or missed something?

knudfl 06-26-2009 04:26 PM

" --build=i686-pc-linux-gnu " is definitely wrong,
you are not building for i686.

--host=i686-pc-linux-gnu, --target=arm-unknown-linux-gnu
may be harmless, but of no use ?.
The build takes place in an environment, where nothing
else but "arm files" exists ? All the path settings etc.
should take care of that.

Suggest : ./configure CC=<path-to>/arm-unknown-linux-gnu-gcc
etc. etc. ....
or : CC="arm-unknown-linux-gnu-gcc -B<path-to>" ./configure
etc.
.....

siva4ever 06-29-2009 12:55 AM

I have used "--host=i686-pc-linux-gnu --target=arm-unknown-linux" and I have given actual path for all the compiler tools ex."CC=/home/siva/Desktop/opt/crosstool/gcc-4.0.1-glibc-2.3.5/arm-unknown-linux-gnu/bin/arm-unknown-linux-gnu-gcc".

Still I am getting the below errors.

/home/siva/Desktop/opt/crosstool/gcc-4.0.1-glibc-2.3.5/arm-unknown-linux-gnu/bin/arm-unknown-linux-gnu-gcc -Wall -Wstrict-prototypes -Wundef -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings -Wno-strict-aliasing -fno-builtin -fno-common -DHAVE_STDINT_H -DGX_COLOR_INDEX_TYPE="unsigned long long" -I./src -o ./obj/genconf ./src/genconf.c
/home/siva/Desktop/opt/crosstool/gcc-4.0.1-glibc-2.3.5/arm-unknown-linux-gnu/bin/arm-unknown-linux-gnu-gcc -Wall -Wstrict-prototypes -Wundef -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings -Wno-strict-aliasing -fno-builtin -fno-common -DHAVE_STDINT_H -DGX_COLOR_INDEX_TYPE="unsigned long long" -I./src -o ./obj/echogs ./src/echogs.c
./obj/echogs -w ./obj/devs.tr - -include ./obj/unix_
./obj/echogs: 1: Syntax error: word unexpected (expecting ")")
make: *** [obj/devs.tr] Error 2

I think GhostScript-.62 tried to run ARM binary "./obj/echogs" in X86 machine.

Do you have any idea on the above errors and the How to solve them?

greeneagle 08-28-2009 09:04 AM

Quote:

Originally Posted by siva4ever (Post 3589559)
./obj/echogs: 1: Syntax error: word unexpected (expecting ")")

Very late reply but I've seen a few threads on ther internet without a proper solution for this particular error.

This error ("line 1: syntax error: word unexpected (expecting ")")") is misleading.
It leads one initially to suspect a scripting error.
It can because of trying to run an incompatible (maybe elf64, maybe for a different platform) binary on an elf32 platform (x86/i386).

It is quite like the misleading error you get in solaris 32bit or 64bit "Invalid argument" if trying to run an incompatible binary.

timluo 11-13-2009 12:45 AM

Hi siva4ever

have you solved the problem?

i'm trying to cross-compile the GhostScript and Foomatic into ARM embedded linux.

I read the manual from GhostScript website for cross-compile. but it's too general for me. couldn't follow it.

http://pages.cs.wisc.edu/~ghost/doc/cvs/Make.htm


about:
Quote:

line 1: syntax error: word unexpected (expecting ")")"
greeneagle is right. Just one tip:
Code:

file /path/to/gs
there it's able to see what kind of file it is, and what architecture it is compiled on.

thanks
tim

siva4ever 01-08-2010 07:35 AM

Linker error in cross compiling foomatic filter
 
Hi Tim,

I have not yet solved that problem.

It is trying to run ARM elf32 on X86 which causes the error.

Can you help me to get rid of this error?

Thanks,
Siva

timluo 01-09-2010 03:43 AM

I only know it is possible to use QEMU to simulate and run ARM elf32 executable file on x86.
but i don't know whether it helps to solve your problem or not.

rgds,
tim


All times are GMT -5. The time now is 06:51 PM.