Gentoo Archives: gentoo-user

From: nunojsilva@×××××××.pt
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: error: Cg/cg.h: No such file or directory
Date: Mon, 04 Feb 2013 16:42:22
Message-Id: 87sj5cdoag.fsf@ist.utl.pt
In Reply to: [gentoo-user] error: Cg/cg.h: No such file or directory by "João Matos"
1 On 2013-02-03, João Matos wrote:
2
3 > Dear list,
4 >
5 > I'm trying to build dolphin-emu from gamerlay, and I got the following
6 > error:
7 >
8 >
9 > error: Cg/cg.h: No such file or directory
10 >
11 > But the file actually exists:
12 >
13 > /opt/nvidia-cg-toolkit/include/Cg/cg.h
14 >
15 > Should it be a problem that I can solve myself?
16 >
17 > I thought so, than I've made a symlink for
18 > /opt/nvidia-cg-toolkit/include/Cg at /usr/include. The compilation took a
19 > little longer, but later, I've got the following:
20
21 It took a little longer because it compiled, in fact the error occured
22 so early that it failed without doing that much, I guess.
23
24 >
25 > /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../x86_64-pc-linux-gnu/bin/ld:
26 > cannot find -lCg
27 > /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../x86_64-pc-linux-gnu/bin/ld:
28 > cannot find -lCgGL
29
30 It is some library detail: when configuring the makefiles to build some
31 piece of source, the configure script needs to find the libraries and
32 set *two* things from these libraries:
33
34 - The include directories, to which it should append the
35 /opt/nvidia-cg-toolkit/include path
36
37 - The library directories, to which it should append a directory where
38 nvidia-cg-toolkit has its libs
39
40 This, at least for some packages, is done with pkg-config, see, for
41 example, if you have gtk+-2.x on your system:
42
43 pkg-config --cflags gtk+-2.0
44
45 This generates the right flags to pass to gcc when you want to compile a
46 gtk+-2.x application. Likewise, --libs gives you the linker flags.
47
48 Now what happened: you *did* provide it the header file, which is enough
49 to compile the code part that depends on the nvidia library
50 (compilation, which is modular, you can just go for parts of the code
51 and information on other parts are on the header files), but you still
52 need the library itself when you are assembling the final binary, so
53 that the binary can be extended with information on where to get the
54 library (or with the library itself, in the case of static linking).
55
56 Although here --libs only gives me -l* for gtk, there is also a
57 companion -L flag that, like -I for includes, sets the directories where
58 the libraries can be found. I assue that, if -L is not given, that just
59 means gtk+ is in the default locations.
60
61
62 If you can figure out how to tell the configure script where to look for
63 the libs, that would be the easiest thing to do; next to that, you can
64 manually link the files using the right -L parameter or perhaps
65 appending it to LD_LIBRARY_PATH when compiling.
66
67
68 Perhaps try reinstalling nvidia-cg-toolkit after resyncing: some
69 searches tell me there was yet another compilation breakage that got
70 fixed recently: https://bugs.gentoo.org/show_bug.cgi?id=443546
71
72 But one person noted it does not work in amd64... I wonder if linking
73 lib64 to lib there would work.
74
75 --
76 Nuno Silva (aka njsg)
77 http://njsg.sdf-eu.org/