Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 446080 - sys-devel/llvm: fails to build on a uclibc system
Summary: sys-devel/llvm: fails to build on a uclibc system
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Michał Górny
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: systemwide-clang uclibc-porting
  Show dependency tree
 
Reported: 2012-12-05 12:02 UTC by Anthony Basile
Modified: 2016-07-03 07:42 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Basile gentoo-dev 2012-12-05 12:02:36 UTC
There are probably multiple issues but this one was hit as part of bug #317635 in which clamav fails to build on a ulibc system because it bundles llvm.  This issue is due to a redefinition of error_t.  Fixing it is sufficient to fix llvm buils for clamav but may not be sufficient for llvm upstream.

Here is the last few lines of the build failure:

llvm[1]: Compiling DynamicLibrary.cpp for Release build
if  x86_64-gentoo-linux-uclibc-g++ -I/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/include -I/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support  -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS   -fvisibility-inlines-hidden -fno-exceptions -fPIC -Woverloaded-virtual -Wcast-qual -O2 -pipe  -I/usr/lib/libffi-3.0.11/include    -Wall -W -Wno-unused-parameter -Wwrite-strings -c -MMD -MP -MF "/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support/Release/DynamicLibrary.d.tmp" -MT "/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support/Release/DynamicLibrary.o" -MT "/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support/Release/DynamicLibrary.d" DynamicLibrary.cpp -o /var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support/Release/DynamicLibrary.o ; \
        then /bin/mv -f "/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support/Release/DynamicLibrary.d.tmp" "/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support/Release/DynamicLibrary.d"; else /bin/rm "/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support/Release/DynamicLibrary.d.tmp"; exit 1; fi
llvm[1]: Compiling Errno.cpp for Release build
if  x86_64-gentoo-linux-uclibc-g++ -I/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/include -I/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support  -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS   -fvisibility-inlines-hidden -fno-exceptions -fPIC -Woverloaded-virtual -Wcast-qual -O2 -pipe  -I/usr/lib/libffi-3.0.11/include    -Wall -W -Wno-unused-parameter -Wwrite-strings -c -MMD -MP -MF "/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support/Release/Errno.d.tmp" -MT "/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support/Release/Errno.o" -MT "/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support/Release/Errno.d" Errno.cpp -o /var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support/Release/Errno.o ; \
        then /bin/mv -f "/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support/Release/Errno.d.tmp" "/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support/Release/Errno.d"; else /bin/rm "/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support/Release/Errno.d.tmp"; exit 1; fi
In file included from Errno.cpp:22:0:
/usr/include/errno.h:70:13: error: multiple types in one declaration
/usr/include/errno.h:70:13: error: declaration does not declare anything [-fpermissive]
/bin/rm: cannot remove '/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support/Release/Errno.d.tmp': No such file or directory
make[1]: *** [/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support/Release/Errno.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src/lib/Support'
make: *** [all] Error 1
 * ERROR: sys-devel/llvm-3.2_rc2 failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of `emerge --info '=sys-devel/llvm-3.2_rc2'`,
 * the complete build log and the output of `emerge -pqv '=sys-devel/llvm-3.2_rc2'`.
 * The complete build log is located at '/var/tmp/portage/sys-devel/llvm-3.2_rc2/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-devel/llvm-3.2_rc2/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src'
 * S: '/var/tmp/portage/sys-devel/llvm-3.2_rc2/work/llvm.src'


Reproducible: Always
Comment 1 Anthony Basile gentoo-dev 2012-12-05 12:14:19 UTC
Here's an analysis of the problem using llvm-3.2_rc2.  This comes with

    llvm.src/autoconf/m4/ltdl.m4

with versioning

     # serial 7 AC_LIB_LTDL

Note that the most current version shipping with libtools is 

    # serial 18 LTDL_INIT

The older ltdl.m4 (but not the newer one) defines

    # AC_LTDL_FUNC_ARGZ
    # -----------------
    AC_DEFUN([AC_LTDL_FUNC_ARGZ],
    [AC_CHECK_HEADERS([argz.h])

    AC_CHECK_TYPES([error_t],
      [],
      [AC_DEFINE([error_t], [int],
        [Define to a type to use for `error_t' if it is not otherwise available.])],
      [#if HAVE_ARGZ_H
    #  include <argz.h>
    #endif])

AC_CHECK_FUNCS([argz_append argz_create_sep argz_insert argz_next argz_stringify])
])# AC_LTDL_FUNC_ARGZ


which assumes that error_t is provided by argz.h which is not present on a uclibc system.  There error_t is provided by errno.h when #define _GNU_SOURCE.  So the suggested fix is (thanks for the help Diego!)


    # AC_LTDL_FUNC_ARGZ
    # -----------------
    AC_DEFUN([AC_LTDL_FUNC_ARGZ],
    [AC_CHECK_HEADERS([argz.h errno.h])

    AC_CHECK_TYPES([error_t],
      [],
      [AC_DEFINE([error_t], [int],
        [Define to a type to use for `error_t' if it is not otherwise available.])],
      [#if HAVE_ARGZ_H
    #  include <argz.h>
    #endif
    #if HAVE_ERRNO_H
    #  define _GNU_SOURCE
    #  include <errno.h>
    #endif])

    AC_CHECK_FUNCS([argz_append argz_create_sep argz_insert argz_next argz_stringify])
    ])# AC_LTDL_FUNC_ARGZ

and then pushed through their build system.  However, llvm should probably seriously consider updating their build system, as even "pushing this through" requires ancient autotools.
Comment 2 Anthony Basile gentoo-dev 2012-12-05 12:15:22 UTC
@Diego, notice I had to #define _GNU_SOURCE in the includes for AC_CHECK_TYPES.  Is that okay?
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-07-03 07:42:58 UTC
I'm sorry but this one is ancient and I don't have any uclibc around to play with. If you have issues with the current versions, please let me know -- but you'll probably need a patch ;-).