Re: Cannot compile Mesa on Ubuntu Edgy

Jacob <[email protected]> Sun, 25 Feb 2007 07:40:21 -0500
Newsgroups gmane.comp.video.dri.user
Organization ExpandApps Developers
Message-ID <op.toa1hjrn6fluez@jacob-laptop>
Ignore my last e-mail. Those instructions were just for the ATI driver,  
not Mesa and DRM. The following instructions are for all three. These  
instructions have you downloading from git and cvs, so you should be all  
set. If you want, ignore the parts about applying the patch, and the part  
about downloading and compiling the ati drivers.

It's in BBCode, but it shouldn't be too hard to read.

[b][u][SIZE="2"]All Users - Dapper and Edgy[/SIZE][/u][/b]
[indent][b]Attention![/b] This section is not complete. I don't mean that  
it will crash your system. If you have the supported setup (Ubuntu, Xorg,  
and one of the cards in the "Cards that work with this HOWTO" section)  
then you shouldn't get any issues. What I mean by not complete is I don't  
remember what things you needed to fully complete this section. When (and  
I mean [i]when[/i]) you run into an error, please post it. I've already  
gone through all the errors saying you are missing something, and should  
know what to do.

[b]I would really really appreciate if you help me get this section  
complete! We'll be making backups of everything that is overwritten, so if  
you need to you can revert anything here![/b][/indent]

Well, it turns out that, even though Edgy is supposedly the latest, it  
isn't the latest in the X world. Very very recently (and I mean first week  
of November) they just completed a huge batch of bug fixes for the cards  
that this HOWTO deals with. In order to take advantage of this, however,  
we have to completely recompile drm, Mesa, and xf86-video-ati modules.  
(Basically, we recompile 3D Acelleration modules, and the ati/radeon  
drivers.) The drivers have been much more stable for me then the ones  
included in Edgy.

We'll be using stuff from Edgy (again) so...

[code]
sudo apt-get install nano
sudo nano /etc/apt/sources.list
[/code]

