fidoboy Wrote:Many thanks for sharing the script IceNine, but how can i get nvcompress installed on my XBMC machine? i can't see how to get it...
Well that is a project that took me almost a whole day. Hopefully I can help you out!
First what you will need:
nVidia Texture Tools
CUDA Tools
g++ and gcc versions 4.4 and 4.3
libjpeg and dev files
cmake
Code:
sudo apt-get install g++ g++-4.3 gcc-4.3 libjpeg62-dev cmake
cd ~
wget http://nvidia-texture-tools.googlecode.com/files/nvidia-texture-tools-2.0.7-1.tar.gz
wget http://developer.download.nvidia.com/compute/cuda/2_3/toolkit/cudatoolkit_2.3_linux_32_ubuntu9.04.run
tar -xvzf nvidia-texture-tools-2.0.7-1.tar.gz
(the cuda extension for nvcompress won't compile on 4.4 for some reason, which is what comes with Ubuntu 9.10 Karmic. If you are running 9.04 you're fine.)
CUDA isn't strictly needed, nvcompress will still work pretty quickly with the -fast option, but CUDA still seems fastest. If you don't want to use CUDA, don't install the cuda tools because the texture tools won't compile without some extra work with g++ 4.3.
To install the CUDA tools, in terminal go to the directory where you downloaded the CUDA file I linked and run
Code:
sudo sh cudatoolkit_2.3_linux_32_ubuntu9.04.run
Now you have to add the cuda libraries to your shared libraries by editing a file. I use nano for my text editor, feel free to use whatever you like.
Code:
sudo nano /etc/ld.so.conf
and add this line to the end
Code:
include /usr/local/cuda/lib/
After you save the file, run
to update the libraries.
Assuming you want CUDA acceleration, after you have installed g++ and ran the CUDA tools installer, move to the nvidia-texture-tools directory (wherever you unzipped it to) and run
You should see in the list of things that come up that JPEG is found and CUDA is found. Something like this:
Code:
-- Configuring nvidia-texture-tools 2.0.7-1
-- Setting optimal options
-- Processor: i686
-- Compiler Flags: -march=i686
-- Looking for OpenGL - found
-- Looking for GLUT - found
-- Looking for DirectX - not found
-- Looking for GLEW - not found
-- Looking for Cg - not found
-- Looking for CUDA - found
-- Looking for Maya - not found
-- Looking for JPEG - found
-- Looking for PNG - not found
-- Looking for TIFF - not found
-- Looking for OpenEXR - not found
-- Use thread library: -lpthread
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xbox/Downloads/nvidia-texture-tools/build
-e Your configure completed 033[92msuccessfully033[0m, now type 033[1mmake033[0m
If that works well, and you are on Ubuntu Karmic then you need to set up g++ to compile using version 4.3.
Code:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 44 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4 --slave /usr/bin/gcov gcov /usr/bin/gcov-4.4
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.3 43 --slave /usr/bin/g++ g++ /usr/bin/g++-4.3 --slave /usr/bin/gcov gcov /usr/bin/gcov-4.3
You can confirm that this finished right by running
Code:
sudo update-alternatives --display gcc
Now set the system to run version 4.3 instead of 4.4.
MAKE SURE TO CHANGE THIS BACK WHEN YOU ARE DONE.
Code:
sudo update-alternatives --config gcc
You should see something like this:
Code:
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/gcc-4.4 44 auto mode
1 /usr/bin/gcc-4.3 43 manual mode
2 /usr/bin/gcc-4.4 44 manual mode
Press enter to keep the current choice[*], or type selection number:
In this case you would type 1 and hit enter. Just put whatever number you have to switch to version 4.3.
After this is done, in the nvidia-texture-tools folder, type
and, assuming everything compiled ok (I got some warnings in the compile process but it did finish and everything seems to work fine) type
and it should install the files properly.
At this point you can change your default compiler back to version 4.4 by running the same command as above and set back to auto (option 0 in the example).
Try to run nvcompress (you should be able to do this anywhere in the command line now) and if you get the typical list of options than you are good to go. Initially I had some issues with nvcompress not seeing the needed shared libraries. You'll know if you have this same problem if, when you try to run nvcompress, you get an error saying it can't find some shared library. If this is the case, follow the next instructions.
Move to the /usr/local/bin directory and check if nvcompress is really not seeing libraries.
Code:
cd /usr/local/bin
ldd nvcompress
You should see a list of libraries that nvcompress depends on. If you have any entries that say Not Found at the end than some libraries aren't being seen. I was missing one (libcudart.so.2) at the end of all these steps, but I fixed this by copying the file to a library I knew was working.
Code:
sudo cp /usr/local/cuda/lib/libcudart.so.2 /usr/local/lib/libcudart.so.2
sudo ldconfig -v
You only need to do something like this if nvcompress gives an error that it can't find a shared library.
Hopefully this should be thorough enough and I didn't forget anything. Pretty much all of this info I found digging around on Google. If anyone runs into any problems that I didn't cover here I can try to help, but I'm not much of a linux guru.