LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-11-2011, 07:35 PM   #1
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Compiling 32-bit SDL on a 64-bit machine


How do I compile a 32-bit version of SDL so that 32-bit applications will use it? The reason I want to do this is because the version in the Arch repository isn't the newest, and doesn't directly support PulseAudio. I'm hoping that this will fix some issues I'm having.
 
Old 08-12-2011, 11:58 AM   #2
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Hello MTK358,

I cannot answer your question, but the documentation for CLFS (Cross-Linux-From-Scratch) is known to be excellent: http://trac.cross-lfs.org/

hope this helps

Markus
 
Old 08-12-2011, 12:16 PM   #3
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Just to be clear, I'm not compiling for another 32-bit machine, I'm compiling them to run in this one (which has multilib installed) so that 32-bit applications running on it will use the library I compiled.

Is the link you posted still relavent for this?
 
Old 08-12-2011, 12:19 PM   #4
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
You may look at AlienBobs multilib-packages for Slackware. They provide to compile packages for 32-bit machines: http://alien.slackbook.org/dokuwiki/...kware:multilib
There may be explanations which point you in the right direction.

Markus
 
Old 08-12-2011, 01:18 PM   #5
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
That doesn't explain how to compile 32-bit compatibility packages, but how to use Slackware-specific tools to convert 32-bit Slackware packages into 32-bit compatibility packages for a multilib system.

I guess I could modify the 32-bit Arch packages in a similar way, but Arch works differently: it has /usr/lib and /usr/lib32, not /usr/lib64 and /usr/lib.

Also, I see that SDL is split into multiple packages, such as sdl_image, sdl_mixer, etc.. When I compile the SDL package downloaded for the SDL website, does it come with all of these? Will just running "make install" install all of them?
 
Old 08-12-2011, 02:36 PM   #6
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
You could as well install Arch 32bit in a virtual machine and use this for package building.

Markus
 
Old 08-12-2011, 02:43 PM   #7
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by markush View Post
You could as well install Arch 32bit in a virtual machine and use this for package building.
AFAIK, 32-bit Arch puts 32-bit libraries into /usr/lib, and 64-bit Arch puts 64-bit libraries into /usr/lib.

Another thing I wanted to ask:

Code:
$ env | egrep 'LD|LIB'
TK_LIBRARY=/usr/lib
TIX_LIBRARY=
LIBGL_DRIVERS_PATH=/usr/lib/xorg/modules/dri/
LD_LIBRARY_PATH=/opt/opencascade/lib:/home/michael/GNUstep/Library/Libraries:/usr/lib
TCL_LIBRARY=/usr/lib
TCLLIBPATH=/usr/lib
LIBRARY_COMBO=gnu-gnu-gnu
ITK_LIBRARY=/usr/lib
ITCL_LIBRARY=/usr/lib
I see that LD_LIBRARY_PATH contains paths to 64-bit libraries, but there is nothing that says where 32-bit libraries are. How does it know where to get the libraries if I start a 32-bit application that uses shared libraries?
 
Old 08-12-2011, 03:09 PM   #8
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
When I look at the Arch-Wiki https://wiki.archlinux.org/index.php...side_Arch64.3F I understand that they have a similar approach as AlienBob's multilib for Slackware. I'm not a programmer, but hopfully you'll find an answer to your question in the link.

Markus
 