Now replace any mention of "dapper" with "edgy", except for the cdrom  
entry, and remove any single "#". (It's OK if you replace that too...  
we'll be changing it back later.) Now run the following:

[code]
sudo apt-get update
[/code]

We need to install different things before we begin:
[code]sudo apt-get install cvs git-core x11proto-xf86vidmode-dev  
libxxf86vm-dev libxmu-dev[/code]

Once that's done, complete the following commands, which download the  
modules into a new directory...
[code]
mkdir ~/3DModules_source
cd ~/3DModules_source
mkdir ~/backups_drm/
mkdir ~/backups_Mesa/
mkdir ~/backups_drv/
git clone git://anongit.freedesktop.org/git/mesa/drm
git clone git://anongit.freedesktop.org/git/xorg/driver/xf86-video-ati
cvs -d:pserver:[email protected]:/cvs/mesa login
cvs -z3 -d:pserver:[email protected]:/cvs/mesa co Mesa
[/code]

First let's build our drivers. Run the following:
[code]
cd xf86-video-ati
./autogen.sh
./configure --prefix=/usr --exec-prefix=/
[/code]
[u]Note:[/u] If you get errors here, STOP! You won't get any farther. See  
the Troubleshooting section at the bottom of this HOWTO. (You can safely  
ignore all warnings.)

Let's backup our existing drivers. To do so, run the following commands:
[code]
cd backups_drv/
cp -R /lib/xorg/modules/* ./
[/code]

Alrighty, we can build our drivers now. Because we are overwriting drivers  
you are currently using, X will crash if it is still running. Print out  
these instructions (click here for a printable view). Log out so that you  
go back to Ubuntu's login screen, and punch Ctrl+Alt+F1, and login there.  
Run the following commands to shut X down safely:
[code]
sudo /etc/init.d/gdm stop
sudo killall gdm
[/code]

Now you can install the drivers. Run the following commands to do so:
[code]
cd ../xf86-video-ati
make
sudo make install
[/code]
[u]Note:[/u] If you get errors here, STOP! You won't get any farther. See  
the Troubleshooting section at the bottom of this HOWTO. (You can safely  
ignore all warnings.)

Restart your computer to see if the new drivers work. If you at least get  
to the login screen, congrats. If not, please do not continue, and see the  
Troubleshooting section at the bottom.

To build DRM, run:
[code]
cd ~/3DModules_source/drm
./autogen.sh
./configure --prefix=/usr --exec-prefix=/[b](Note: Be sure that "~" turns  
into your "/home/<username>" folder after pushing tab!)[/b]
[/code]
[u]Note:[/u] If you get errors here, STOP! You won't get any farther. See  
the Troubleshooting section at the bottom of this HOWTO. (You can safely  
ignore all warnings.)

We should back up your existing drivers just in case this doesn't work.
[code]
cd ~/backups_drm/
cp /usr/lib/libdrm.la ./
cp /usr/lib/libdrm.so.2.3.0 ./
cp /usr/include/xf86drm.h ~/backups_drm/
cp /usr/include/xf86mm.h ~/backups_drm/
cp /usr/include/drm/drm.h ~/backups_drm/
cp /usr/include/drm/drm_sarea.h ~/backups_drm/
cp /usr/include/drm/i915_drm.h ~/backups_drm/
cp /usr/include/drm/mach64_drm.h ~/backups_drm/
cp /usr/include/drm/mga_drm.h ~/backups_drm/
cp /usr/include/drm/r128_drm.h ~/backups_drm/
cp /usr/include/drm/radeon_drm.h ~/backups_drm/
cp /usr/include/drm/savage_drm.h ~/backups_drm/
cp /usr/include/drm/sis_drm.h ~/backups_drm/
cp /usr/include/drm/via_drm.h ~/backups_drm/
cp /usr/include/drm/r300_reg.h ~/backups_drm/
cp /usr/include/drm/via_3d_reg.h ~/backups_drm/
cp /usr/lib/pkgconfig/libdrm.pc ~/backups_drm/
cd ../drm
[/code]

Now for the big leap...
[code]
make install
[/code]
[u]Note:[/u] If you get errors here, STOP! You won't get any farther. See  
the Troubleshooting section at the bottom of this HOWTO. (You can safely  
ignore all warnings.)

OK, now that we've got the latest DRM installed, we need the latest Mesa  
installed. Run the following:
[code]
cd ../Mesa
make
[/code]
You'll get a nice long list of different platforms you can compile for. If  
you don't know which one to use, "linux-dri" is a generally safe option.  
For any Pentium (anything Intel) users, you'll want "linux-dri-x86". Use  
the "linux-<platform>" thing you just figured out, and replace  
"<whatToCompile>" with it.
[code]
make <whatToCompile>
[/code]
Most users can run this if you don't know:
[code]
make linux-dri
[/code]
You can safely ignore all warnings presented. If you get an error, please  
please please let me know about it.

OK, so now you've got some dandy Mesa stuff. Let's back up our existing  
drivers just in case.
[code]
cp /usr/include/GL/* ~/backups_drm/
cp /usr/X11R6/lib/modules/dri/* ~/backups_drm/
cp /usr/lib/libGLU.* ~/backups_drm/
cp /usr/lib/libglut* ~/backups_drm/
cp /usr/lib/libGLw.* ~/backups_drm/
[/code]

Now we need to install Mesa. Run the following commands to do so:
[code]
make install
[/code]
[u]Note:[/u] If you get errors here, STOP! You won't get any farther. See  
the Troubleshooting section at the bottom of this HOWTO. (You can safely  
ignore all warnings.)


You are done compiling in new 3D drivers. Restart your computer, and try  
them out. If games still run slowly, or you get other issues, please see  
the Troubleshooting section at the bottom of this HOWTO.


[b]The following grey text is outdated. Use the below only if the above  
doesn't work![/b]
[COLOR="Silver"][b][u][SIZE="2"]All Users - Dapper and Edgy[/SIZE][/u][/b]
At this point you think you are done. You've just completed the  
installation of new drivers that are just about the latest. Your card is  
probably the most stable yet. (Some maybe not.)

Well, the point is that there is a bug fix that was never included in this  
release. That's right. You heard me. A bug fix was accidentally left out  
that directly affects us. You know what that means? We get out some  
sources and compile. Muhahahaha.

No, seriously, it's not that hard. Apt-get does all the downloading we  
need, you'll do a copy and paste, run a few commands, and boom. Done.

So let's get started. Run the following commands:

[code]
sudo apt-get install nano
sudo nano /etc/apt/sources.list
[/code]

Now replace any mention of "dapper" with "edgy", except for the cdrom  
entry, and remove any single "#". (It's OK if you replace that too...  
we'll be changing it back later.) Now run the following:

[code]
sudo apt-get update
[/code]

Run the following command. This command will download everything we need  
to compile the drivers.

[code]
sudo apt-get build-dep xserver-xorg-driver-ati
[/code]

Once that's done, run...

[code]
sudo apt-get source xserver-xorg-driver-ati
[/code]

This downloads the source for the ati drivers. The ati drivers include  
radeon.

Alright, next we have to apply the patch that was never applied. Run the  
following command to jump down to the folder where we need to be:

[code]
cd xserver-xorg-driver-ati-6.5.7.3/
[/code]

OK, now, see this page here?  
[url]http://gitweb.freedesktop.org/?p=xorg/driver/xf86-video-ati.git;a=blobdiff;h=6d6270187e048138463c6b913449083b2c8ad355;hp=03d1e8972b689150c59619762674f07b8ca356cf;hb=10ba4f0a435d7c1ed9f4a36a8d607f0f0b63be30;f=src/radeon_driver.c[/url]
Well, that's the patch that was never applied. We'll have to apply it  
ourselves.

Run the following command:
[code]
sudo gedit src/radeon_driver.c
[/code]

Select the menu Search -> Go to Line... and punch in 2296.
You should see some resemblance between this and the page I showed you  
above. Most users should be able to do this next part on their own, but  
I'll lead you step-by-step to be sure. (Basically, any line that has "-"  
and is red, we remove, and "+" and green lines we add.)

Remove this line...
[code]    unsigned long agp_size, agp_base, mem_size;[/code]
...replace it with this line...
[code]    unsigned long mem_size;[/code]
...and add this line.
[code]    CARD32 aper_size;[/code]
Select the menu Search -> Go to Line... and punch in 2306. Just after this  
line...
[code]    mem_size = INREG(RADEON_CONFIG_MEMSIZE);[/code]
...add this line.
[code]    aper_size = INREG(RADEON_CONFIG_APER_SIZE);[/code]
Just after this line...
[code]             mem_size = 0x800000;[/code]
...add these lines.
[code]    /* Fix for RN50, M6, M7 with 8/16/32(??) MBs of VRAM -
        Novell bug 204882 + along with lots of ubuntu ones */
     if (aper_size > mem_size)
         mem_size = aper_size;
[/code]
Just after this line...
[code]     if (info->directRenderingEnabled && !info->newMemoryMap)  
{[/code]
...add this line.
[code]            CARD32 aper_size = INREG(RADEON_CONFIG_APER_SIZE);[/code]
Click the Save button in the toolbar. You've just applied a patch.  
Congrats. :)

Here's the next part. This part is tricky - you either get no errors, and  
have a great time, or you get a lot of errors, and end up Googling a lot.  
We are now going to compile. [i]*Scary music*[/i]

Wait... nearly forgot... we should really back up our drivers. Run the  
following commands to do just that:
[code]
mkdir ~/xserver-xorg-drivers_BAK/
cp -R /usr/lib/xorg/modules/drivers/* /home/jacob/xserver-xorg-drivers_BAK/
[/code]

Now you can compile:
[code]
sudo ./configure
sudo make
sudo make install
[/code]


On Sun, 25 Feb 2007 02:57:45 -0500, Iain Cheyne <[email protected]> wrote:

> I am on Ubuntu Edgy and have just bought a Radeon 9250.
>
> glxinfo ouputs a lot of "GLX" missing on display" errors.
> dmesg | grep agp shows I have AGP configured correctly
> dmesg | grep drm outputs nothing, so I decided to build DRM from CVS.
>
>
> I used this page - http://dri.freedesktop.org/wiki/Building,
>
> I tried to get the dependencies using the following commands, but there  
> is no
> mesa package in Ubuntu:
>
> apt-get build-dep mesa
> apt-get build-dep libdrm
> apt-get install git-core autoconf automake libtool libxmu-headers  
> libxmu-dev
> libxi-dev libdrm-dev-
>
> I then got the source and build libdrm.
>
> Unfortunately, running "make linux-dri-x86" fails. I used apt-file to  
> search and
> install a few missing files I saw in the error messages, which got me  
> further,
> but still did not fix it.
>
> Do I just have some missing dependencies? Is there a package I can do an
> "apt-get build-dep" on? Is there another problem? I am not experienced  
> with
> compiling software, so I am not sure what troubleshooting I can do
>



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
--