Slackware This Forum is for the discussion of Slackware Linux.
|
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
10-01-2005, 09:28 PM
|
#1
|
|
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:
|
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,
|
|
|
|
10-01-2005, 10:47 PM
|
#2
|
|
Member
Registered: May 2004
Location: South Carolina
Distribution: Slackware 11.0
Posts: 606
Rep:
|
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
|
|
|
|
10-02-2005, 12:36 AM
|
#3
|
|
Member
Registered: Jun 2004
Distribution: Slackware
Posts: 155
Rep:
|
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.
|
|
|
|
10-02-2005, 09:24 PM
|
#4
|
|
Senior Member
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721
Rep:
|
------------
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
|
|
|
|
10-02-2005, 10:24 PM
|
#5
|
|
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:
|
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. 
|
|
|
|
10-03-2005, 12:43 AM
|
#6
|
|
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,589
|
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.
|
|
|
|
10-03-2005, 10:16 AM
|
#7
|
|
Senior Member
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721
Rep:
|
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
|
|
|
|
10-03-2005, 01:55 PM
|
#8
|
|
Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
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.
|
|
|
|
10-03-2005, 02:25 PM
|
#9
|
|
Senior Member
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721
Rep:
|
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
|
|
|
|
10-03-2005, 02:30 PM
|
#10
|
|
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:
|
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"?
|
|
|
|
10-03-2005, 03:45 PM
|
#11
|
|
Senior Member
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721
Rep:
|
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.
|
|
|
|
10-03-2005, 03:48 PM
|
#12
|
|
Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
AWESOME LINK DUDE. THANX.
Last edited by win32sux; 10-03-2005 at 04:00 PM.
|
|
|
|
10-03-2005, 04:06 PM
|
#13
|
|
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:
|
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.
|
|
|
|
10-03-2005, 04:15 PM
|
#14
|
|
Guru
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870
|
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. 
|
|
|
|
10-03-2005, 04:29 PM
|
#15
|
|
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:
|
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?
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:51 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|