LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-18-2009, 05:06 AM   #1
siva4ever
LQ Newbie
 
Registered: Jun 2009
Posts: 12

Rep: Reputation: 0
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?
 
Old 06-18-2009, 07:49 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
" 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.
.....

Last edited by knudfl; 06-18-2009 at 08:15 AM.
 
Old 06-19-2009, 01:47 AM   #3
siva4ever
LQ Newbie
 
Registered: Jun 2009
Posts: 12

Original Poster
Rep: Reputation: 0
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?
 
Old 06-19-2009, 09:53 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
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>
.....

Last edited by knudfl; 06-19-2009 at 10:00 AM.
 
Old 06-23-2009, 04:17 AM   #5
siva4ever
LQ Newbie
 
Registered: Jun 2009
Posts: 12

Original Poster
Rep: Reputation: 0
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?
 
Old 06-26-2009, 04:26 PM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,513

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
" --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.
.....
 
Old 06-29-2009, 12:55 AM   #7
siva4ever
LQ Newbie
 
Registered: Jun 2009
Posts: 12

Original Poster
Rep: Reputation: 0
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?
 
Old 08-28-2009, 09:04 AM   #8
greeneagle
Member
 
Registered: Dec 2004
Location: Dublin Ireland via Cobh, Limerick.
Distribution: RedHat, Suse, Ubuntu.
Posts: 33

Rep: Reputation: 16
Quote:
Originally Posted by siva4ever View Post
./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.
 
Old 11-13-2009, 12:45 AM   #9
timluo
LQ Newbie
 
Registered: Nov 2009
Distribution: Debian GNU/Linux
Posts: 6

Rep: Reputation: 1
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

Last edited by timluo; 11-13-2009 at 12:47 AM.
 
Old 01-08-2010, 07:35 AM   #10
siva4ever
LQ Newbie
 
Registered: Jun 2009
Posts: 12

Original Poster
Rep: Reputation: 0
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
 
Old 01-09-2010, 03:43 AM   #11
timluo
LQ Newbie
 
Registered: Nov 2009
Distribution: Debian GNU/Linux
Posts: 6

Rep: Reputation: 1
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
 
  


Reply



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
cross-compiling error tamilm Linux - Networking 1 09-16-2008 06:26 PM
Linker Error while compiling gspca module for ARM processor. ravi_chobey Linux - Software 0 07-08-2008 12:19 AM
Linking error while Cross compiling m.harshavardhan Linux - Software 0 07-31-2006 06:08 AM
linker error compiling superkaramba seth_m Linux - General 1 10-15-2003 07:07 PM
Compiling KDE apps, linker error julienp Programming 1 08-07-2003 07:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:54 AM.

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