* problem compiling bash-3.2.57 bash-4.4.12, seg fault
@ 2018-01-27 16:19 Po-yi Wang
2018-01-27 16:45 ` Rich Felker
0 siblings, 1 reply; 5+ messages in thread
From: Po-yi Wang @ 2018-01-27 16:19 UTC (permalink / raw)
To: musl
hi
i am attempting to statically compile bash-3.2.57 or bash-4.4.12, with
gcc-4.0.4 binutils-2.24 and musl-1.1.18 musl-gcc wrapper.
(seg fault occurred on arm target)(musl compiled with -g3)
i know they both compiled ok with other known working tools.
anyway, i run into seg fault, the problem seem too deep for me.
gdb provides little help. one clue though, the crashed program "claimed"
to see zero length file when in fact non of them are, here are some
output:
***********************************************************
* *
* GNU bash, version 4.4.12(1)-release (armv7l-unknown-linux-gnu)
* *
***********************************************************
rm -f shell.o
musl-gcc -DPROGRAM='"bash"' -DCONF_HOSTTYPE='"armv7l"'
-DCONF_OSTYPE='"linux-gnu"' -DCONF_MACHTYPE='"armv7l-unknown-linux-gnu"'
-DCONF_VENDOR='"unknown"' -DLOCALEDIR='"/usr/musl/share/locale"'
-DPACKAGE='"bash"' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib
-g -O2 -Wno-parentheses -Wno-format-security -c shell.c
shell.c: In function 'get_current_user_info':
shell.c:1777: warning: assignment discards qualifiers from pointer target
type
rm -f eval.o
musl-gcc -DPROGRAM='"bash"' -DCONF_HOSTTYPE='"armv7l"'
-DCONF_OSTYPE='"linux-gnu"' -DCONF_MACHTYPE='"armv7l-unknown-linux-gnu"'
-DCONF_VENDOR='"unknown"' -DLOCALEDIR='"/usr/musl/share/locale"'
-DPACKAGE='"bash"' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib
-g -O2 -Wno-parentheses -Wno-format-security -c eval.c
make[1]: Entering directory `/tmp/build/bash-3.2.57/bash-4.4.12/builtins'
rm -f mkbuiltins.o
musl-gcc -c -DHAVE_CONFIG_H -DSHELL -I. -I.. -I.. -I../include -I../lib
-I. -g -O2 -Wno-parentheses -Wno-format-security mkbuiltins.c
mkbuiltins.c: In function 'array_add':
mkbuiltins.c:416: warning: passing argument 1 of 'xrealloc' from
incompatible pointer type
musl-gcc -static -static -rdynamic -g -O2 -Wno-parentheses
-Wno-format-security -rdynamic -g -O2 -Wno-parentheses
-Wno-format-security -o mkbuiltins mkbuiltins.o
./mkbuiltins -externfile builtext.h -structfile builtins.c \
-noproduction -D . ./alias.def ./bind.def ./break.def ./builtin.def
./caller.def ./cd.def ./colon.def ./command.def ./declare.def ./echo.def
./enable.def ./eval.def ./getopts.def ./exec.def ./exit.def ./fc.def
./fg_bg.def ./hash.def ./help.def ./history.def ./jobs.def ./kill.def
./let.def ./read.def ./return.def ./set.def ./setattr.def ./shift.def
./source.def ./suspend.def ./test.def ./times.def ./trap.def ./type.def
./ulimit.def ./umask.def ./wait.def ./reserved.def ./pushd.def ./shopt.def
./printf.def ./complete.def ./mapfile.def
mkbuiltins: ./alias.def: skipping zero-length file
make[1]: *** [builtext.h] Segmentation fault
make[1]: *** Deleting file `builtext.h'
make[1]: Leaving directory `/tmp/build/bash-3.2.57/bash-4.4.12/builtins'
make: *** [builtins/builtext.h] Error 1
[armv7l][1] cd /build/bash-3.2.57/bash-4.4.12; cd
/tmp/build/bash-3.2.57/bash-4.
4.12/builtins
[armv7l][1] cd /tmp/build/bash-3.2.57/bash-4.4.12/builtins; gdb mkbuiltins
GNU gdb (GDB) 7.6.2
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "armv7l-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from
/tmp/build/bash-3.2.57/bash-4.4.12/builtins/mkbuiltins...done.
(gdb) run -externfile builtext.h -structfile builtins.c -noproduction -D .
./alias.def ./bind.def ./break.def ./builtin.def
Starting program: /tmp/build/bash-3.2.57/bash-4.4.12/builtins/mkbuiltins
-externfile builtext.h -structfile builtins.c -noproduction -D .
./alias.def ./bind.def ./break.def ./builtin.def
mkbuiltins: ./alias.def: skipping zero-length file
Program received signal SIGSEGV, Segmentation fault.
0x00009bc4 in main (argc=12, argv=0xbefffcd4) at mkbuiltins.c:318
318 extract_info (arg, structfile, externfile);
(gdb) bt
#0 0x00009bc4 in main (argc=12, argv=0xbefffcd4) at mkbuiltins.c:318
(gdb)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: problem compiling bash-3.2.57 bash-4.4.12, seg fault
2018-01-27 16:19 problem compiling bash-3.2.57 bash-4.4.12, seg fault Po-yi Wang
@ 2018-01-27 16:45 ` Rich Felker
2018-01-27 16:51 ` Po-yi Wang
0 siblings, 1 reply; 5+ messages in thread
From: Rich Felker @ 2018-01-27 16:45 UTC (permalink / raw)
To: musl
On Sat, Jan 27, 2018 at 08:19:55AM -0800, Po-yi Wang wrote:
> hi
>
> i am attempting to statically compile bash-3.2.57 or bash-4.4.12, with
> gcc-4.0.4 binutils-2.24 and musl-1.1.18 musl-gcc wrapper.
> (seg fault occurred on arm target)(musl compiled with -g3)
What configure command line did you use? By default bash uses (or at
least used to use) its own broken malloc replacement that's
incompatible with musl (and inherently UB). You need to disable that.
Look at the build recipe from any distro using musl, like:
https://git.alpinelinux.org/cgit/aports/tree/main/bash/APKBUILD?id=v3.7.0#n72
Rich
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: problem compiling bash-3.2.57 bash-4.4.12, seg fault
2018-01-27 16:45 ` Rich Felker
@ 2018-01-27 16:51 ` Po-yi Wang
2018-01-28 3:29 ` Will Dietz
0 siblings, 1 reply; 5+ messages in thread
From: Po-yi Wang @ 2018-01-27 16:51 UTC (permalink / raw)
To: musl
On Sat, 27 Jan 2018, Rich Felker wrote:
> On Sat, Jan 27, 2018 at 08:19:55AM -0800, Po-yi Wang wrote:
>> hi
>>
>> i am attempting to statically compile bash-3.2.57 or bash-4.4.12, with
>> gcc-4.0.4 binutils-2.24 and musl-1.1.18 musl-gcc wrapper.
>> (seg fault occurred on arm target)(musl compiled with -g3)
>
> What configure command line did you use? By default bash uses (or at
> least used to use) its own broken malloc replacement that's
> incompatible with musl (and inherently UB). You need to disable that.
> Look at the build recipe from any distro using musl, like:
WGET_UNPACK bash-3.2.57.tar.xz
LDFLAGS="-static" CC=musl-gcc ./configure --prefix=/usr/musl
--enable-static-link --disable-nls --without-bash-malloc
LDFLAGS="-static" CC=musl-gcc make
>
> https://git.alpinelinux.org/cgit/aports/tree/main/bash/APKBUILD?id=v3.7.0#n72
>
> Rich
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: problem compiling bash-3.2.57 bash-4.4.12, seg fault
2018-01-27 16:51 ` Po-yi Wang
@ 2018-01-28 3:29 ` Will Dietz
2018-01-28 6:49 ` Po-yi Wang
0 siblings, 1 reply; 5+ messages in thread
From: Will Dietz @ 2018-01-28 3:29 UTC (permalink / raw)
To: musl
For static bash I also found useful to disable loadable builtins,
which required both this patch[1] and specifying these configure overrides
(just append them to your ./configure invocation):
ac_cv_func_dlopen=no
ac_cv_func_dlclose=no
ac_cv_func_dlsym=no
Don't remember if this was to workaround a crash but maybe this helps you.
Good luck!
~Will
[1] Attachment on
https://lists.gnu.org/archive/html/bug-bash/2016-10/msg00006.html
On Sun, Jan 28, 2018 at 1:51 AM, Po-yi Wang <player@vcn.bc.ca> wrote:
>
>
> On Sat, 27 Jan 2018, Rich Felker wrote:
>
>> On Sat, Jan 27, 2018 at 08:19:55AM -0800, Po-yi Wang wrote:
>>>
>>> hi
>>>
>>> i am attempting to statically compile bash-3.2.57 or bash-4.4.12, with
>>> gcc-4.0.4 binutils-2.24 and musl-1.1.18 musl-gcc wrapper.
>>> (seg fault occurred on arm target)(musl compiled with -g3)
>>
>>
>> What configure command line did you use? By default bash uses (or at
>> least used to use) its own broken malloc replacement that's
>> incompatible with musl (and inherently UB). You need to disable that.
>> Look at the build recipe from any distro using musl, like:
>
>
> WGET_UNPACK bash-3.2.57.tar.xz
> LDFLAGS="-static" CC=musl-gcc ./configure --prefix=/usr/musl
> --enable-static-link --disable-nls --without-bash-malloc
> LDFLAGS="-static" CC=musl-gcc make
>
>
>>
>>
>> https://git.alpinelinux.org/cgit/aports/tree/main/bash/APKBUILD?id=v3.7.0#n72
>>
>> Rich
>>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: problem compiling bash-3.2.57 bash-4.4.12, seg fault
2018-01-28 3:29 ` Will Dietz
@ 2018-01-28 6:49 ` Po-yi Wang
0 siblings, 0 replies; 5+ messages in thread
From: Po-yi Wang @ 2018-01-28 6:49 UTC (permalink / raw)
To: musl
On Sun, 28 Jan 2018, Will Dietz wrote:
> For static bash I also found useful to disable loadable builtins,
> which required both this patch[1] and specifying these configure overrides
> (just append them to your ./configure invocation):
>
> ac_cv_func_dlopen=no
> ac_cv_func_dlclose=no
> ac_cv_func_dlsym=no
>
> Don't remember if this was to workaround a crash but maybe this helps you.
> Good luck!
thanks, for the hint! i will try later.
it's possible i had a broken tool combination (for arm).
(i use exact the same combination of tool for ppc,arm,486)
i missed another seg fault when building ncurses-6.0.
tic already seg faulted earlier which i missed.
i put some debug code into ncurses/tinfo/write_entry.c,
without any enlightenment.
[armv7l][1] cd /build/ncurses-6.0/misc; gdb ../progs/tic
GNU gdb (GDB) 7.6.2
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "armv7l-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /tmp/build/ncurses-6.0/progs/tic...done.
(gdb) run -x -s -o /usr/musl/share/terminfo terminfo.tmp
Starting program: /tmp/build/ncurses-6.0/misc/../progs/tic -x -s -o
/usr/musl/share/terminfo terminfo.tmp
debug:[&][(null)]
Program received signal SIGSEGV, Segmentation fault.
0x00028998 in _nc_write_entry (tp=0x67de0)
at ../ncurses/./tinfo/write_entry.c:414
414 while (*other_names != '\0') {
(gdb) bt
#0 0x00028998 in _nc_write_entry (tp=0x67de0)
at ../ncurses/./tinfo/write_entry.c:414
#1 0x00008648 in write_it (ep=0x67de0) at ../progs/tic.c:237
#2 0x0000a4c0 in main (argc=6, argv=0xbefffbf4) at ../progs/tic.c:977
#############################################################
WGET_UNPACK ncurses-6.0.tar.xz
LDFLAGS="-static" CC=musl-gcc ./configure --prefix=/usr/musl
--disable-nls --disable-macros # --enable-widec
LDFLAGS="-static" CC=musl-gcc make
LDFLAGS="-static" CC=musl-gcc make install
[ -e /usr/musl/lib/libncurses.a ] || INTERVENTION $LINENO
ln -sfvn libncurses.a /usr/musl/lib/libtermcap.a
#############################################################
>
> ~Will
>
> [1] Attachment on
> https://lists.gnu.org/archive/html/bug-bash/2016-10/msg00006.html
>
> On Sun, Jan 28, 2018 at 1:51 AM, Po-yi Wang <player@vcn.bc.ca> wrote:
>>
>>
>> On Sat, 27 Jan 2018, Rich Felker wrote:
>>
>>> On Sat, Jan 27, 2018 at 08:19:55AM -0800, Po-yi Wang wrote:
>>>>
>>>> hi
>>>>
>>>> i am attempting to statically compile bash-3.2.57 or bash-4.4.12, with
>>>> gcc-4.0.4 binutils-2.24 and musl-1.1.18 musl-gcc wrapper.
>>>> (seg fault occurred on arm target)(musl compiled with -g3)
>>>
>>>
>>> What configure command line did you use? By default bash uses (or at
>>> least used to use) its own broken malloc replacement that's
>>> incompatible with musl (and inherently UB). You need to disable that.
>>> Look at the build recipe from any distro using musl, like:
>>
>>
>> WGET_UNPACK bash-3.2.57.tar.xz
>> LDFLAGS="-static" CC=musl-gcc ./configure --prefix=/usr/musl
>> --enable-static-link --disable-nls --without-bash-malloc
>> LDFLAGS="-static" CC=musl-gcc make
>>
>>
>>>
>>>
>>> https://git.alpinelinux.org/cgit/aports/tree/main/bash/APKBUILD?id=v3.7.0#n72
>>>
>>> Rich
>>>
>>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-01-28 6:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-27 16:19 problem compiling bash-3.2.57 bash-4.4.12, seg fault Po-yi Wang
2018-01-27 16:45 ` Rich Felker
2018-01-27 16:51 ` Po-yi Wang
2018-01-28 3:29 ` Will Dietz
2018-01-28 6:49 ` Po-yi Wang
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).