Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 703132 - dev-embedded/u-boot-tools-2019.10 - error: unknown type name 'ulong'; did you mean 'long'?
Summary: dev-embedded/u-boot-tools-2019.10 - error: unknown type name 'ulong'; did you...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Embedded Gentoo Team
URL: https://lists.denx.de/pipermail/u-boo...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-16 18:49 UTC by eroen
Modified: 2019-12-17 19:49 UTC (History)
2 users (show)

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


Attachments
build.log (build.log,16.30 KB, text/x-log)
2019-12-16 18:49 UTC, eroen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description eroen 2019-12-16 18:49:57 UTC
Created attachment 599858 [details]
build.log

In file included from tools/env/../../env/flags.c:7,
                 from tools/env/env_flags.c:1:
include/env.h:159:1: error: unknown type name 'ulong'; did you mean 'long'?
  159 | ulong env_get_ulong(const char *name, int base, ulong default_val);
      | ^~~~~
      | long
include/env.h:159:49: error: unknown type name 'ulong'; did you mean 'long'?
  159 | ulong env_get_ulong(const char *name, int base, ulong default_val);
      |                                                 ^~~~~
      |                                                 long
include/env.h:168:40: error: unknown type name 'ulong'; did you mean 'long'?
  168 | int env_set_ulong(const char *varname, ulong value);
      |                                        ^~~~~
      |                                        long
include/env.h:180:1: error: unknown type name 'ulong'; did you mean 'long'?
  180 | ulong env_get_hex(const char *varname, ulong default_val);
      | ^~~~~
      | long
include/env.h:180:40: error: unknown type name 'ulong'; did you mean 'long'?
  180 | ulong env_get_hex(const char *varname, ulong default_val);
      |                                        ^~~~~
      |                                        long
include/env.h:189:38: error: unknown type name 'ulong'; did you mean 'long'?
  189 | int env_set_hex(const char *varname, ulong value);
      |                                      ^~~~~
      |                                      long
include/env.h: In function 'env_set_addr':
include/env.h:200:31: error: 'ulong' undeclared (first use in this function)
  200 |  return env_set_hex(varname, (ulong)addr);
      |                               ^~~~~
include/env.h:200:31: note: each undeclared identifier is reported only once for each function it appears in
include/env.h:200:37: error: expected ')' before 'addr'
  200 |  return env_set_hex(varname, (ulong)addr);
      |                                     ^~~~
      |                                     )
make[1]: *** [scripts/Makefile.host:114: tools/env/env_flags.o] Error 1
make: *** [Makefile:1819: envtools] Error 2
make: *** Waiting for unfinished jobs....
  aarch64-linux-musl-gcc -Wp,-MD,scripts/dtc/.srcpos.o.d -O2      -Iscripts/dtc -Iscripts/dtc/libfdt -c -o scripts/dtc/srcpos.o scripts/dtc/srcpos.c
  aarch64-linux-musl-gcc -Wp,-MD,scripts/dtc/.checks.o.d -O2      -Iscripts/dtc -Iscripts/dtc/libfdt -c -o scripts/dtc/checks.o scripts/dtc/checks.c
  aarch64-linux-musl-gcc -Wp,-MD,scripts/dtc/.util.o.d -O2      -Iscripts/dtc -Iscripts/dtc/libfdt -c -o scripts/dtc/util.o scripts/dtc/util.c
  flex -oscripts/dtc/dtc-lexer.lex.c -L scripts/dtc/dtc-lexer.l
  bison -o/dev/null --defines=scripts/dtc/dtc-parser.tab.h -t -l scripts/dtc/dtc-parser.y
  bison -oscripts/dtc/dtc-parser.tab.c -t -l scripts/dtc/dtc-parser.y
  aarch64-linux-musl-gcc -Wp,-MD,scripts/dtc/.dtc-lexer.lex.o.d -O2      -Iscripts/dtc -Iscripts/dtc/libfdt -c -o scripts/dtc/dtc-lexer.lex.o scripts/dtc/dtc-lexer.lex.c
  aarch64-linux-musl-gcc -Wp,-MD,scripts/dtc/.dtc-parser.tab.o.d -O2      -Iscripts/dtc -Iscripts/dtc/libfdt -c -o scripts/dtc/dtc-parser.tab.o scripts/dtc/dtc-parser.tab.c
  aarch64-linux-musl-gcc -Wl,-O1 -Wl,--as-needed -o scripts/dtc/dtc scripts/dtc/dtc.o scripts/dtc/flattree.o scripts/dtc/fstree.o scripts/dtc/data.o scripts/dtc/livetree.o scripts/dtc/treesource.o scripts/dtc/srcpos.o scripts/dtc/checks.o scripts/dtc/util.o scripts/dtc/dtc-lexer.lex.o scripts/dtc/dtc-parser.tab.o  
 * ERROR: dev-embedded/u-boot-tools-2019.10::gentoo failed (compile phase):
 *   emake failed
