SlackwareThis 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.
i'm currently on slackware-current (thanks to eric's mirror-slackware-current script ).. anyways, i need to compile qemu & kqemu, which doesn't work with the current gcc (4.x). my question is - will there be any problems (existing file overwritten, etc) if i do installpkg gcc-3.x from pasture? will the existing toolchain still be in 'one piece'? i plan to removepkg once i'm done with compiling those two packages
If those are the only two you need, why can't you just sort out the errors ? Maybe post them ... they are usually trivial ... I mean easy to fix. I know I used gcc-4.x for a while (on FC5), and I had to sort out a lot of problems ... but I sorted out every one ... of course, a little experience with C and C++ helps , but usually the compiler just tells you what to fix and how to fix it (believe it or not).
Last edited by H_TeXMeX_H; 05-28-2007 at 11:34 PM.
It shouldn't be a problem, since gcc is designed to allow several versions to coexist. If you installed gcc-4.1.2 over your old gcc, as I did, you can just: "cd /usr/bin; ln -sf gcc-3.4.6 gcc".
If those are the only two you need, why can't you just sort out the errors ? Maybe post them ... they are usually trivial ... I mean easy to fix. I know I used gcc-4.x for a while (on FC5), and I had to sort out a lot of problems ... but I sorted out every one ... of course, a little experience with C and C++ helps , but usually the compiler just tells you what to fix and how to fix it (believe it or not).
I'm not sure I want to change the original code - and I don't think the errors are fixable without doing that. a './configure' already says I shouldn't compile with 4.x - I tried disabling that check and compile anyways, but obviously, it failed. And I don't believe I've came across anybody who have compiled qemu using gcc-4.x ...
I was actually worried about breaking the original toolchain if I install (and later remove) gcc-3.4.6 ... I guess I can just reinstall 4.1.2 if that happens..
Installing the regular Slackware package for older gcc *will* overwrite somw newer files. This is because Slackware is meant to use just one compiler and installs binaries in /usr.
However, you can re-compile gcc-3.4 using a separate prefix and then create a wrapper for it to put in /usr/bin.
If you only need the qemu and kqemu packages you can install them from Alien's repository.
Actually, I've tried that... I had some problem with the kqemu package but I don't quite remember what it was.. Anyhow, I decided to look into the SlackBuild script and then, I thought I should compile them myself (I did that on Zenwalk 4.2). That's when I realized the 4.x problem
Installing the regular Slackware package for older gcc *will* overwrite somw newer files. This is because Slackware is meant to use just one compiler and installs binaries in /usr.
However, you can re-compile gcc-3.4 using a separate prefix and then create a wrapper for it to put in /usr/bin.
Yeah.. that's an idea! Now why didn't I think of that
Too many files to name. Bad idea installing both side by side unless you use a different prefix for one of them. Installing 3.4.6 from pasture would effectively destroy your gcc-4 install.
I use 4.2 in /usr and 3.4.6 in /opt. Gnashley has the right of it with making a wrapper script. However, you wouldn't want to append to your PATH on a global basis (such as in /etc/profile.d or /etc/profile) because it'll look in the first PATH directory you specify and use that. So if I put Gnashley's script in /etc/profile.d and just compiled something with "make", it'll use 3.4.6....
What I do is similar to a wrapper script. I make an alias in /etc/bashrc..
Code:
alias gcc346='CC=/opt/gcc-3.4.6/bin/gcc'
Then, if I'm compiling something, and wan't to use 3.4.6, I do what Gnashley does... "gcc346 make"
Or, if I'm calling a build script, "gcc346 foobar.SlackBuild"
Also, appending to your library PATH is unecessary because each seperate instance of gcc knows where to find it's own libs, which is why that bit is commented out in Gnashley's script.
Here is a build script if anyone is interested.. I like to make monolithic gcc packages instead of busting it up.
Code:
#!/bin/sh
#
# $CFLAGS are set globaly in /etc/bashrc
CWD=`pwd`
TMP=/tmp
PKGNAME=gcc
PKG=$TMP/package-$PKGNAME
VERSION=3.4.6
PKGVER=${VERSION}
ARCH=i686
BUILD=1
BOOT_CFLAGS="-march=i686 -O2 -pipe"
rm -rf $PKG
mkdir -p $PKG/install
cd $TMP
echo
echo "$PKGNAME-$VERSION source is now extracting..."
rm -rf $PKGNAME-$VERSION
rm -rf $PKGNAME-build
tar xjf $CWD/$PKGNAME-$VERSION.tar.bz2
mkdir $PKGNAME-build
cd $PKGNAME-$VERSION
chown -R root.root .
find . -perm 777 -exec chmod 755 {} \;
find . -perm 775 -exec chmod 755 {} \;
find . -perm 754 -exec chmod 755 {} \;
find . -perm 664 -exec chmod 644 {} \;
# Use libiberty.a from Binutils:
sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
# Prevent the fixincludes script from running & delete debug ref
sed -i.bak \
-e 's,\./fixinc\.sh,-c true,' \
-e '/^LIBGCC2_DEBUG/d' gcc/Makefile.in
cd ../$PKGNAME-build
# See if we should bootstrap or not:
if gcc -dumpversion | grep $VERSION 2>/dev/null 1>/dev/null ;then
bootstrapgcc=no
else
bootstrapgcc=yes
fi
if [ "$CC" = "/opt/gcc-3.4.6/bin/gcc" ]; then
bootstrapgcc=no
fi
if [ "$bootstrapgcc" = "no" ]; then
# rebuilding the same version:
../$PKGNAME-$VERSION/configure --prefix=/opt/$PKGNAME-$VERSION \
--enable-shared \
--disable-multilib \
--disable-bootstrap \
--enable-languages=c,c++ \
--enable-clocale=gnu \
--enable-threads=posix \
--enable-__cxa_atexi
make LDFLAGS="-s"
fi
if [ "$bootstrapgcc" = "yes" ]; then
# upgrading to a new version:
../$PKGNAME-$VERSION/configure --prefix=/opt/$PKGNAME-$VERSION \
--enable-shared \
--disable-multilib \
--enable-languages=c,c++ \
--enable-clocale=gnu \
--enable-threads=posix \
--enable-__cxa_atexit
make LDFLAGS="-s" bootstrap
fi
# Ask the user if they want to run the test suite:
echo
echo "Compilation of $PKGNAME-$VERSION is now done. You might want"
echo "to take the time to review the above output and make sure"
echo "it completed with no errors..."
echo
echo "The GCC test suite is very comprehensive and is almost guaranteed"
echo "to generate a few failures. It also takes quite some time to run..."
echo
echo "Do you wish to test the results? ([y], [n])"
if [ ! "$RESP" ]; then
read RESP;
echo
fi
if [ "$RESP" = "y" ]; then
echo "O.k... Probably not a bad idea..."
echo
runtest=yes
sleep 2
make -k check
fi
if [ "$RESP" = "n" ]; then
echo "Skipping tests..."
echo
sleep 2
fi
make DESTDIR=$PKG install -j1
mkdir -p $PKG/usr/lib
# Should probably keep it where it is and symlink to /usr...
# We really don't have to do this at all actually...
mv $PKG/opt/$PKGNAME-$VERSION/lib/libstdc++.so.6.0.3 $PKG/usr/lib
( cd $PKG/opt/$PKGNAME-$VERSION/lib
ln -sf ../../../usr/lib/libstdc++.so.6.0.3 . )
# Fix info dir
if [ -f $PKG/opt/$PKGNAME-$VERSION/info/dir ]; then
rm $PKG/opt/$PKGNAME-$VERSION/info/dir
fi
# Compress and strip
( cd $PKG/opt/$PKGNAME-$VERSION/man
gzip -9 */*
cd man1
ln -svf g++.1.gz c++.1.gz
ln -svf gcc.1.gz cc.1.gz )
# Redundant becuase of LDFLAGS
( cd $PKG
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null )
find $PKG -name "*.a" | xargs file | grep "archive" | cut -f 1 -d : | xargs strip -g
# Make the package description:
cat << EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler----------------------------------------------------------|
gcc: gcc (GCC with C support)
gcc:
gcc: GCC is the GNU Compiler Collection.
gcc:
gcc: This package contains those parts of the compiler collection needed
gcc: to compile C code.
gcc:
gcc:
gcc:
gcc:
gcc:
EOF
# Build the package:
cd $PKG
makepkg -l y -c n $TMP/$PKGNAME-$PKGVER-$ARCH-$BUILD.tgz
if [ "$runtest" = "yes" ]; then
echo "Here are the test results for GCC-$VERSION"
echo
echo
echo "******************************************************************"
echo "* !!!!!!!!!!!!!!! BEGINNING OF TEST SUMMARY !!!!!!!!!!!!!!!!!! *"
echo "******************************************************************"
echo
echo "If this is the only thing you see, then your missing"
echo "some packages that were needed in order to run the test"
echo "suite. Tcl, Expect and DejaGNU must be installed first..."
echo
cd $TMP/$PKGNAME-build
../$PKGNAME-$VERSION/contrib/test_summary
# For just the brief summaries:
#../$PKGNAME-$VERSION/contrib/test_summary | grep -A7 Summ
echo
echo "******************************************************************"
echo "* !!!!!!!!!!!!!!! END OF TEST SUMMARY !!!!!!!!!!!!!!!!!! *"
echo "******************************************************************"
echo
echo "Package creation complete..."
echo
fi
It installs happily alongside the gcc4 that ships with Slackware-current, and it will not overwrite a thing. The compile of QEMU will pick up this gcc34 and build a good package. All the other software keeps compiling with the standard gcc4.
I have had several people reporting success in using this gcc34 package.
Read the SlackBuild for more information on how you can call the gcc34 binary if you need it.
I just install the wrapper into /usr/bin for simplicity -it allows me to distribute a safely installable package that doesn't require you to edit/create any config files, such as .bashrc, etc.
I include the LD_LIBRARY_PATH, but commented out, in case a user needs it. I've found a few situations where it was needed, such as when compiling with gcc-2.95.3(for programs that link to the gcclib) or mingW32 or other cross-compiler.
One more thing, have you tried the cvs snapshots of qemu ... maybe they got it working with the newer gcc ... they should have after all this time it has been out.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.