bugmake - Bugs: bug #21854, Dependency to a -l<libname>...


bug #21854: Dependency to a -l<libname> to be made in a not yet existing directory doesn't match(?)

Submitter:  Jesper Blommaskog <jesperb>
Submitted:  Thu 20 Dec 2007 11:31:04 AM UTC
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  3.80 Operating System:  POSIX-Based
Fixed Release:  3.82 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup

Sun 07 Jun 2009 02:11:06 AM UTC, comment #2: 

This bug has already been fixed in the latest CVS version of make.

Paul D. Smith <psmith>
Group administrator
Wed 09 Apr 2008 09:41:04 AM UTC, comment #1: 

You can bypass this easily by adding another rule like:

-lfunny_name: path_to_library_where_to_get_library.so
        #rules to place library where you want it

This dependency will be evaluated only when make does not resolve -lfunny_name by itself, i.e. the library does not exist in your scanned directory.

I use such technique in my Makefiles for about a year now and see no problems with that.

Thu 20 Dec 2007 11:31:04 AM UTC, original submission:  

I want to have a ORDER_ONLY_DEPENDENCY to a shared library to be built before I link my main program and I want the shared library to be put in a directory to be created by the makefile if it doesn't already exist. I also want to use the "-l<libname>" syntax when linking and also in the make file to avoid getting a hard coded path to the shared object into my executable. I then tried the following, that won't work unless I create the directory "./temp" manually before running make,


 will fail, giving

gmake: *** No rule to make target `-lfunny_name', needed by `my_program'.  Stop.


"mkdir temp; gmake"

will compile and link properly.

My system is RedHat EL4 using GNU make 3.80, but it was the same using 3.81. Maybe this is simply an optimisation, to ignore some rules for non-existing directories?

Jesper Blommaskog <jesperb>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #14672:  Makefile added by jesperb (972B - application/octet-stream - "gmake" will fail, while "mkdir temp; gmake" will succeed)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by jesperb (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-07-28 psmith Fixed Release4.0 3.82
    2009-06-07 psmith StatusNone Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.0
    2007-12-20 jesperb Attached File- Added Makefile, #14672

    Back to the top

    Powered by Savane 3.12