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 12-18-2009, 05:58 AM   #1
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,321

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
libv4l-0.1 compiule problem


Hi. I grabbed the latest source, compiled it for 64 bit, made clean and then wanted a 32 bit version. The site
http://hansdegoede.livejournal.com/7622.html gives this line

make PREFIX=/usr CFLAGS=-m32 LDFLAGS=-m32

That failed for the lack of libv4lconvert.h (in ../include). A symlink fixed that. Now I get this

Code:
gcc -fpic -m32 -o libv4lconvert/spca501.o -c libv4lconvert/spca501.c
gcc -fpic -m32 -o libv4lconvert/bayer.o -c libv4lconvert/bayer.c
gcc -m32 -Wl,-soname,libv4lconvert.so.0 -o lib/libv4lconvert.so.0 libv4lconvert/libv4lconvert.o libv4lconvert/tinyjpeg.o libv4lconvert/jidctflt.o libv4lconvert/spca561-decompress.o libv4lconvert/rgbyuv.o libv4lconvert/spca501.o libv4lconvert/bayer.o
/usr/lib64/gcc/x86_64-slamd64-linux/4.2.4/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [lib/libv4lconvert.so.0] Error 1
which, at a guess, is glibc related My installed glibc stuff is
Code:
 bash-3.1$ ls /var/log/packages/glibc*
/var/log/packages/glibc-2.7-x86_64_slamd64-9	      /var/log/packages/glibc-solibs-2.7-x86_64_slamd64-9
/var/log/packages/glibc-i18n-2.7-noarch_slamd64-9     /var/log/packages/glibc-zoneinfo-2.7-noarch_slamd64-9
/var/log/packages/glibc-profile-2.7-x86_64_slamd64-9  /var/log/packages/glibc32-2.7-x86_64_slamd64-9
Any ideas please? I do seem to have a 32bit compat library there.

Edit: /usr/lib64/gcc/x86_64-slamd64-linux/4.2.4/../../../../lib/crt1.o actually exists, is 32 bit and has a function called 'main' according to readelf :-o.

Last edited by business_kid; 12-18-2009 at 07:44 AM. Reason: missing data
 
Old 12-18-2009, 10:07 AM   #2
JohnGraham
Member
 
Registered: Oct 2009
Posts: 467

Rep: Reputation: 139Reputation: 139
Quote:
Originally Posted by business_kid View Post
Code:
gcc -fpic -m32 -o libv4lconvert/spca501.o -c libv4lconvert/spca501.c
gcc -fpic -m32 -o libv4lconvert/bayer.o -c libv4lconvert/bayer.c
gcc -m32 -Wl,-soname,libv4lconvert.so.0 -o lib/libv4lconvert.so.0 libv4lconvert/libv4lconvert.o libv4lconvert/tinyjpeg.o libv4lconvert/jidctflt.o libv4lconvert/spca561-decompress.o libv4lconvert/rgbyuv.o libv4lconvert/spca501.o libv4lconvert/bayer.o
/usr/lib64/gcc/x86_64-slamd64-linux/4.2.4/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [lib/libv4lconvert.so.0] Error 1
Edit: /usr/lib64/gcc/x86_64-slamd64-linux/4.2.4/../../../../lib/crt1.o actually exists, is 32 bit and has a function called 'main' according to readelf :-o.
First, if crt1.o really does have a *defined* symbol called 'main' then something is very, very wrong! If you look closely you should see that it uses a symbol called main - readelf will give you a list of symbols the object file uses as well as ones it defines.

Second, your problem is that the -shared flag isn't specified in the gcc command to create the .so library.
 
Old 12-19-2009, 03:24 AM   #3
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,321

Original Poster
Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Thanks for the reply John. Adding the shared flag to CFLAGS and LDFLAGS allowed it to compile. Thank heavens for search options in a man page!

Just FYI Here's what ctrl.o shows from readelf
Code:
There are no program headers in this file.

Relocation section '.rel.text' at offset 0x49c contains 4 entries:
 Offset     Info    Type            Sym.Value  Sym. Name
0000000c  00000a01 R_386_32          00000000   __libc_csu_fini
00000011  00000c01 R_386_32          00000000   __libc_csu_init
00000018  00000d01 R_386_32          00000000   main
0000001d  00001002 R_386_PC32        00000000   __libc_start_main
 
Old 12-19-2009, 09:57 AM   #4
JohnGraham
Member
 
Registered: Oct 2009
Posts: 467

Rep: Reputation: 139Reputation: 139
Ah - don't know what option you're passing to readelf, but if you use --symbols you'll get output like:

Code:
Symbol table '.symtab' contains 25 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
...
    20: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND main
Which shows the symbol main to be UND (undefined). A simpler program with simpler output is nm if you just want to look at which symbols there are:

Code:
$ nm /usr/lib/crt1.o
00000000 R _IO_stdin_used
00000000 D __data_start
         U __libc_csu_fini
         U __libc_csu_init
         U __libc_start_main
00000000 R _fp_hw
00000000 T _start
00000000 W data_start
         U main
Where 'U' means undefined - you can also just pass it --defined to look at what that .o/.a/.so file defines.
 
Old 12-20-2009, 02:52 AM   #5
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,321

Original Poster
Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Thx. I passed readelf the '-a'. I'm not a programmer, but an LFS builder, so one gets fairly competent at failed compiles without fully knowing what is going on.
 
  


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
libv4l will not compile. tethysgods Linux - Software 3 04-05-2009 07:52 AM
Sound Card problem(every time i install linux i have diffirent hardware problem) jacka1l Linux - Newbie 7 08-11-2005 06:10 AM
Lan configuration problem - NFS boot problem - RX&TX packets errors 242VDM242 Linux - Networking 4 11-25-2004 01:35 PM
perl problem? apache problem? cgi problem? WorldBuilder Linux - Software 1 09-17-2003 07:45 PM
Not as much of a Solaris problem rether hardware Ultra 10 problem (video card) neo77777 Solaris / OpenSolaris 7 06-24-2003 08:36 PM

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

All times are GMT -5. The time now is 12:01 PM.

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