On a musl based system I cannot emerge figlet, I get a compilation error due to utf8.h:30:1: error: unknown type name ‘__BEGIN_DECLS’. This seems to be a bug in upstream figlet (which seems unmaintained). ``` gentoobb-bob-musl:20170127 config # emerge figlet Calculating dependencies... done! >>> Verifying ebuild manifests >>> Emerging (1 of 1) app-misc/figlet-2.2.5::gentoo >>> Downloading 'http://distfiles.gentoo.org/distfiles/figlet-2.2.5.tar.gz' --2017-02-04 06:39:54-- http://distfiles.gentoo.org/distfiles/figlet-2.2.5.tar.gz Resolving distfiles.gentoo.org... 137.226.34.46, 156.56.247.195, 140.211.166.134, ... Connecting to distfiles.gentoo.org|137.226.34.46|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 233201 (228K) [application/octet-stream] Saving to: '/usr/portage/distfiles/figlet-2.2.5.tar.gz' /usr/portage/distfi 100%[===================>] 227.74K 111KB/s in 2.0s 2017-02-04 06:39:57 (111 KB/s) - '/usr/portage/distfiles/figlet-2.2.5.tar.gz' saved [233201/233201] * figlet-2.2.5.tar.gz SHA256 SHA512 WHIRLPOOL size ;-) ... [ ok ] >>> Unpacking source... >>> Unpacking figlet-2.2.5.tar.gz to /var/tmp/portage/app-misc/figlet-2.2.5/work >>> Source unpacked in /var/tmp/portage/app-misc/figlet-2.2.5/work >>> Preparing source in /var/tmp/portage/app-misc/figlet-2.2.5/work/figlet-2.2.5 ... >>> Source prepared. >>> Configuring source in /var/tmp/portage/app-misc/figlet-2.2.5/work/figlet-2.2.5 ... >>> Source configured. >>> Compiling source in /var/tmp/portage/app-misc/figlet-2.2.5/work/figlet-2.2.5 ... make -j2 clean rm -f *.o *~ core figlet chkfont make -j2 CC=x86_64-gentoo-linux-musl-gcc LD=x86_64-gentoo-linux-musl-gcc 'CFLAGS=-O2 -pipe' 'LDFLAGS=-Wl,-O1 -Wl,--as-needed' prefix=/usr all x86_64-gentoo-linux-musl-gcc -c -O2 -pipe -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \ -DDEFAULTFONTFILE=\"standard\" -o figlet.o figlet.c x86_64-gentoo-linux-musl-gcc -c -O2 -pipe -DTLF_FONTS -DDEFAULTFONTDIR=\"/usr/share/figlet\" \ -DDEFAULTFONTFILE=\"standard\" -o zipio.o zipio.c In file included from figlet.c:77:0: utf8.h:30:1: error: unknown type name ‘__BEGIN_DECLS’ __BEGIN_DECLS ^ utf8.h:32:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘utf8_to_wchar’ size_t utf8_to_wchar(const char *in, size_t insize, wchar_t *out, ^ In file included from figlet.c:80:0: zipio.h:76:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘typedef’ typedef struct { ^ figlet.c: In function ‘skiptoeol’: zipio.h:82:11: error: ‘ZFILE’ has no member named ‘len’ ((--((f)->len) >= 0) \ ^ figlet.c:357:16: note: in expansion of macro ‘Zgetc’ while (dummy=Zgetc(fp),dummy!=EOF) { ^ zipio.h:83:27: error: ‘ZFILE’ has no member named ‘ptr’ ? (unsigned char)(*(f)->ptr++) \ ^ figlet.c:357:16: note: in expansion of macro ‘Zgetc’ while (dummy=Zgetc(fp),dummy!=EOF) { ^ zipio.h:82:11: error: ‘ZFILE’ has no member named ‘len’ ((--((f)->len) >= 0) \ ^ figlet.c:360:15: note: in expansion of macro ‘Zgetc’ dummy = Zgetc(fp); ^ zipio.h:83:27: error: ‘ZFILE’ has no member named ‘ptr’ ? (unsigned char)(*(f)->ptr++) \ ^ figlet.c:360:15: note: in expansion of macro ‘Zgetc’ dummy = Zgetc(fp); ^ zipio.h:87:7: error: ‘ZFILE’ has no member named ‘ptr’ ((f)->ptr--, (f)->len++, (c)) ^ figlet.c:361:42: note: in expansion of macro ‘Zungetc’ if (dummy != EOF && dummy != '\n') Zungetc(dummy,fp); zipio.h:87:19: error: ‘ZFILE’ has no member named ‘len’ ((f)->ptr--, (f)->len++, (c)) ^ figlet.c:361:42: note: in expansion of macro ‘Zungetc’ if (dummy != EOF && dummy != '\n') Zungetc(dummy,fp); ^ figlet.c: In function ‘myfgets’: zipio.h:82:11: error: ‘ZFILE’ has no member named ‘len’ ((--((f)->len) >= 0) \ ^ figlet.c:385:12: note: in expansion of macro ‘Zgetc’ while((c=Zgetc(fp))!=EOF&&maxlen) { ^ zipio.h:83:27: error: ‘ZFILE’ has no member named ‘ptr’ ? (unsigned char)(*(f)->ptr++) \ ^ figlet.c:385:12: note: in expansion of macro ‘Zgetc’ while((c=Zgetc(fp))!=EOF&&maxlen) { ^ zipio.h:82:11: error: ‘ZFILE’ has no member named ‘len’ ((--((f)->len) >= 0) \ ^ figlet.c:390:11: note: in expansion of macro ‘Zgetc’ c = Zgetc(fp); ^ zipio.h:83:27: error: ‘ZFILE’ has no member named ‘ptr’ ? (unsigned char)(*(f)->ptr++) \ ^ figlet.c:390:11: note: in expansion of macro ‘Zgetc’ c = Zgetc(fp); ^ zipio.h:87:7: error: ‘ZFILE’ has no member named ‘ptr’ ((f)->ptr--, (f)->len++, (c)) ^ figlet.c:391:34: note: in expansion of macro ‘Zungetc’ if (c != EOF && c != '\n') Zungetc(c,fp); ``` figlet shouldn't be using __BEGIN_DECLS ccording to the musl FAQ http://wiki.musl-libc.org/wiki/FAQ#Q:_I.27m_trying_to_compile_something_against_musl_and_I_get_error_messages_about_sys.2Fcdefs.h It states: - ``` Until it gets fixed, patch the program to remove the include line and replace all occurences of: __BEGIN_DECLS with #ifdef __cplusplus extern "C" { #endif and all occurences of __END_DECLS with #ifdef __cplusplus } #endif ``` I see that Alpine Linux's APORTS patches figlet to resolve this issue. https://github.com/alpinelinux/aports/blob/master/main/figlet/musl-fix-cplusplus-decls.patch It seems that upstream figlet is unmaintained. I think the ebuild should be updated to apply the same or similar patch that Alpine/Aport's does to fix this issue so that it's possible to emerge figlet on a musl based system. My emerge --info: - ``` gentoobb-bob-musl:20170127 figlet-2.2.5 # emerge --info Portage 2.3.1 (python 2.7.12-final-0, hardened/linux/musl/amd64, gcc-4.9.4, musl-1.1.15-r2, 4.4.39-gentoo x86_64) ================================================================= System uname: Linux-4.4.39-gentoo-x86_64-Intel-R-_Core-TM-_M-5Y71_CPU_@_1.20GHz-with-gentoo-2.3 KiB Mem: 4048004 total, 2521680 free KiB Swap: 2097148 total, 2095484 free Timestamp of repository gentoo: Fri, 03 Feb 2017 00:45:01 +0000 sh bash 4.3_p48-r1 ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1 distcc 3.2rc1 x86_64-gentoo-linux-musl [disabled] app-shells/bash: 4.3_p48-r1::gentoo dev-lang/perl: 5.22.3_rc4::gentoo dev-lang/python: 2.7.12::gentoo, 3.4.5::gentoo dev-util/pkgconfig: 0.28-r2::gentoo sys-apps/baselayout: 2.3::gentoo sys-apps/openrc: 0.22.4::gentoo sys-apps/sandbox: 2.10-r1::musl sys-devel/autoconf: 2.69::gentoo sys-devel/automake: 1.14.1::gentoo, 1.15::gentoo sys-devel/binutils: 2.25.1-r1::gentoo sys-devel/gcc: 4.9.4-r99::musl sys-devel/gcc-config: 1.7.3::gentoo sys-devel/libtool: 2.4.6-r2::gentoo sys-devel/make: 4.1-r1::gentoo sys-kernel/linux-headers: 4.4::musl (virtual/os-headers) sys-libs/musl: 1.1.15-r2::gentoo Repositories: gentoo location: /usr/portage sync-type: rsync sync-uri: rsync://rsync.europe.gentoo.org/gentoo-portage priority: -1000 musl location: /var/lib/layman/musl masters: gentoo priority: 50 ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-gentoo-linux-musl" CFLAGS="-O2 -pipe" CHOST="x86_64-gentoo-linux-musl" CONFIG_PROTECT="/etc" 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 -pipe" DISTDIR="/usr/portage/distfiles" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict u nknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" INSTALL_MASK="charset.alias" LANG="en_US.UTF-8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" PKGDIR="/packages/x86_64-gentoo-linux-musl" 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=/dist files --exclude=/local --exclude=/packages --exclude=/.git" PORTAGE_TMPDIR="/var/tmp" USE="amd64 bindist cli cracklib crypt cxx dri fortran hardened iconv modules nls nptl openmp pax_kernel pcre pic readline seccomp session ssl tcpd threads unicode xattr zlib" ABI_X8 6="64" 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_gr oupfile 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_confi g logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables kr ita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="musl" GPSD_PROTOCOLS="ashtech aivdm earth mate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt u blox ubx" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presente r-console presenter-minimizer" LINGUAS="en" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGE TS="ruby21" USERLAND="GNU" VIDEO_CARDS="dummy fbdev v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal r awnat logmark ipmark dhcpmac delude chaos account" Unset: CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, LC_ALL, MAKEOPTS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON ```
(In reply to Berne Campbell from comment #0) > On a musl based system I cannot emerge figlet, I get a compilation error due > to utf8.h:30:1: error: unknown type name ‘__BEGIN_DECLS’. This seems to be a > bug in upstream figlet (which seems unmaintained). Replace all instances of __BEGIN_DECLS with #ifdef __cplusplus extern "C" { #endif and __END_DECLS with #ifdef __cplusplus } #endif If you want to prepare a patch, I can test and with Jeroen's permission commit or at least add it to the musl overlay.
Created attachment 682867 [details, diff] Proposed Patch
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ff505acf8b6e0cdf3edcee56d58079f4e4b17a31 commit ff505acf8b6e0cdf3edcee56d58079f4e4b17a31 Author: David Seifert <soap@gentoo.org> AuthorDate: 2021-05-01 18:05:31 +0000 Commit: David Seifert <soap@gentoo.org> CommitDate: 2021-05-01 18:05:31 +0000 app-misc/figlet: fix building on musl * The patch is from Alpine and the ebuild changes are not copyrightable. Closes: https://github.com/gentoo/gentoo/pull/20385 Closes: https://bugs.gentoo.org/608172 Package-Manager: Portage-3.0.18, Repoman-3.0.3 Signed-off-by: David Seifert <soap@gentoo.org> app-misc/figlet/figlet-2.2.5-r1.ebuild | 2 ++ app-misc/figlet/files/figlet-2.2.5-musl.patch | 36 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+)