On Sun, May 17, 2009 at 1:13 PM, Duncan <1i5t5.dun...@cox.net> wrote: > Mark Knecht <markkne...@gmail.com> posted > 5bdc1c8b0905170849j3e0198ebrf29bc2042dda7...@mail.gmail.com, excerpted > below, on Sun, 17 May 2009 08:49:13 -0700: > >> Hi, >> I'm trying to compile a new piece of software for MythTV hardware >> support that's not in portage. I'm not a programmer so I'm woefully >> uneducated in this area but how does gcc find a library that a piece of >> code is requiring? > > Well, I'm not a programmer either, but I think I understand a bit about > this just from troubleshooting various ebuilds over time. YMMV, but the > below is what I'd try. > > gcc looks in various standard system locations (/usr/include, among > others) automatically for the header files, which tell it the interfaces > the library supplies. The interfaces consist of the the functions, etc, > along with the parameters they take, their orders and their types (int, > string pointer, whatever). > > For header files not found in the standard locations and not in the > working dir that's being compiled, gcc has the -I<includedir> parameter, > among others. > > Then for linking, there's -L<linkdir>, if you find you need it later. > >> My code setup is this: >> >> /home/mark/scte65scan-0.2 >> /home/mark/scte65scan-0.2/libhdhomerun > >> The code all exists in the scte65scan directory. The required library is >> in libhdhomerun. >> >> When I attempt to build the code I get the error message: >> >> m...@sector9 ~/scte65scan-0.2 $ make -f Makefile.hdhr cc -O2 -DHDHR -c >> tunerdmx.c -o tunerdmx.o tunerdmx.c:39:23: error: hdhomerun.h: No such >> file or directory > >> So it seems it cannot find the library because hdhomerun.h is in >> the libhdhomerun diectory: > >> The tunerdmx.c program has an include for hdhomerun: >> >> #ifdef HDHR >> #include "hdhomerun.h" >> >> which is what I guess is kicking off the problem. The makefile looks >> like this: >> >> m...@sector9 ~/scte65scan-0.2 $ cat Makefile.hdhr >> HDHR_DIR=./libhdhomerun > > That part looks right, since it's a subdir, and the (snipped) LIBOBJS > point into it as expected. > >> CFLAGS += -O2 -DHDHR >> LDFLAGS += -lpthread > >> So, how do I tell gcc that the library is here so it can build it? > > Add to that CFLAGS line: -I./libhdhomerun . See if that helps. You can > try the absolute form too (/home/mark...) but that can cause problems if > things are moved around, later. The relative form should help avoid > those problems. > > If you later get hungup in linking, there's the -L<dir> parameter for > that, too, but I'd not add it until it looks like it's needing it. > > As I said above, this is troubleshooting level knowledge. Try it and see > if it works more than really understanding the full implications, tho I > believe I understand why it /should/ work, as explained above -- you're > simply pointing gcc at the right dirs. > > -- > Duncan - List replies preferred. No HTML msgs. > "Every nonfree program has a lord, a master -- > and if you use the program, he is your master." Richard Stallman >
Thanks Duncan, I think it's turning out that this code has not actually been debugged and the errors are really in the program's code itself. I've managed to get a few of the simple typo's debugged but there are still some problems that the developer is going to have to deal with as they are way beyond me. I found that the inclusion of the libhdhomerun stuff could be accomplished in the makefile by changing the CFLAGS line to include it:: CFLAGS += -I libhdhomerun -O2 -DHDHR This still leaves me with a few problems so it's now a matter of waiting on the developer. Thanks again, Mark