Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-amd64
Navigation:
Lists: gentoo-amd64: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-amd64@g.o
From: Mark Knecht <markknecht@...>
Subject: How does gcc find a library?
Date: 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?

   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:

mark@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
tunerdmx.c: In function ‘open_hdhr’:
tunerdmx.c:49: warning: assignment makes pointer from integer without a cast
tunerdmx.c:51: error: ‘id_str’ undeclared (first use in this function)
tunerdmx.c:51: error: (Each undeclared identifier is reported only once
tunerdmx.c:51: error: for each function it appears in.)
tunerdmx.c:54: error: ‘uint32_t’ undeclared (first use in this function)
tunerdmx.c:54: error: expected ‘;’ before ‘device_id_requested’
tunerdmx.c:55: error: ‘device_id_requested’ undeclared (first use in
this function)
tunerdmx.c:58: warning: initialization makes pointer from integer without a cast
tunerdmx.c: In function ‘demux_start’:
tunerdmx.c:172: error: ‘ret_error’ undeclared (first use in this function)
tunerdmx.c: In function ‘demux_read’:
tunerdmx.c:245: error: ‘uint8_t’ undeclared (first use in this function)
tunerdmx.c:245: error: ‘pbuf’ undeclared (first use in this function)
tunerdmx.c:245: error: ‘VIDEO_DATA_BUFFER_SIZE_1S’ undeclared (first
use in this function)
tunerdmx.c: In function ‘tuner_tune’:
tunerdmx.c:382: error: ‘ret_error’ undeclared (first use in this function)
tunerdmx.c: In function ‘tuner_checklock’:
tunerdmx.c:414: error: ‘arg’ undeclared (first use in this function)
tunerdmx.c:414: error: ‘tp’ undeclared (first use in this function)
tunerdmx.c:415: error: ‘ret_error’ undeclared (first use in this function)
tunerdmx.c:425: warning: passing argument 2 of ‘__rawmemchr’ makes
integer from pointer without a cast
tunerdmx.c:425: warning: passing argument 2 of ‘__builtin_strchr’
makes integer from pointer without a cast
make: *** [tunerdmx.o] Error 1
mark@Sector9 ~/scte65scan-0.2 $

   So it seems it cannot find the library because hdhomerun.h is in
the libhdhomerun diectory:

mark@Sector9 ~/scte65scan-0.2 $ ls libhdhomerun
Makefile                 hdhomerun_config.c   hdhomerun_discover.c
hdhomerun_types.h
README                   hdhomerun_control.c  hdhomerun_discover.h
hdhomerun_video.c
hdhomerun.h              hdhomerun_control.h  hdhomerun_os.h
hdhomerun_video.h
hdhomerun_channels.c     hdhomerun_debug.c    hdhomerun_os_posix.h    lgpl.txt
hdhomerun_channels.h     hdhomerun_debug.h    hdhomerun_os_windows.h
hdhomerun_channelscan.c  hdhomerun_device.c   hdhomerun_pkt.c
hdhomerun_channelscan.h  hdhomerun_device.h   hdhomerun_pkt.h
mark@Sector9 ~/scte65scan-0.2 $

   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:

mark@Sector9 ~/scte65scan-0.2 $ cat Makefile.hdhr
HDHR_DIR=./libhdhomerun

LIBOBJS += $(HDHR_DIR)/hdhomerun_pkt.o
LIBOBJS += $(HDHR_DIR)/hdhomerun_debug.o
LIBOBJS += $(HDHR_DIR)/hdhomerun_discover.o
LIBOBJS += $(HDHR_DIR)/hdhomerun_channels.o
LIBOBJS += $(HDHR_DIR)/hdhomerun_channelscan.o
LIBOBJS += $(HDHR_DIR)/hdhomerun_control.o
LIBOBJS += $(HDHR_DIR)/hdhomerun_video.o
LIBOBJS += $(HDHR_DIR)/hdhomerun_device.o

OBJS = scte65scan.o tunerdmx.o

CFLAGS += -O2 -DHDHR
LDFLAGS += -lpthread

ifeq ($(OS),Windows_NT)
  BINEXT := .exe
  LDFLAGS += -liphlpapi
else
  ifneq ($(findstring solaris,$(shell echo $$OSTYPE)),)
    LDFLAGS += -lns -lsocket
  endif
  ifneq ($(findstring darwin,$(shell echo $$OSTYPE)),)
    CFLAGS += -arch i386 -arch ppc
  endif
endif


all: scte65scan$(BINEXT)

$(LIBOBJS): %.o : %.c
	$(CC) $(CFLAGS) -c $< -o $@

$(OBJS): %.o : %.c
	$(CC) $(CFLAGS) -c $< -o $@

scte65scan$(BINEXT): $(OBJS) $(LIBOBJS)
	$(CC) $(CFLAGS) $+ $(LDFLAGS) -o $@

clean:
	rm -f scte65scan $(LIBOBJS) $(OBJS)
mark@Sector9 ~/scte65scan-0.2 $

   So, how do I tell gcc that the library is here so it can build it?

Thanks,
Mark


Replies:
Re: How does gcc find a library?
-- Duncan
Navigation:
Lists: gentoo-amd64: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
irqbalance - pros & cons
Next by thread:
Re: How does gcc find a library?
Previous by date:
irqbalance - pros & cons
Next by date:
Re: How does gcc find a library?


Updated Jun 17, 2009

Summary: Archive of the gentoo-amd64 mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.