LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 05-28-2007, 10:43 PM   #1
lordwolf
Member
 
Registered: May 2007
Distribution: Slackware
Posts: 44

Rep: Reputation: 15
install gcc-3.4.6 in slackware-current


hi everbody..

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

thanks.
 
Old 05-28-2007, 11:32 PM   #2
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
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.
 
Old 05-29-2007, 12:23 AM   #3
GregLee
Member
 
Registered: Feb 2004
Location: Waimanalo, HI
Distribution: Slackware 10, Fedora 6
Posts: 308

Rep: Reputation: 30
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".
 
Old 05-29-2007, 01:14 AM   #4
Zmyrgel
Senior Member
 
Registered: Dec 2005
Location: Finland
Distribution: Slackware, CentOS, RHEL, OpenBSD
Posts: 1,006

Rep: Reputation: 36
If you only need the qemu and kqemu packages you can install them from Alien's repository.
 
Old 05-29-2007, 01:42 AM   #5
lordwolf
Member
 
Registered: May 2007
Distribution: Slackware
Posts: 44

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by H_TeXMeX_H
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..
 
Old 05-29-2007, 01:44 AM   #6
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,768

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
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.
 
Old 05-29-2007, 01:48 AM   #7
lordwolf
Member
 
Registered: May 2007
Distribution: Slackware
Posts: 44

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Zmyrgel
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
 
Old 05-29-2007, 01:52 AM   #8
lordwolf
Member
 
Registered: May 2007
Distribution: Slackware
Posts: 44

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by gnashley
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
 
Old 05-29-2007, 04:00 AM   #9
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,768

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
I use several alternative compilers, usually placing them in /opt, but usr/gcc-3.4.6 would be just as safe.
Here's the wrapper I use to run gcc-3.3.6:

#!/bin/sh
PATH=/opt/gcc-3.3.6/bin:$PATH
export PATH=/opt/gcc-3.3.6/lib/gcc-lib/i486-slackware-linux/3.3.6:$PATH
# export LD_LIBRARY_PATH=/opt/gcc-3.3.6/lib
exec "$@"

I name this script GCC336 and place it in /usr/bin. Then to use it instead of the regular compiler just type:
GCC336 make
 
Old 05-29-2007, 11:10 AM   #10
GregLee
Member
 
Registered: Feb 2004
Location: Waimanalo, HI
Distribution: Slackware 10, Fedora 6
Posts: 308

Rep: Reputation: 30
Quote:
Originally Posted by gnashley
Installing the regular Slackware package for older gcc *will* overwrite somw newer files.
It will? Other than the soft link /usr/bin/gcc and /usr/bin/cpp, could you name any files that will be overwritten?
 
Old 05-29-2007, 12:03 PM   #11
jong357
Senior Member
 
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Rep: Reputation: 52
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

Last edited by jong357; 05-29-2007 at 02:57 PM.
 
Old 05-29-2007, 12:12 PM   #12
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 5,311

Rep: Reputation: Disabled
Alternatively you can install my gcc34 "compatibility" package from here: http://www.slackware.com/~alien/slackbuilds/gcc34/

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.

Eric
 
Old 05-29-2007, 12:23 PM   #13
GregLee
Member
 
Registered: Feb 2004
Location: Waimanalo, HI
Distribution: Slackware 10, Fedora 6
Posts: 308

Rep: Reputation: 30
Quote:
Originally Posted by jong357
Too many files to name.
I didn't ask you to name them all. How about naming two?
 
Old 05-29-2007, 12:26 PM   #14
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,768

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
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.
 
Old 05-29-2007, 12:27 PM   #15
H_TeXMeX_H
Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269Reputation: 1269
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.
 
  


Reply

Tags
compiler, gcc


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
install Slackware-Current from scratch arnuld Slackware - Installation 12 05-02-2007 12:53 PM
Install From Slackware current AxXium Slackware 5 05-21-2005 03:02 PM
Can't install slackware-current elyk Slackware - Installation 3 01-19-2005 11:19 PM
Slackware current + gcc issue vexer Slackware 2 08-11-2003 12:05 PM
Slackware-current: promlem with 'install' or 'ginstall'? hjles Slackware 0 06-03-2003 12:39 PM


All times are GMT -5. The time now is 01:46 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration