Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 756136 - sys-apps/gawk: failed build on macOS Big Sur (error: implicitly declaring library function 'malloc' with type 'void *(unsigned long)')
Summary: sys-apps/gawk: failed build on macOS Big Sur (error: implicitly declaring lib...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard: Workaround: compile with -Wno-implici...
Keywords:
Depends on:
Blocks: 755644
  Show dependency tree
 
Reported: 2020-11-22 22:01 UTC by Sam James
Modified: 2020-11-29 13:44 UTC (History)
1 user (show)

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


Attachments
build.log (file_756136.txt,12.97 KB, text/plain)
2020-11-22 22:01 UTC, Sam James
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-11-22 22:01:52 UTC
Created attachment 674380 [details]
build.log

gcc -DDEFPATH='".:/Users/sam/Gentoo/tmp/usr/share/awk"' -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR='"/Users/sam/Gentoo/tmp/usr/share/locale"' -I.     -g -O2 -MT getopt1.o -MD -MP -MF .deps/getopt1.Tpo -c -o getopt1.o getopt1.c
getopt.c:578:30: error: implicitly declaring library function 'malloc' with type 'void *(unsigned long)' [-Werror,-Wimplicit-function-declaration]
                struct option_list *newp = malloc (sizeof (*newp));
                                           ^
getopt.c:578:30: note: include the header <stdlib.h> or explicitly provide a declaration for 'malloc'
getopt.c:642:7: error: implicit declaration of function 'free' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                    free(ambig_list);
                    ^
2 errors generated.

----
Works fine if I swap to the latest gawk (5.1.0).
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-11-22 23:07:08 UTC
Using 5.1.0 will make Bash compilation fail though, so best to just use -Wno-implicit-function-declaration instead.
Comment 2 Jacob Floyd 2020-11-23 01:56:11 UTC
I'm not sure if I had the same problem with gawk, but gawk 4.0.1 and lower would not compile on MacOS Catalina for me.

I updated to gawk 5.1.0 and bash 5.1_rc3 (as there are several mac build issues in 5.0 that are fixed in 5.1).
https://gist.github.com/cognifloyd/f4ff46e3dcfd48ca9827c32e04a8fe90#file-bootstrap-prefix-sh-L1336
https://gist.github.com/cognifloyd/f4ff46e3dcfd48ca9827c32e04a8fe90#file-bootstrap-prefix-sh-L1350

For stage2, I had to keyword the bash 5.1_rc3 ebuild for ~x64-macos and adjust three lines:

Make the ebuild think that _rc is a release build so it uses the already compiled version of readline:

> is_release() {
>   return 0
>   ...
> }

and update the readline version so you don't have to keyword that ebuild too:

>   # The version of readline this bash normally ships with.
> - READLINE_VER="8.1_rc3"
> + READLINE_VER="8.0"

and under src_prepare, change this line (add {} as characters before/after RL_LIBSRC):

> - sed -ri -e 's:\$[(](RL|HIST)_LIBSRC[)]/[[:alpha:]]*.h::g' Makefile.in || die
> + sed -ri -e 's:\$[{(](RL|HIST)_LIBSRC[)}]/[[:alpha:]]*.h::g' Makefile.in || die
Comment 3 Fabian Groffen gentoo-dev 2020-11-23 07:31:44 UTC
(In reply to Sam James from comment #1)
> Using 5.1.0 will make Bash compilation fail though, so best to just use
> -Wno-implicit-function-declaration instead.

that our force c89 standard again instead of c99
Comment 4 Fabian Groffen gentoo-dev 2020-11-26 16:12:12 UTC
gawk is bumped for stage1.  As for the other fixes, I'll keep this bug open for a bit, I think I'm not far enough yet.
Comment 5 Fabian Groffen gentoo-dev 2020-11-29 13:44:22 UTC
I think these problems are all fixed now