Skip to contentSkip to conversation

New: make performs library lookup in the build and host library directores and not in the staging area

Buildroot bugzilla at busybox.net 1 participant 9 messages Apr 1, 2012 – May 26, 2013

lore
Share & tools
lore
#0 lore raw

https://bugs.busybox.net/show_bug.cgi?id=5006

Summary: make performs library lookup in the build and host
library directores and not in the staging area
Product: buildroot
Version: 2012.02
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P5
Component: Other
AssignedTo: unassigned at buildroot.uclibc.org
ReportedBy: develop at kristov.de
CC: buildroot at uclibc.org
Estimated Hours: 0.0

Consider the following Makefile:

CC = gcc
prog: prog.o -lcrypt

        $(CC) -o $@ $^

This links prog.o to libcrypt.so in the staging area, but GNU make searches for the library in the following directories:

/lib
/usr/lib
$(HOST_DIR)/usr/lib

which is obviously wrong in a cross-compiling environment. (The paths are hard-coded in remake.c at the beginning of the function directory_search).

I have attached a patch that fixes this bug. It removes LIBDIR (which is defined to $(HOST_DIR)/usr/lib in the make's Makefile) from the search path and replaces the hard-coded paths by @LIBDIR@ and @USRLIBDIR@, respectively. In the buildroot's make.mk, these strings are replaced by the correct staging library paths.

However, this patch only works in combination with a host-make as requested in bug #4922, where the discussion has not reached a final consensus yet :-(

Regards,

Christoph Schulz

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#1 lore raw

[Buildroot] [Bug 5006] make performs library lookup in the build and host library directores and not in the staging area

https://bugs.busybox.net/show_bug.cgi?id=5006

--- Comment #1 from Christoph Schulz <[email protected]> 2012-04-01 06:41:38 UTC --- Created attachment 4214
--> https://bugs.busybox.net/attachment.cgi?id=4214
patches make.mk to replace @LIBDIR@ and @USRLIBDIR@

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#2 lore raw

[Buildroot] [Bug 5006] make performs library lookup in the build and host library directores and not in the staging area

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=5006

--- Comment #2 from Christoph Schulz <[email protected]> 2012-04-01 06:42:23 UTC --- Created attachment 4220
--> https://bugs.busybox.net/attachment.cgi?id=4220
replaces hard-code library paths in remake.c; removes LIBDIR path

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#3 lore raw

[Buildroot] [Bug 5006] make performs library lookup in the build and host library directores and not in the staging area

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=5006

Christoph Schulz <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

         Depends on|                            |4922
Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#4 lore raw

[Buildroot] [Bug 5006] make performs library lookup in the build and host library directores and not in the staging area

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=5006

Arnout Vandecappelle <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Arnout Vandecappelle <[email protected]> 2012-04-16 19:32:10 UTC --- The way we usually call make, this isn't needed:

$(MAKE) CC="$(TARGET_CC)" ...

Variables specified on the command line override variables in the Makefile, unless 'override' is put in front of it. See
http://www.gnu.org/savannah-checkouts/gnu/make/manual/html_node/Override-Directive.html

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#5 lore raw

[Buildroot] [Bug 5006] make performs library lookup in the build and host library directores and not in the staging area

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=5006

Christoph Schulz <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |

--- Comment #4 from Christoph Schulz <[email protected]> 2012-04-16 19:45:29 UTC --- (In reply to comment #3)

Quoted 3 lines

The way we usually call make, this isn't needed:

$(MAKE) CC="$(TARGET_CC)" ...

Sorry, but that is plain wrong. You did not fully understand the problem I described. The "-lcrypt" target is _not_ looked up in the staging area _regardless_ how you specify CC. You may not have encountered this problem so far as there are almost no Makefiles using this syntax. If some Makefile uses "-l<lib>" as dependency, the Makefile is _not cross-compilable_ unless you patch GNU make. The patches I attached solve the issue.

Regards,

Christoph Schulz

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#6 lore raw

[Buildroot] [Bug 5006] make performs library lookup in the build and host library directores and not in the staging area

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=5006

--- Comment #5 from Arnout Vandecappelle <[email protected]> 2012-04-17 22:03:41 UTC --- My bad, I was confused by the CC=gcc line.

A Makefile that uses a -lfoo dependency for something it can't rebuild is pretty silly, I think. As a workaround, though, you could pass VPATH="$(STAGING_DIR)/lib:$(STAGING_DIR)/usr/lib" - hopefully that Makefile doesn't use VPATH itself.

BTW it's definitely worthwhile to upstream a patch that gets the libdirs from a variable similar to .LIBPATTERNS.

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#7 lore raw

[Buildroot] [Bug 5006] make performs library lookup in the build and host library directores and not in the staging area

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=5006

Bug 5006 depends on bug 4922, which changed state.

Bug 4922 Summary: Please consider introducing host-make for building software packages within the buildroot
https://bugs.busybox.net/show_bug.cgi?id=4922

What |Old Value |New Value
----------------------------------------------------------------------------

             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX
Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
#8 lore raw

[Buildroot] [Bug 5006] make performs library lookup in the build and host library directores and not in the staging area

In reply to bugzilla at busybox.net

https://bugs.busybox.net/show_bug.cgi?id=5006

Thomas Petazzoni <[email protected]> changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|REOPENED                    |RESOLVED
         Resolution|                            |WONTFIX

--- Comment #6 from Thomas Petazzoni <[email protected]> 2013-05-26 15:17:31 UTC --- As per the discussion in #4922, we really don't want to be building a host
make, so the problem discussed in this bug should be solved upstream with the
GNU make developers.

Signature · 3 lines
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.