help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

proper way to handle "-l" dependencies on 64-bit ubuntu?


From: Robert P. J. Day
Subject: proper way to handle "-l" dependencies on 64-bit ubuntu?
Date: Tue, 26 Jul 2011 05:05:50 -0400 (EDT)
User-agent: Alpine 2.02 (DEB 1266 2009-07-14)

  keeping this short, the result of a build on a 64-bit ubuntu system:

cc -pipe -std=gnu99 -Wall -fPIC -D_LARGEFILE64_SOURCE -D_ATFILE_SOURCE
-m64 -DPSEUDO_PREFIX='"/home/rpjday/workspace/pc_64_prj/host-cross"'
-DPSEUDO_SUFFIX='"-4d5ca74b0c7f6c5712a1fdc81c392f11"' -O2 -g
-L/home/rpjday/workspace/pc_64_prj/host-cross/lib
-I/home/rpjday/workspace/pc_64_prj/host-cross/include   -c -o
pseudo_db.o pseudo_db.c
remake[4]: *** No rule to make target `-ldl', needed by `pseudo'.
Stop.

  ok, fair enough, here's the offending rule:

...
DBOBJS=pseudo_db.o -ldl -lpthread
...
pseudo: pseudo.o $(SHOBJS) $(DBOBJS) pseudo_server.o pseudo_ipc.o
        $(CC) $(CFLAGS) -o pseudo \
                pseudo.o pseudo_server.o pseudo_client.o pseudo_ipc.o \
                $(DBOBJS) $(SHOBJS) $(DBLDFLAGS)
...

which would be perfectly acceptable if "libdl.??" was found in what i
read from the gnu make manual is one of the default locations of /lib,
/usr/lib or (perhaps) /usr/local/lib.  but this is a 64-bit install of
ubuntu 11.04, where it appears it lives at:

  /lib/x86_64-linux-gnu/libdl.so.2 -> libdl-2.13.so

so what is the proper and clean way to resolve this?

  obviously, i can add a "vpath" directive into the Makefile for that
64-bit directory, correct?  but a couple concerns.

  first, isn't this issue going to be sort of widespread on any linux
system that has this structure?  will this force *all* make
programmers to add an entry to vpath for that lib directory from now
on?

  also, speaking from total ignorance, should i really need to have a
dependency for something as basic as "-dl"?  isn't that the dynamic
linker?  does one ever need to specify an explicit dependency for
something that fundamental?

  in any event, what would be the proper and non-hacky way to resolve
this issue whenever it pops up in the code base i'm working with?
thanks.

rday

p.s.  just FYI, i'm dealing with an existing code base that's worked
fine for quite some time, but i don't think it's ever been tested on
ubuntu 11.04 so i suspect i'm going to trip over issues no one's ever
seen before.  i already have.

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================



reply via email to

[Prev in Thread] Current Thread [Next in Thread]