Opened 8 years ago

Closed 4 years ago

#14709 closed defect (fixed)

(Ab)using LIBRARY_PATH instead of using -L${SAGE_LOCAL}/lib doesn't necessarily work

Reported by: leif Owned by: GeorgSWeber
Priority: critical Milestone: sage-duplicate/invalid/wontfix
Component: build Keywords: CPATH LIBRARY_PATH SAGE_LOCAL -I -L sage-env search directories paths
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


In sage-env, we meanwhile add (more precisely, append) ${SAGE_LOCAL}/include to CPATH, and ${SAGE_LOCAL}/lib to LIBRARY_PATH.

Besides that this is non-portable, or rather a GCC feature, it is not equivalent to adding / prepending -I${SAGE_LOCAL}/include to CPPFLAGS/CFLAGS/CXXFLAGS and -L${SAGE_LOCAL}/lib to LDFLAGS.

First of all, search paths / folders specified on the command line precede all others, and second, those specified through CPATH, LIBRARY_PATH etc. are not necessarily searched before system folders.

This currently leads to problems with e.g. readline and R (which doesn't support configuring with --with-readline=<prefix>, but just =yes or =no), where adding Sage's directories was dropped from spkg-install.

To test this, try for example

$ mkdir -pv /tmp/LOOK_HERE

$ env LIBRARY_PATH=/tmp/LOOK_HERE $CC -print-search-dirs | egrep '^libraries|LOOK_HERE'

# (and/or)

$ env LIBRARY_PATH=/tmp/LOOK_HERE $CC -v -x c /dev/null -o /dev/null 2>&1 | egrep '^LIBRARY_PATH|LOOK_HERE'

where $CC is the compiler / GCC of your choice (e.g. just gcc).

Change History (6)

comment:1 Changed 8 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:2 Changed 8 years ago by jpflori

Isn't LIBRARY_PATH for runtime whereas LD_LIBRARY_PATH is for linking?

comment:3 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:4 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:5 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:6 Changed 4 years ago by vbraun

  • Milestone changed from sage-6.4 to sage-duplicate/invalid/wontfix
  • Resolution set to fixed
  • Status changed from new to closed

Not using LIBRARY_PATH any more

Note: See TracTickets for help on using tickets.