LinuxQuestions.org
Visit Jeremy's Blog.
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 07-01-2021, 08:31 PM   #1
coltson
Member
 
Registered: Oct 2010
Posts: 149

Rep: Reputation: 3
32Bit dynamic library is actually static


Hello. I recently built the Alsa library. Usually it creates both static and dynamic versions of it. When I built a 64bit version, it worked as expected. However this time I built a 32bit version.

As soon as the building and installing processes were done, I notice that the install folder size of was much smaller than the 64bi version (1.6mb against 4.7mb). So something went wrong. Investigating al ittle more, I executed ldd on ibasound.so. And the result?
Code:
not a dynamic executable
Obviously it should show something like the 64bit version shows:

Code:
linux-vdso.so.1 =>  (0x00007fffc03ff000)
	libm.so.6 => /lib/libm.so.6 (0x00007fd779958000)
	libdl.so.2 => /lib/libdl.so.2 (0x00007fd779754000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x00007fd779536000)
	librt.so.1 => /lib/librt.so.1 (0x00007fd77932e000)
	libc.so.6 => /lib/libc.so.6 (0x00007fd778fab000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fd779ed1000)
The overall reason behind this weird behavior is also quite obvious> I am adding 32bit from the scratch to my system, piece by piece. First I compiled a gcc with 32bit support, installed it in some non default dir, removed the old gcc and then created symbolic links to the new on
Code:
/usr/local/bin
After that, I created a dir called /usr/lib32 and then I created a sym link to the 32bit version of libstdc++ on it.

More or less about the same time, I also compiled and installed in a non default dir, a 32bit version of glibc

Then I finally went to compile a 32bit version of alsa. First, configure complained about incompatible version of libc.a and libc.so. I then created symbolic links to the 32bit version of them on
Code:
/usr/lib32
. It then complained about some files:
Code:
crt1.0 crti.o crtn.o
I did the same for them. Finally, it complained about
Code:
libm.a
and
Code:
libm.so
, probably the same complains related to libc. Once more, solved them with more sym links.

Finally, I was able to create it with
Code:
CPPFLAGS=-m32 CFLAGS=-m32 LDFLAGS=-m32 ./configure --prefix=/media/34GB/Arquivos-de-Programas-Linux/Alsa-1.0.17-32/ --host=i386-linux-gnu
However, obviously, something was missing. Perhaps the loader had to be the one of the 32bit libc? What else can be?
 
Old 07-01-2021, 09:41 PM   #2
ordealbyfire83
Member
 
Registered: Oct 2006
Location: Leiden, Netherlands
Distribution: LFS, Ubuntu Hardy
Posts: 302

Rep: Reputation: 89
So if I understand right, you built a cross-compiler and used that to compile alsa? What if you use the cross compiler to build a native 32-bit gcc, and then use that to build whatever you're trying to build?

Otherwise, when you cross-compile, you really need to watch the --build --host --target options. Also, a lot of configure scripts use the output of uname to detect your architecture. You might have to temporarily spoof uname to say something else.
 
  


Reply

Tags
32bit, compilation, linker, make



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
[SOLVED] Linking static library INTO dynamic library miguelg Programming 6 12-10-2012 09:56 AM
Fedora 13 32bit and then Linux Mint 32bit and then Ubuntu 10.04 32bit ciao303 Linux - Newbie 3 08-09-2010 11:03 PM
How can we convert a dynamic library (filename.so) to a static library (filename.a). hanumaan Programming 4 11-20-2009 12:07 AM
LINUX - linking archive (static library) with shared (dynamic) library gurkama Programming 5 03-04-2007 11:11 PM

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

All times are GMT -5. The time now is 07:41 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