On 2013-02-03, João Matos wrote:

> Dear list,
>
> I'm trying to build dolphin-emu from gamerlay, and I got the following
> error:
>
>
> error: Cg/cg.h: No such file or directory
>
> But the file actually exists:
>
> /opt/nvidia-cg-toolkit/include/Cg/cg.h
>
> Should it be a problem that I can solve myself?
>
> I thought so, than I've made a symlink for
> /opt/nvidia-cg-toolkit/include/Cg at /usr/include. The compilation took a
> little longer, but later, I've got the following:

It took a little longer because it compiled, in fact the error occured
so early that it failed without doing that much, I guess.

>
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../x86_64-pc-linux-gnu/bin/ld:
> cannot find -lCg
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../x86_64-pc-linux-gnu/bin/ld:
> cannot find -lCgGL

It is some library detail: when configuring the makefiles to build some
piece of source, the configure script needs to find the libraries and
set *two* things from these libraries:

- The include directories, to which it should append the
  /opt/nvidia-cg-toolkit/include path

- The library directories, to which it should append a directory where
  nvidia-cg-toolkit has its libs

This, at least for some packages, is done with pkg-config, see, for
example, if you have gtk+-2.x on your system:

   pkg-config --cflags gtk+-2.0

This generates the right flags to pass to gcc when you want to compile a
gtk+-2.x application. Likewise, --libs gives you the linker flags.

Now what happened: you *did* provide it the header file, which is enough
to compile the code part that depends on the nvidia library
(compilation, which is modular, you can just go for parts of the code
and information on other parts are on the header files), but you still
need the library itself when you are assembling the final binary, so
that the binary can be extended with information on where to get the
library (or with the library itself, in the case of static linking).

Although here --libs only gives me -l* for gtk, there is also a
companion -L flag that, like -I for includes, sets the directories where
the libraries can be found. I assue that, if -L is not given, that just
means gtk+ is in the default locations.


If you can figure out how to tell the configure script where to look for
the libs, that would be the easiest thing to do; next to that, you can
manually link the files using the right -L parameter or perhaps
appending it to LD_LIBRARY_PATH when compiling.


Perhaps try reinstalling nvidia-cg-toolkit after resyncing: some
searches tell me there was yet another compilation breakage that got
fixed recently: https://bugs.gentoo.org/show_bug.cgi?id=443546

But one person noted it does not work in amd64... I wonder if linking
lib64 to lib there would work.

-- 
Nuno Silva (aka njsg)
http://njsg.sdf-eu.org/


Reply via email to