Skip to content

FTBFS on Solaris due to missing space #98901

@fazalmajid

Description

@fazalmajid

Bug report

The configure script is missing a space in the test for --as-needed, falsely detects the platform as supporting that GNU ld specific flag then fails later in the build with the error:

gcc -I/usr/local/include -I/usr/local/ssl/include -D__EXTENSIONS__=1 -D_XPG6=1 -D_REENTRANT -I/usr/local/include/ncurses -DHAVE_NCURSES_H=1 -DHAVE_TERM_H=1 -fno-semantic-interposition -shared -L. -L/usr/local/lib/ -L/usr/local/lib -L/usr/local/ssl/lib -L/usr/local/lib/amd64 -Wl,-R/usr/local/lib -Wl,-R/usr/local/ssl/lib -Wl,-R/usr/local/lib/amd64 -L/usr/lib -L/lib  -fno-semantic-interposition -fprofile-generate -Wl,--no-as-needed -o libpython3.so -Wl,-hlibpython3.so libpython3.11.so
ld: fatal: unrecognized option '--no-as-needed'
ld: fatal: use the -z help option for usage information

The root cause is this misdetection, because configure is doing as_fn_append LDFLAGS -Wl,--no-as-needed instead of as_fn_append LDFLAGS " -Wl,--no-as-needed" in

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wl,--no-as-needed" >&5
$as_echo_n "checking for -Wl,--no-as-needed... " >&6; }
if ${ac_cv_wl_no_as_needed+:} false; then :
  $as_echo_n "(cached) " >&6
else

  save_LDFLAGS="$LDFLAGS"
  as_fn_append LDFLAGS -Wl,--no-as-needed
  cat confdefs.h - <<_ACEOF >conftest.$ac_ext

The configure run is:

configure:6282: checking for -Wl,--no-as-needed
configure:6301: gcc -o conftest   -L. -L/usr/local/lib/ -L/usr/local/lib -L/usr/local/ssl/lib -L/usr/local/lib/amd64 -Wl,-R/usr/local/lib -Wl,-R/usr/local/ssl/lib -Wl,-R/usr/local/lib/amd64 -L/usr/lib -L/lib-Wl,--no-as-needed conftest.c  >&5
configure:6301: $? = 0
configure:6313: result: yes

Where the -Wl,--as-needed is glommed to a -L/lib flags and is thus interpreted as part of the library search path dirname to the nonsensical but harmless /lib-Wl,--as-needed that doesn't fail and thus leads to a false positive for --as-needed support.

Presumably this will also impact other platforms that don't support that flag,

Your environment

SmartOS joyent_20210520T001536Z using gcc 12.2.0 with Solaris ld

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions