Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 893958 - app-shells/bash-3.2_p57 and older fail to build with gcc-13 on ~arm64
Summary: app-shells/bash-3.2_p57 and older fail to build with gcc-13 on ~arm64
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: lto gcc-13 c99-porting
  Show dependency tree
 
Reported: 2023-02-11 21:00 UTC by Roy Bamford
Modified: 2024-03-12 00:28 UTC (History)
1 user (show)

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


Attachments
app-shells:bash-2.05b_p13:20230206-210446.log (app-shells:bash-2.05b_p13:20230206-210446.log,97.84 KB, text/x-log)
2023-02-12 17:31 UTC, Roy Bamford
Details
app-shells:bash-3.0_p22:20230206-210446.log (app-shells:bash-3.0_p22:20230206-210446.log,114.33 KB, text/x-log)
2023-02-12 17:32 UTC, Roy Bamford
Details
app-shells:bash-3.1_p23:20230206-214058.log (app-shells:bash-3.1_p23:20230206-214058.log,116.08 KB, text/x-log)
2023-02-12 17:33 UTC, Roy Bamford
Details
app-shells:bash-3.2_p57:20230206-214058.log (app-shells:bash-3.2_p57:20230206-214058.log,120.34 KB, text/x-log)
2023-02-12 17:35 UTC, Roy Bamford
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roy Bamford gentoo-dev 2023-02-11 21:00:29 UTC
*  (app-shells/bash-2.05b_p13:2.05b/2.05b::gentoo, ebuild scheduled for merge), Log file:
 *   '/var/log/portage/app-shells:bash-2.05b_p13:20230206-210446.log'
 *  (app-shells/bash-3.0_p22:3.0/3.0::gentoo, ebuild scheduled for merge), Log file:
 *   '/var/log/portage/app-shells:bash-3.0_p22:20230206-210446.log'
 *  (app-shells/bash-3.1_p23:3.1/3.1::gentoo, ebuild scheduled for merge), Log file:
 *   '/var/log/portage/app-shells:bash-3.1_p23:20230206-214058.log'
 *  (app-shells/bash-3.2_p57:3.2/3.2::gentoo, ebuild scheduled for merge), Log file:
 *   '/var/log/portage/app-shells:bash-3.2_p57:20230206-214058.log'

I suspect that the solution is to use contemporary toolchains, not fix old bash versions.
Log files are not attached but can be provided on request.
Comment 1 Mike Gilbert gentoo-dev 2023-02-11 22:10:41 UTC
This bug report contains no useful information. Please attach the logs.
Comment 2 Roy Bamford gentoo-dev 2023-02-12 17:31:52 UTC
Created attachment 850528 [details]
app-shells:bash-2.05b_p13:20230206-210446.log
Comment 3 Roy Bamford gentoo-dev 2023-02-12 17:32:42 UTC
Created attachment 850530 [details]
app-shells:bash-3.0_p22:20230206-210446.log
Comment 4 Roy Bamford gentoo-dev 2023-02-12 17:33:33 UTC
Created attachment 850532 [details]
app-shells:bash-3.1_p23:20230206-214058.log
Comment 5 Roy Bamford gentoo-dev 2023-02-12 17:35:11 UTC
Created attachment 850534 [details]
app-shells:bash-3.2_p57:20230206-214058.log
Comment 6 Roy Bamford gentoo-dev 2023-02-12 17:37:31 UTC
My apologies for the presumption that there would be no interest in keeping these old version of bash alive.
Comment 7 Eli Schwartz 2024-03-11 20:24:48 UTC
Taking 3.1 as a random example here:

execute_cmd.c:3905:25: warning: implicit declaration of function ‘__setostype’ [-Wimplicit-function-declaration]


This is actually becoming a fatal error in gcc 14, basically exactly because of the error you're getting here.

Which I suspect is *precisely* that you were using LTO, and the optimizer choked when it couldn't find the definition of the function. Indeed, later on:

