Skip to content

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

@nexttime

Description

@nexttime
mannequin

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).

Component: build

Keywords: CPATH LIBRARY_PATH SAGE_LOCAL -I -L sage-env search directories paths

Issue created by migration from https://trac.sagemath.org/ticket/14709

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions