Menu

#198 Makefile.linux is not multiarch aware

1.13.1
open
None
7
2015-08-11
2012-08-21
No

Problem: "make install" on a 64-bit Ubuntu system will install to a directory where libraries are never looked for. Apps compiled against GLEW headers will fail when they can't find the shared library.

On a 32-bit architecture, Makefile.linux sets LIBDIR=$(GLEW_DEST)/lib. On a 64-bit architecture, Makefile.linux sets LIBDIR=$(GLEW_DEST)/lib64. This is only correct on Linux systems that adhere to the Filesystem Hierarchy Standard... which unfortunately never really became a standard. Non-standard systems include Debian and Ubuntu, the latter of which is the most popular Linux distro by a large margin. Debian-based systems, and possibly some others, are using a convention called "multiarch." Or trying to. I'm still going up a learning curve on these issues. I'm not sure what to recommend for a "correct" solution. An update to the FHS is in progress. CMake might have some code that automagically deals with this issue.

Discussion

  • Nigel Stewart

    Nigel Stewart - 2012-08-23

    Thanks for the report.

     
    • Brandon J. Van Every

      This is still true 1 year later. I had forgotten about this bug and got burned by it again when trying to build CEGUI, which has GLEW as a dependency. Had to rediscover it, although at least I had a vague memory of the problem.

       
  • Brandon J. Van Every

    Multiarch support is actually pretty recent and the powers-that-be haven't decided on standard query tools for it. The more pragmatic approach would be to ignore multiarch and just use "lsb_release -s -i" to identify the name of the specific system being used. For instance on Lubuntu this yields "Ubuntu". This will work on old Debian-based systems that don't have multiarch support, and it'll work on new multiarch systems for now, until the powers-that-be decide what the canonical tools should be. Basically, on a 64-bit Debian-based system you don't put the libs in /lib64, you put 'em in /lib. I'll work up a script in a few days to do this.

     
  • Brandon J. Van Every

    The following modification to config/Makefile.linux is working for me.

    USE_LIB64 = false
    M_ARCH ?= $(shell uname -m)

    is this the only 64-bit architecture we need to check? Not sure.

    ifeq (x86_64,${M_ARCH})
    DISTRO ?= $(shell lsb_release -s -i)

    Some 64-bit distros do not follow FSB conventions and do not use a /lib64 directory

    Add more distros here if needed

    DOES_NOT_USE_LIB64 = Debian Ubuntu
    ifeq (,$(findstring ${DISTRO},${DOES_NOT_USE_LIB64}))
    USE_LIB64 = true
    endif
    endif
    ifeq (${USE_LIB64},true)
    LDFLAGS.EXTRA = -L/usr/X11R6/lib64 -L/usr/lib64
    LIBDIR = $(GLEW_DEST)/lib64
    else
    LDFLAGS.EXTRA = -L/usr/X11R6/lib -L/usr/lib
    LIBDIR = $(GLEW_DEST)/lib
    endif

     
  • Nigel Stewart

    Nigel Stewart - 2012-11-11
    • milestone: --> 1.9.2
     
  • Nigel Stewart

    Nigel Stewart - 2013-08-23
    • Group: 10.10.1 --> 1.10.2
     
  • Nigel Stewart

    Nigel Stewart - 2014-08-12
    • Group: 1.10.2 --> 1.11.2
     
  • Nigel Stewart

    Nigel Stewart - 2015-08-11
    • Group: 1.12.1 --> 1.13.1
     
MongoDB Logo MongoDB