/usr/lib/gcc/aarch64-unknown-linux-gnu/13/../../../../aarch64-unknown-linux-gnu/bin/ld: /var/tmp/portage/app-shells/bash-3.2_p57/temp/ccCDPZns.ltrans1.ltrans.o: in function `shell_execve':
<artificial>:(.text+0x4274): undefined reference to `__setostype'
/usr/lib/gcc/aarch64-unknown-linux-gnu/13/../../../../aarch64-unknown-linux-gnu/bin/ld: <artificial>:(.text+0x4298): undefined reference to `__setostype'


I suspect all the issues will go away if you patch these older bash versions to include the correct headers.
Comment 8 Eli Schwartz 2024-03-11 20:28:25 UTC
Sorry, when I said "taking 3.1 as a random example" what I meant to say is, I tried compiling 3.1 and got a bunch of -Werror=implicit-function-declaration failures since I'm running the c99-porting detection *FLAGS.




shell.c: In function ‘main’:
shell.c:704:7: error: implicit declaration of function ‘get_tty_state’ [-Werror=implicit-function-declaration]
  704 |       get_tty_state ();
      |       ^~~~~~~~~~~~~
shell.c: In function ‘shell_initialize’:
shell.c:1662:3: error: implicit declaration of function ‘initialize_job_control’ [-Werror=implicit-function-declaration]
 1662 |   initialize_job_control (0);
      |   ^~~~~~~~~~~~~~~~~~~~~~
./parse.y: In function ‘shell_getc’:
./parse.y:1928:11: error: implicit declaration of function ‘cleanup_dead_jobs’ [-Werror=implicit-function-declaration]
 1928 |           cleanup_dead_jobs ();
      |           ^~~~~~~~~~~~~~~~~
./parse.y: In function ‘decode_prompt_string’:
./parse.y:4272:28: error: implicit declaration of function ‘count_all_jobs’ [-Werror=implicit-function-declaration]
 4272 |               temp = itos (count_all_jobs ());
      |                            ^~~~~~~~~~~~~~



And your error matches up to:


execute_cmd.c: In function ‘shell_execve’:
execute_cmd.c:3813:25: error: implicit declaration of function ‘__setostype’ [-Werror=implicit-function-declaration]
 3813 | #  define SETOSTYPE(x)  __setostype(x)
      |                         ^~~~~~~~~~~
execute_cmd.c:3844:3: note: in expansion of macro ‘SETOSTYPE’
 3844 |   SETOSTYPE (0);                /* Some systems use for USG/POSIX semantics */
      |   ^~~~~~~~~

And some more fun bits.
Comment 9 Larry the Git Cow gentoo-dev 2024-03-12 00:28:59 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6eea46091ef4e2f853c746f4544858bc79f63a73

commit 6eea46091ef4e2f853c746f4544858bc79f63a73
Author:     Eli Schwartz <eschwartz93@gmail.com>
AuthorDate: 2024-03-11 23:54:05 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-03-12 00:28:41 +0000

    app-shells/bash: mark as LTO-unsafe in particularly old versions
    
    Due to implicit function declarations, LTO fails to detect the
    availability of a function and errors out due to an undefined reference
    at link time.
    
    It's fixed in bash 4.0 and on, but the value of backporting the fix to
    versions of bash that have niche use (people interested in exploring old
    versions, not people who are looking for the shebang interpreter for
    their system scripts) is a matter of some question...
    
    Closes: https://bugs.gentoo.org/893958
    Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 app-shells/bash/bash-2.05b_p13.ebuild | 8 +++++++-
 app-shells/bash/bash-3.0_p22.ebuild   | 8 +++++++-
 app-shells/bash/bash-3.1_p23.ebuild   | 8 +++++++-
 app-shells/bash/bash-3.2_p57.ebuild   | 8 +++++++-
 4 files changed, 28 insertions(+), 4 deletions(-)