Old 08-12-2011, 04:03 PM   #9
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by markush View Post
When I look at the Arch-Wiki https://wiki.archlinux.org/index.php...side_Arch64.3F I understand that they have a similar approach as AlienBob's multilib for Slackware. I'm not a programmer, but hopfully you'll find an answer to your question in the link.
That link talks about having basically a separate 32-bit system that you can chroot into in a directory under your 64-bit system (https://wiki.archlinux.org/index.php...d_32bit_system), not about multilib.

I think I'll report this thread to be moved to the Programming forum.

Last edited by MTK358; 08-12-2011 at 04:05 PM.
 
Old 08-12-2011, 04:20 PM   #10
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
MTK358,

While compiling is often part of writing s/w, it can also be part of the installation process. That is the case here. I don't think Programming is the right home for this thread, especially since you are getting answers here.
 
Old 08-12-2011, 04:25 PM   #11
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Quote:
Originally Posted by archtoad6 View Post
...
especially since you are getting answers here.
Well, he's only got answers from me, but I'm not a programmer and did not really get the question.

And I'm not sure as well if it is a programming-question or not. Actually it is more distribution-specific, but the Arch-forum here at LQ has not that much frequency. Maybe an Arch-only forum would be a better place for this question.

@MTK358: good luck

Markus
 
Old 08-12-2011, 05:38 PM   #12
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Moved to programming @ OPs request.
 
Old 08-13-2011, 01:33 PM   #13
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
I wrote this PKGBUILD:

Code:
pkgname=lib32-sdl
pkgver=1.2.14
pkgrel=1
arch=(x86_64)
url="http://www.libsdl.org"
source=("http://www.libsdl.org/release/SDL-${pkgver}.tar.gz")
sha1sums=(ba625b4b404589b97e92d7acd165992debe576dd)

build() {
    cd "$srcdir/SDL-$pkgver"
    CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 ./configure --prefix=/usr
    CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 make
    make DESTDIR="$pkgdir" install

    # rename /usr/lib to /usr/lib32 and delete everything else
    mv "$pkgdir/usr/lib" "$pkgdir/lib32"
    rm -r "$pkgdir/usr/*"
    mv "$pkgdir/lib32" "$pkgdir/usr"
}
But when I run makepkg, it prints this error message and quits:

Code:
./src/video/SDL_RLEaccel.c: Assembler messages:
./src/video/SDL_RLEaccel.c:831: Error: unsupported for `movq'
./src/video/SDL_RLEaccel.c:831: Error: unsupported for `movq'
./src/video/SDL_RLEaccel.c:831: Error: unsupported for `movq'
./src/video/SDL_RLEaccel.c:831: Error: unsupported for `movq'
./src/video/SDL_RLEaccel.c:930: Error: unsupported for `movq'
./src/video/SDL_RLEaccel.c:930: Error: unsupported for `movq'
./src/video/SDL_RLEaccel.c:930: Error: unsupported for `movq'
./src/video/SDL_RLEaccel.c:930: Error: unsupported for `movq'
make: *** [build/SDL_RLEaccel.lo] Error 1
==> ERROR: A failure occurred in build().
    Aborting...
How do I fix it?

And two other questions:

How do I find out the dependencies so that I can put them in the PKGBUILD?

Will the package created by this PKGBUILD be equivanent to installing just the "sdl" package, or the "sdl" package and all of the "sdl_*" (i.e. sdl_image, sdl_mixer, etc.) packages?

Last edited by MTK358; 08-13-2011 at 01:35 PM.
 
Old 08-13-2011, 02:00 PM   #14
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,979

Rep: Reputation: Disabled
Hi MTK358,

I'm playing a bit with Arch

I've installed x86_64 with multilib. I get the same error when using your PKGBUILD, but it compiles properly when using .configure && make in the sources. I suppose you have a mistake in the CFLAGS or LDFLAGS.

Markus
 
Old 08-13-2011, 02:06 PM   #15
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by markush View Post
it compiles properly when using .configure && make in the sources. I suppose you have a mistake in the CFLAGS or LDFLAGS.
Do you mean this:

Code:
./configure
make
or this:

Code:
CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 ./configure
CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 make
?

Note that if I remove all those variables from the ./configure line (but still leave them on the make line), it compiles successfully, but file says that the resulting libraries are 64-bit.

Last edited by MTK358; 08-13-2011 at 02:08 PM.
 
  


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
Can we install ubuntu AMD 64 bit on intel 64 bit machine ervaneet82 Linux - General 2 11-11-2010 04:40 PM
[SOLVED] Red Hat Enterprise Desktop 5.3 on 64 bit machine need 32-bit library file hhs1982 Linux - Newbie 4 06-29-2010 11:55 AM
compiling 32 bit kernel on 64 bit machine ashraf.qadir Linux - Newbie 2 09-22-2009 06:16 AM
Unable to compile 64 bit kernel on 64 bit machine even after successful compilation. atulsdeshmukh Linux - Kernel 2 09-18-2009 02:28 AM
Help with compiling rdesktop on a 64 bit machine OmnipotentOscar Linux - Newbie 1 01-18-2005 10:16 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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