Comment 1 eroen 2019-12-16 19:03:21 UTC
pine64 ~ # emerge --info '=dev-embedded/u-boot-tools-2019.10::gentoo'
Portage 2.3.80 (python 3.7.5-final-0, default/linux/arm64/17.0/musl/hardened, gcc-9.2.0, musl-1.1.24, 5.0.9-gentoo aarch64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.0.9-gentoo-aarch64-with-gentoo-2.6
KiB Mem:     2050376 total,   1823756 free
KiB Swap:    4194300 total,   4194300 free
Timestamp of repository musl: Sun, 15 Dec 2019 19:27:23 +0000
Head commit of repository musl: bad1ef361f173aef9fd1e588f85f78fbc4ae9cca

Timestamp of repository gentoo: Mon, 16 Dec 2019 13:30:01 +0000
Head commit of repository gentoo: e98fbd578b78f92cd3ab376c9b076e8049029e8b
sh bash 5.0_p11
ld GNU ld (Gentoo 2.33.1 p1) 2.33.1
app-shells/bash:          5.0_p11::gentoo
dev-lang/perl:            5.30.1::gentoo
dev-lang/python:          3.7.5-r1::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.69-r5::gentoo
sys-devel/automake:       1.16.1-r2::gentoo
sys-devel/binutils:       2.33.1::gentoo
sys-devel/gcc:            9.2.0-r2::gentoo
sys-devel/gcc-config:     2.1::gentoo
sys-devel/libtool:        2.4.6-r5::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.3-r1::gentoo (virtual/os-headers)
sys-libs/musl:            1.1.24::gentoo
Repositories:

musl
    location: /var/db/repos/musl
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/musl.git
    masters: gentoo
    priority: 100

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: 200
    sync-rsync-verify-jobs: 1
    sync-rsync-extra-opts: 
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: yes

ACCEPT_KEYWORDS="arm64 ~arm64"
ACCEPT_LICENSE="@FREE"
CBUILD="aarch64-linux-musl"
CFLAGS="-O2"
CHOST="aarch64-linux-musl"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2"
DISTDIR="/usr/portage/distfiles"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="charset.alias"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="arm64 bzip2 crypt cxx hardened iconv ipv6 libtirpc minimal ncurses nptl openmp pic pie readline seccomp split-usr ssl ssp unicode xattr xtpax" ADA_TARGET="gnat_2018" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_ARM="edsp neon thumb thumb2 v4 v5 v6 v7 v8 vfp vfp-d32 vfpv3 vfpv4" ELIBC="musl" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python3_7" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="fbdev dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, LANG, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

pine64 ~ # emerge -pqv '=dev-embedded/u-boot-tools-2019.10::gentoo'
[ebuild     U ] dev-embedded/u-boot-tools-2019.10 [2019.01]
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2019-12-16 20:03:03 UTC
Fails the same on amd64-musl. arm64-glibc works fine. Must be libc-specific.
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2019-12-16 20:22:13 UTC
Upstream might have already fixed it with https://github.com/u-boot/u-boot/commit/664689f1dcb178ccb36842d0564ea8a6e8a7e648 . Checking locally.
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2019-12-16 23:03:57 UTC
(In reply to Sergei Trofimovich from comment #3)
> Upstream might have already fixed it with
> https://github.com/u-boot/u-boot/commit/
> 664689f1dcb178ccb36842d0564ea8a6e8a7e648 . Checking locally.

Bad luck. That commit is already included in the tarball.

The failure happens due to undeclared 'ulong' type. On glibc it comes from <sys/types.h>:

```c
#ifdef __USE_MISC
/* Old compatibility names for C types.  */
typedef unsigned long int ulong;
#endif
```

On musl it comes from <sys/types.h> as well but from under different guards:

```c
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
typedef unsigned long u_long, ulong;
#endif
```

u-boot's include/compiler.h does not include it explicitly and does not define any of those macros.

We can work it around by blanket-defining _GNU_SOURCE (of _BSD_SOURCE). Or by unconditionally providing an ulong typedef. I hope it's definition is unambiguous enough :)
Comment 5 Larry the Git Cow gentoo-dev 2019-12-16 23:15:16 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=069a96a2ea5aaa7d4d27d2423f4a1845663272eb

commit 069a96a2ea5aaa7d4d27d2423f4a1845663272eb
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2019-12-16 23:14:56 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2019-12-16 23:15:10 +0000

    dev-embedded/u-boot-tools: fix build on musl, bug #703132
    
    include/compiler.h implies to define 'ulong' type.
    glibc and musl define it on different conditions.
    As a result tools fail to build on musl as:
        include/env.h:159:1: error: unknown type name 'ulong'; did you mean 'long'?
    
    We fix it by defining 'ulong' unconditionally (as on BSD).
    
    Reported-by: eroen
    Closes: https://bugs.gentoo.org/703132
    Package-Manager: Portage-2.3.82, Repoman-2.3.20
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 .../files/u-boot-tools-2019.10-musl-ulong.patch       | 19 +++++++++++++++++++
 dev-embedded/u-boot-tools/u-boot-tools-2019.10.ebuild |  2 ++
 2 files changed, 21 insertions(+)
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2019-12-17 19:49:42 UTC
Proposed similar patch upstream as:
    https://lists.denx.de/pipermail/u-boot/2019-December/394037.html