PDA

View Full Version : Upgrading to Cg v1.2 - problem and solution for Linux.


milev
03-13-2004, 03:25 PM
Here I describe two problems compiling Cg 1.1 demos and upgrading from Cg v1.1 to Cg v1.2 which seem to be common and can waste significant time and efforts to unexperienced developers.

First if anyone has problems compiling the Cg 1.1 demos that come with the SDK for Linux and complaining about glut whatever, just go to: http://www.csit.fsu.edu/~blanco/Cg/Cg_projects.htm and pay attention to the lines describing how to modify the Makefile, by adding some library paths. (should be done for the Mekafile in each demo's directory)

Well this works OK with version Cg v1.1. So I was working for a while and everything was just fine. Unfortunately if you upgrade to the new Cg v1.2 which is available from nVidia since end of February you may appear to have problems compiling your *.c or *.cpp files with the Makefile you already have.
Although the Cg compiler is working and you can compile the file with command like that:

pc@linux.my$ cgc -profile vp30 -o vertexProfile.vp vertexProfile.cg

you will not be able to compile the Cg loading program or even execute already compiled one. In my case I got several erros about undefined references in pthread_**** in lib /usr/lib/libCg.so on my Slackweare 9.1. It appears that additional pthread library should be added to the linker path. So what you can do is to open your Makefile and assure that you have -pthread statement in one of the following lines: (usually only one you should have not both lines)

LFLAGS= -L/usr/X11R6/lib -lXmu -lXi -lCgGL -lCg -lglut -lGLU -lGL -pthread

or

LLDLIBS = -lm -lXm -lCgGL -lCg -lGL -lGLU -lglut -lXi -pthread

After correcting the libs paths everything has to be fine.

I want to thank Jason Allen (http://www.jcode.org/) who enlightened me on this solution for hte second problem. Thanks Jason.

CGTalk Moderation
01-17-2006, 05:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.