Click to See Complete Forum and Search --> : Civilization: Call To Power working on glibc-2.3 system


Pafnoutios
04-25-2004, 08:16 PM
If you own a copy of 'Civilization: Call To Power' that is now causing Segmentation Faults when you try to start a game, it is because CivCTP was compiled for glibc-2.1, and most modern systems use glibc-2.3, which are binary incompatible. I've gotten my copy working on my gentoo system. Generally speaking, you must install an additional glibc library, without overwriting your current library, and get CivCTP to use the auxiliary glibc.
This isn't so easy, though, since glibc-2.1.3 doesn't seem to want to compile with gcc-3.0 or later.
First, create /opt/usr/local.

mkdir /opt/usr
mkdir /opt/usr/local

Also, download gcc-2.95.3 (ftp://ftp.gnu.org/pub/gnu/gcc/gcc-2.95.3.tar.gz) and glibc-2.1.3 (ftp://ftp.gnu.org/gnu/glibc/glibc-2.1.3.tar.gz) from ftp.gnu.org.
Extract the archives in your favorite compiling directory (i.e. /usr/src)
<edit>
Before you install gcc, you need to fix a syntax misunderstanding between this older code and your newer gcc compiler that is trying to compile it. Open up ./gcc/ch/loop.c and go to lines 321 and 322 and delete the quotation mark that appears on each of those lines.
</edit>
Install gcc-2.95.3 into /opt/usr/local:

./configure --prefix=/opt/usr/local --exec-prefix=/opt/usr/local
make && make install

While gcc is compiling, download the glibc-linuxthreads-2.1.3 (ftp://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-2.1.3.tar.gz) and glibc-crypt-2.1 (ftp://ftp.gnu.org/gnu/glibc/glibc-crypt-2.1.tar.gz) add-ons and put them into your glibc-2.1.3 working directory (i.e. /usr/src/glibc-2.1.3) and extract them there.
After gcc is compiled and installed into /opt/usr/local, add /opt/usr/local/bin to the beginning of your PATH:
export PATH=/opt/usr/local/bin:$PATH
This will only last during your current shell session.
Now, install glibc into /opt/usr/local:

./configure --prefix=/opt/usr/local --exec-prefix=/opt/usr/local --enable-add-ons
make && make install

If configure complains about no linuxthreads or crypt add-ons, then you didn't extract them properly. The .tar.gz archives should be placed into your glibc-2.1.3 directory that was extracted from glibc-2.1.3.tar.gz and extracted directly into there.
You should now have a /opt/usr/local/lib directory somewhat resembling a /lib directory, it will have the entire glibc library in it. I had some sort of error during the make install of glibc, but I ignored it since everything I wanted seems to be working and the directory looked full to me.
All the necessary glibc library files will be there, but most programs look for the libraries by their libc6 names, so we must create the same symlinks that can be seen in /lib.

cd /opt/usr/local/lib
ln -s libc-2.1.3.so libc.so.6
ln -s ld-2.1.3.so ld-linux.so.2

Now make a script in one of your bin directories, included in your PATH, that will execute the /usr/local/games/CivCTP/civctp program. It should have two lines:

export LD_LIBRARY_PATH=/opt/usr/local/lib:$LD_LIBRARY_PATH
/usr/local/games/CivCTP/civctp

I named my script civCTP. This will start civctp so that it looks in /opt/usr/local/lib for it's needed library files instead of /lib, which is the default.
Don't forget to set the script's executable bits:
chmod 755 civCTP
You should now be able to run the game from any directory by executing civCTP at a prompt. You can also add civCTP to your KDE or Gnome menu, and there is an icon file in /usr/local/games/CivCTP you can use.

do_guh_new
04-27-2004, 02:41 AM
this is a fantastic post! I got this game about 2 months ago and havent played it as I gave up and moved on to other projects as soon as I learned how intense it could be, I agreed with Hayl and guessed nothing could be done except for asking for your money back. Just one little thing though I notice on your howto you left out a couple "&&". The first one being between "local" and "make" and one more between "--enable-add-ons" and "make". Well done, damn fine work.


EDIT:

One more thing, a lot of folks will realize gcc wont build, it will error out with some error saying unrecognized symbol " or something to that effect. The problem lies on line 321 and 322 in gcc-2.95.3/gcc/ch/loop.c (it's a text comment that runs over into another line, I just took out the whole comment itself)

Pafnoutios
04-27-2004, 11:58 AM
Originally posted by do_guh_new
this is a fantastic post! I got this game about 2 months ago and havent played it as I gave up and moved on to other projects as soon as I learned how intense it could be, I agreed with Hayl and guessed nothing could be done except for asking for your money back. Just one little thing though I notice on your howto you left out a couple "&&". The first one being between "local" and "make" and one more between "--enable-add-ons" and "make". Well done, damn fine work.

Those are two different lines. I don't normally do "./configure && make && make install" all in one line. In fact, I usually do them seperately, though I'm not completely sure why, but I put the "make && make install" together for the tutorial.

EDIT:

One more thing, a lot of folks will realize gcc wont build, it will error out with some error saying unrecognized symbol " or something to that effect. The problem lies on line 321 and 322 in gcc-2.95.3/gcc/ch/loop.c (it's a text comment that runs over into another line, I just took out the whole comment itself)

Oh, yeah! I forgot about that. It looked like a giganormous comment. I couldn't find the /* or */ too close to verify, though, but I just deleted the two quotes and tried again and it worked. Thank you.