LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-01-2005, 09:28 PM   #1
shilo
Senior Member
 
Registered: Nov 2002
Location: Stockton, CA
Distribution: Slackware 11 - kernel 2.6.19.1 - Dropline Gnome 2.16.2
Posts: 1,132

Rep: Reputation: 50
SlackBuild / ./configure questions


I have been building my own SlackBuild scripts for several packages. I have a question regarding compiling, especially in regards to compiling for i686.

To start with, I attempt to copy the format of the official SlackBuild scripts in Slackware. In most you see some sections that look like:

Code:
ARCH=${ARCH:-i486}

<SNIP>

if [ "$ARCH" = "i386" ]; then
  SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
elif [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mcpu=i686"
elif [ "$ARCH" = "s390" ]; then
  SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2"
fi

<SNIP>

CFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr
  $ARCH-slackware-linux
make
make install DESTDIR=$PKG
I would like to compile for i686. As such, I have made my SlackBuild scripts look like this:

Code:
ARCH=${ARCH:-i686}

<SNIP>

if [ "$ARCH" = "i386" ]; then
  SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
elif [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mcpu=i686"
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mcpu=i686"
elif [ "$ARCH" = "s390" ]; then
  SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2"
fi

<SNIP>

CFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr
  $ARCH-slackware-linux
make
make install DESTDIR=$PKG
I have not had any issue with this working, but it did bring up two question (possibly related to each other).

First, what does the $ARCH-slackware-linux do? If $ARCH=i686, should I still be using $ARCH-slackware-linux, or should I switch that to i486-slackware-linux?

Secondly, I often get a message when compiling:

Code:
configure: WARNING: you should use --build, --host, --target
checking build system type... i686-slackware-linux-gnu
checking host system type... i686-slackware-linux-gnu
On my system, I see things like /usr/i486-slackware-linux and /usr/lib/gcc-lib/i486-slackware-linux.

How does this all come together? Just looking to understand the compiling process a little better.

Thanks in advance,
 
Old 10-01-2005, 10:47 PM   #2
liquidtenmilion
Member
 
Registered: May 2004
Location: South Carolina
Distribution: Slackware 11.0
Posts: 606

Rep: Reputation: 32
Switch it to i486-slackware-linux as those are actual libraries that are necessary for compiling and running programs in those directories. You can change the march and mcpu/mtune to whatever you want, but you _must_ keep that i486-slackware-linux
 
Old 10-02-2005, 12:36 AM   #3
elyk
Member
 
Registered: Jun 2004
Distribution: Slackware
Posts: 241

Rep: Reputation: 49
Some configure scripts I've seen can be called like this:

./configure [options] [build]

for example you could run "./configure [options] i686-pc-linux-gnu". Other scripts have "build" as one of the options, so instead you would run "./configure [options] --build=i686-pc-linux-gnu".

I have no idea of how these options affect what gets compiled, hopefully someone can explain that.
 
Old 10-02-2005, 09:24 PM   #4
egag
Senior Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721

Rep: Reputation: 53
------------
CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr
$ARCH-slackware-linux
make
make install DESTDIR=$PKG
--------------

shouldn't there be a " \ " after " --prefix=/usr " to make the next line
an argument for " ./configure " ?

i had some thoughts about that and couldn't figure it out,
so there's just a " # " before that line in my scripts.

egag
 
Old 10-02-2005, 10:24 PM   #5
shilo
Senior Member
 
Registered: Nov 2002
Location: Stockton, CA
Distribution: Slackware 11 - kernel 2.6.19.1 - Dropline Gnome 2.16.2
Posts: 1,132

Original Poster
Rep: Reputation: 50
Quote:
Originally posted by liquidtenmilion
you _must_ keep that i486-slackware-linux
Part of the reason for my question. "_must_" is a strong word. It works using $ARCH-slackware-linux.

Quote:
Originally posted by elyk
I have no idea of how these options affect what gets compiled, hopefully someone can explain that.
I'm hoping, too.

Quote:
Originally posted by egag
shouldn't there be a " \ " after " --prefix=/usr " to make the next line
an argument for " ./configure " ?
You are correct. Not an issue in my scripts, I just got sloppy on the post.

Quote:
Originally posted by egag
i had some thoughts about that and couldn't figure it out,
so there's just a " # " before that line in my scripts.
I'm hoping someone has it figured out already and can explain it to us. Then we don't have to comment it out or risk using an improper option.
 
Old 10-03-2005, 12:43 AM   #6
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Yes you need the bacslash so that the line gets used with the ./configure command.

'march' establishes the minimum required architecture. Using a 'bigger' 'mcpu' means that when the software is compiled, if any optimizations are available for the bigger arch, they will be enabled -but still not ruling out running on the lesser architecture. For most software this is not an issue, but there are some key packages that may benefit from this.

The i486-slackware-linux host and target are built into the distro from the groud up. Have a look at the build scripts for GCC and GLIBC. By compiling GLIBC with a 1486-slackware-linux 'target' a separate directory for libraries is created and recognized in the /usr directory. Then, when GCC is compiled by linking to those libraries, each program compiled with this compiler can be aware of those libraries.and their specific location.
 
Old 10-03-2005, 10:16 AM   #7
egag
Senior Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721

Rep: Reputation: 53
the script should look like :

-------------
CFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--target $ARCH-slackware-linux
make
make install DESTDIR=$PKG
--------------
to avoid the WARNING.
( but this warning should also show up when you use original slackbuild scripts )

and to add to gnashley's explanation....

quote from the glibc FAQ----------------
1.18. How can I compile on my fast ix86 machine a working libc for my slow i386? After installing libc, programs abort with "Illegal Instruction".
{AJ} glibc and gcc might generate some instructions on your machine that aren't available on i386. You've got to tell glibc that you're configuring for i386 with adding i386 as your machine, for example:

../configure --prefix=/usr i386-pc-linux-gnu

And you need to tell gcc to only generate i386 code, just add `-mcpu=i386' (just -m386 doesn't work) to your CFLAGS.

{UD} This applies not only to the i386. Compiling on a i686 for any older model will also fail if the above methods are not used.
---------------------

egag
 
Old 10-03-2005, 01:55 PM   #8
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally posted by egag
$ARCH-slackware-linux
i don't understand why a variable is being used here... i mean, don't you need to leave that at "i486-slackware-linux" regardless of what march/mcpu settings you use??

like, for example:
Code:
CFLAGS="-O2 -march=i686 -mcpu=i686" \
./configure --prefix=/usr \
                 i486-slackware-linux



Last edited by win32sux; 10-03-2005 at 01:57 PM.
 
Old 10-03-2005, 02:25 PM   #9
egag
Senior Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721

Rep: Reputation: 53
well...i guess you are right.
i still don't understand how it all works, but " i486-slackware-linux "
should point the compiler to the /usr/i486-slackware-linux dir which
contains some libs and some binaries,
or to /usr/lib/gcc-lib/i486-slackware-linux/
so there's no use to change that to i686-slackware-linux.

egag
 
Old 10-03-2005, 02:30 PM   #10
shilo
Senior Member
 
Registered: Nov 2002
Location: Stockton, CA
Distribution: Slackware 11 - kernel 2.6.19.1 - Dropline Gnome 2.16.2
Posts: 1,132

Original Poster
Rep: Reputation: 50
OK, starting to understand this. My next question that comes up is this:

I see several different methods. Something like:

Code:
CFLAGS="$SLKCFLAGS" \
  ./configure \
  --prefix=/usr \
  $ARCH-slackware-linux
make
make install DESTDIR=$PKG
Which seems to be incorrect when ARCH=i686 (since, as noted by others above, . So we have

Code:
CFLAGS="$SLKCFLAGS" \
  ./configure \
  --prefix=/usr \
  i486-slackware-linux
make
make install DESTDIR=$PKG
Which would seem to be correct for i686.

But what does that mean? I hope this makes sense. What I would like to know, is this the same as:

Code:
CFLAGS="$SLKCFLAGS" \
  ./configure \
  --prefix=/usr \
  --build=i486-slackware-linux
make
make install DESTDIR=$PKG
or

Code:
CFLAGS="$SLKCFLAGS" \
  ./configure \
  --prefix=/usr \
  --target=i486-slackware-linux
make
make install DESTDIR=$PKG
or

Code:
CFLAGS="$SLKCFLAGS" \
  ./configure \
  --prefix=/usr \
  --host=i486-slackware-linux
make
make install DESTDIR=$PKG
To (possibly) make the question more clear: I am compiling on a stock Slackware system. The computer is i686. The package will be for the computer that it is compiled on, only. Does that mean that a correct SlackBuild, if I wish to compile for i686 should look like this:

Code:
CFLAGS="$SLKCFLAGS" \
  ./configure \
  --prefix=/usr \
  --build=i486-slackware-linux \
  --host=i486-slackware-linux \
  --target=i486-slackware-linux 
make
make install DESTDIR=$PKG
Where SLKFLAGS="-O2 -march=i486 -mcpu=i686"?
 
Old 10-03-2005, 03:45 PM   #11
egag
Senior Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721

Rep: Reputation: 53
here is some more info :

http://www.gnu.org/prep/standards/ht...iguration.html

quote----------------
The configure script should also take an argument which specifies the type of system to build the program for. This argument should look like this:

cpu-company-system

For example, an Athlon-based GNU/Linux system might be ‘i686-pc-linux-gnu’.

The configure script needs to be able to decode all plausible alternatives for how to describe a machine. Thus, ‘athlon-pc-gnu/linux’ would be a valid alias. There is a shell script called config.sub that you can use as a subroutine to validate system types and canonicalize aliases.

The configure script should also take the option --build=buildtype, which should be equivalent to a plain buildtype argument. For example, ‘configure --build=i686-pc-linux-gnu’ is equivalent to ‘configure i686-pc-linux-gnu’. When the build type is not specified by an option or argument, the configure script should normally guess it using the shell script config.guess.
----------------------endquote

edit : shouldn't that be : Where SLKFLAGS="-O2 -march=i686 -mcpu=i686" ?
...........................................................................^....................

egag

Last edited by egag; 10-03-2005 at 03:49 PM.
 
Old 10-03-2005, 03:48 PM   #12
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
AWESOME LINK DUDE. THANX.


Last edited by win32sux; 10-03-2005 at 04:00 PM.
 
Old 10-03-2005, 04:06 PM   #13
shilo
Senior Member
 
Registered: Nov 2002
Location: Stockton, CA
Distribution: Slackware 11 - kernel 2.6.19.1 - Dropline Gnome 2.16.2
Posts: 1,132

Original Poster
Rep: Reputation: 50
Quote:
Originally posted by egag


edit : shouldn't that be : Where SLKFLAGS="-O2 -march=i686 -mcpu=i686" ?
...........................................................................^....................

egag
DOH!!! I am the king of typos in this thread.

This was exactly the info I was looking for. So the final thing to understand, then, is the --host and --target, which I assume should also be i486-slackware-linux for any x86 builds.

***EDIT***
Just read the link. So those are only need for cross-compiling. I get it all, now.
***/EDIT***

Last edited by shilo; 10-03-2005 at 04:09 PM.
 
Old 10-03-2005, 04:15 PM   #14
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally posted by shilo
So the final thing to understand, then, is the --host and --target, which I assume should also be i486-slackware-linux for any x86 builds.
that's not the impression i got after reading the link...
Quote:
argument which specifies the type of system to build the program for.
if that's true, then if i wanted to build a binary for a mandrake box on my slackware box i should use a:
Code:
i586-mandrake-linux
or something like that, considering that's the environment i'm building for??

this is confusing.
 
Old 10-03-2005, 04:29 PM   #15
shilo
Senior Member
 
Registered: Nov 2002
Location: Stockton, CA
Distribution: Slackware 11 - kernel 2.6.19.1 - Dropline Gnome 2.16.2
Posts: 1,132

Original Poster
Rep: Reputation: 50
I would think that you would use:

Code:
./configure --build=i586-mandrake-linux \
  --host=i486-slackware-linux \
  --target=i586-mandrake-linux
And you would also have to have the i586-mandrake-linux libraries installed on the Slackware machine.

Is this not correct?
 
  


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
a generic SlackBuild shilo Slackware 46 06-19-2008 11:45 PM
The perfect gtkpod.SlackBuild shilo Slackware 3 08-04-2005 06:31 PM
GNOME.SlackBuild jmdlcar Slackware 1 06-03-2005 04:52 PM
KDE.SlackBuild spaceballs Slackware 8 04-01-2005 08:42 AM
SlackBuild system thegeekster Slackware 7 06-01-2004 06:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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