Commit 8447e23a authored by Nicolas Wavrant's avatar Nicolas Wavrant

gcc: add LD_LIBRARY_PATH to environment

to avoid issues with libraries not found
parent 3a2a20ed
......@@ -32,6 +32,7 @@ configure-options =
--with-as=${binutils:location}/bin/as
environment =
LDFLAGS=-Wl,-rpath=${gmp:location}/lib -Wl,-rpath=${isl:location}/lib -Wl,-rpath=${mpc:location}/lib -Wl,-rpath=${mpfr:location}/lib
LD_LIBRARY_PATH=${ncurses:location}/lib:${gettext:location}/lib
PATH=${binutils:location}/bin:${perl:location}/bin:${tar:location}/bin:%(PATH)s
[gcc-minimal]
......
  • Hmm... Why you think ncurses and gettext are needed to 'build' (not use) gcc ? Can you show me error / warning messages related to them ?

    FYI, https://gcc.gnu.org/install/prerequisites.html says gettext is needed to modify gcc and says nothing for ncurses.

  • @kazuhiko :

    Here is the log of the SR's build if I build ERP5 from master :

    [2018-01-11 15:20:42,139] INFO     Making all in po
    [2018-01-11 15:20:42,142] INFO     make[4]: Entering directory '/srv/slapgrid/slappart18/srv/runner/software/323ab596c3badd0e464cfd5b3f48515c/parts/gcc__compile__/gcc-5.4.0/x86_64-unknown-linux-gnu/libstdc++-v3/po'
    [2018-01-11 15:20:42,145] INFO     msgfmt -o de.mo ../../.././libstdc++-v3/po/de.po
    [2018-01-11 15:20:42,214] INFO     msgfmt: error while loading shared libraries: libncurses.so.6: cannot open shared object file: No such file or directory
    [2018-01-11 15:20:42,214] INFO     Makefile:494: recipe for target 'de.mo' failed
    [2018-01-11 15:20:42,214] INFO     make[4]: *** [de.mo] Error 127
    [2018-01-11 15:20:42,215] INFO     make[4]: Leaving directory '/srv/slapgrid/slappart18/srv/runner/software/323ab596c3badd0e464cfd5b3f48515c/parts/gcc__compile__/gcc-5.4.0/x86_64-unknown-linux-gnu/libstdc++-v3/po'
    [2018-01-11 15:20:42,215] INFO     Makefile:507: recipe for target 'all-recursive' failed
    [2018-01-11 15:20:42,216] INFO     make[3]: *** [all-recursive] Error 1
    [2018-01-11 15:20:42,216] INFO     make[3]: Leaving directory '/srv/slapgrid/slappart18/srv/runner/software/323ab596c3badd0e464cfd5b3f48515c/parts/gcc__compile__/gcc-5.4.0/x86_64-unknown-linux-gnu/libstdc++-v3'
    [2018-01-11 15:20:42,216] INFO     Makefile:414: recipe for target 'all' failed
    [2018-01-11 15:20:42,217] INFO     make[2]: *** [all] Error 2
    [2018-01-11 15:20:42,217] INFO     make[2]: Leaving directory '/srv/slapgrid/slappart18/srv/runner/software/323ab596c3badd0e464cfd5b3f48515c/parts/gcc__compile__/gcc-5.4.0/x86_64-unknown-linux-gnu/libstdc++-v3'
    [2018-01-11 15:20:42,217] INFO     Makefile:10215: recipe for target 'all-target-libstdc++-v3' failed
    [2018-01-11 15:20:42,218] INFO     make[1]: *** [all-target-libstdc++-v3] Error 2
    [2018-01-11 15:20:42,218] INFO     make[1]: Leaving directory '/srv/slapgrid/slappart18/srv/runner/software/323ab596c3badd0e464cfd5b3f48515c/parts/gcc__compile__/gcc-5.4.0'
    [2018-01-11 15:20:42,219] INFO     Makefile:875: recipe for target 'all' failed
    [2018-01-11 15:20:42,219] INFO     make: *** [all] Error 2
    [2018-01-11 15:20:42,220] INFO     gcc: Command failed with exit code 2: make 
    [2018-01-11 15:20:42,220] INFO     gcc: Compilation error. The package is left as is at /srv/slapgrid/slappart18/srv/runner/software/323ab596c3badd0e464cfd5b3f48515c/parts/gcc__compile__/gcc-5.4.0 where you can inspect what went wrong
    [2018-01-11 15:20:42,507] INFO     While:
    [2018-01-11 15:20:42,508] INFO       Installing.
    [2018-01-11 15:20:42,508] INFO       Installing gcc.
    [2018-01-11 15:20:42,557] INFO     Error: System error
    [2018-01-11 15:20:42,653] ERROR    Failed to run buildout profile in directory '/srv/slapgrid/slappart18/srv/runner/software/323ab596c3badd0e464cfd5b3f48515c'
    [2018-01-11 15:20:42,660] DEBUG    Restore umask from 027 to 022
    [2018-01-11 15:20:43,291] ERROR    

    Once I've added LD_LIBRARY_PATH=${ncurses:location}/lib to the gcc component, I get the same kind of issue, but with one of the libs provided by gettext.

    The build environment is debian stretch, built with debootstrap.

  • Also, at the moment of the build of gcc, ncurses is already built (there exists the directory parts/ncurses, containing the shared libraries).

  • I see. Maybe adding --disable-nls in configure option will solve the issue, I guess

    But ncurses and gettext are really common pieces and you can merge this change.

  • Wait...

    msgfmt: error while loading shared libraries

    Which msgfmt is used here ? If it is system one, we should have no library issue. If it is slapos one (though such path is not listed in gcc/buildout.cfg), such error means 'missing RPATH' in msgfmt. So anyway something seems wrong.

  • @nexedi I found that this is an issue in slapos package.

    [2018-01-11 14:46:49,852] INFO     Installing gcc.
    ...
    [2018-01-11 14:46:49,854] INFO     gcc: [ENV] PATH = /srv/slapgrid/slappart18/srv/runner/softwar
    e/323ab596c3badd0e464cfd5b3f48515c/parts/binutils/bin:/srv/slapgrid/slappart18/srv/runner/softwa
    re/323ab596c3badd0e464cfd5b3f48515c/parts/perl/bin:/srv/slapgrid/slappart18/srv/runner/software/
    323ab596c3badd0e464cfd5b3f48515c/parts/tar/bin:/opt/slapos/parts/bison/bin:/opt/slapos/parts/bzi
    p2/bin:/opt/slapos/parts/gettext/bin:/opt/slapos/parts/glib/bin:/opt/slapos/parts/libxml2/bin:/o
    pt/slapos/parts/libxslt/bin:/opt/slapos/parts/m4/bin:/opt/slapos/parts/ncurses/bin:/opt/slapos/p
    arts/openssl/bin:/opt/slapos/parts/pkgconfig/bin:/opt/slapos/parts/python2.7/bin:/opt/slapos/par
    ts/readline/bin:/opt/slapos/parts/sqlite3/bin:/opt/slapos/parts/swig/bin:/opt/slapos/bin:/opt/sl
    apos/parts/patch/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin:/bin/
    :/opt/slapgrid/631b3b5bd37740e113f4dd5be336844b/parts/nano/bin:/opt/slapgrid/631b3b5bd37740e113f
    4dd5be336844b/parts/vim/bin:/opt/slapgrid/631b3b5bd37740e113f4dd5be336844b/parts/screen/bin:/opt
    /slapgrid/631b3b5bd37740e113f4dd5be336844b/parts/git/bin:/opt/slapgrid/631b3b5bd37740e113f4dd5be
    336844b/parts/tig/bin

    Here, /opt/slapos/parts/gettext/bin/megfmt is used that has RPATH issue.

    $ ldd /opt/slapos/parts/gettext/bin/msgfmt|grep not.found                                       
            libncurses.so.6 => not found                                                            
            libintl.so.8 => not found
    $ readelf -d /opt/slapos/parts/gettext/bin/msgfmt | grep RUNPATH                                
     0x000000000000001d (RUNPATH)            Library runpath: [/usr/src/packages/BUILD/slapos/build/
    opt/slapos/parts/libxml2/lib:/usr/src/packages/BUILD/slapos/build/opt/slapos/parts/zlib/lib:/usr
    /src/packages/BUILD/slapos/build/opt/slapos/parts/ncurses/lib:/usr/src/packages/BUILD/slapos/bui
    ld/opt/slapos/parts/gettext/lib]

    You can see that RPATH is where the package is built not where the package will be used, these two are same in normal buildout usage, but different in slapos package.

    And this issue exists not only for gettext.

    $ find /opt/slapos -type f -executable|xargs ldd|& egrep '(^/opt|not found)'|grep -B1 'not found'|grep '^/opt'|cut -d / -f 5|sort -u
    dbus-glib                                                                                       
    gdbm                                                                                            
    gettext                                                                                         
    glib                                                                                            
    gobject-introspection                                                                           
    ncurses                                                                                         
    pcre                                                                                            
    sqlite3                                                                                         
  • @jm notified us that the issue with slapos-node package has already been fixed in nexedi/slapos.package@043ad231, and a version of slapos-node package embeeding this change has already been released.

    Also it made us realise that the gettext built in the SR should be used over the system one, so on Kazuhiko's advice a commit fixing this behavior has been merged to master : nexedi/slapos@41a23d65

Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment