public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iain Sandoe <idsandoe@googlemail.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org,
	Rainer Orth <ro@cebitec.uni-bielefeld.de>
Subject: Re: [PATCH] libstdc++: Fix error shown during Solaris build
Date: Fri, 13 Nov 2020 11:22:32 +0000	[thread overview]
Message-ID: <FE90EBC2-620C-415F-8936-ADEC726A284A@googlemail.com> (raw)
In-Reply-To: <20201113111644.GH503596@redhat.com>

Jonathan Wakely <jwakely@redhat.com> wrote:

> On 13/11/20 11:07 +0000, Jonathan Wakely wrote:
>> Currently this is shown when building libstdc++ on Solaris:
>>
>> -lrt: open: No such file or directory
>>
>> The error comes from the make_sunver.pl script which tries to open each
>> of its arguments. The arguments are passed by this make rule:
>>
>> 	perl ${glibcxx_srcdir}/scripts/make_exports.pl \
>> 	  libstdc++-symbols.ver \
>> 	  $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \
>> 	 `echo $(libstdc___la_LIBADD) | \
>> 	    sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
>> 	 > $@ || (rm -f $@ ; exit 1)
>>
>> The $(libstdc___la_LIBADD) variable includes $(GLIBCXX_LIBS) which
>> contains -lrt on Solaris.
>>
>> This patch adds another sed script to filter -l arguments from the echo
>> command. In order to reliably match ' -l[^ ]* ' the echo arguments are
>> quoted and a space added before and after them. This might be overkill
>> just to remove -lrt from the start of the string, but should be robust
>> in case other -l arguments are added to $(GLIBCXX_LIBS), or in case the
>> $(libstdc___la_LIBADD) libraries are reordered.
>>
>> libstdc++-v3/ChangeLog:
>>
>> 	* src/Makefile.am (libstdc++-symbols.ver-sun): Remove -lrt from
>> 	arguments passed to make_sunver.pl script.
>> 	* src/Makefile.in: Regenerate.
>>
>> Tested sparc-solaris2.11. Rainer, does this look OK?
>>
>> Iain, the libstdc++-symbols.explist target for Darwin is very similar,
>> but I don't know if it's a problem there. Does GLIBCXX_LIBS contain
>> anything in $target/libstdc++-v3/src/Makefile on Darwin?
>>
>> Should we make the same change just in case?
>
> On examining acinclude.m4 it looks like GLIBCXX_LIBS could in theory
> be non-empty for any target, including Darwin:
>
>  elif test x"$enable_libstdcxx_time" != x"no"; then
>
>    if test x"$enable_libstdcxx_time" = x"rt"; then
>      AC_SEARCH_LIBS(clock_gettime, [rt posix4])
>      AC_SEARCH_LIBS(nanosleep, [rt posix4])
>    else
>      AC_SEARCH_LIBS(clock_gettime, [posix4])
>      AC_SEARCH_LIBS(nanosleep, [posix4])
>    fi
>
>    case "$ac_cv_search_clock_gettime" in
>      -l*) GLIBCXX_LIBS=$ac_cv_search_clock_gettime
>      ;;
>    esac
>    case "$ac_cv_search_nanosleep" in
>      -l*) GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_nanosleep"
>      ;;
>    esac
>
>    AC_SEARCH_LIBS(sched_yield, [rt posix4])
>
>    case "$ac_cv_search_sched_yield" in
>      -lposix4*)
>      GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield"
>      ac_has_sched_yield=yes
>      ;;
>      -lrt*)
>      if test x"$enable_libstdcxx_time" = x"rt"; then
> 	GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield"
>        ac_has_sched_yield=yes
>      fi
>      ;;
>      *)
>      ac_has_sched_yield=yes
>      ;;
>    esac
>
> But in practice the snippet above is only used if you explicitly
> configure with --enable-libstdcxx-time={yes,rt} and will only add
> anything to GLIBCXX_LIBS if clock_gettime or nanosleep lives in one of
> librt or libposix4. I think libposix4 is Solaris-specific, and I don't
> think Darwin has librt. So in practice I don't think there's a
> problem on Darwin today.

Agreed, neither of those libs is currently in use on Darwin.

There have, in some cases, been library entries that are simply a symlink to
the one providing the equivalent functionality, to minimize cross-platform  
build
hassles - but I see no entry for librt.dylib or posix4.

thanks
Iain



  reply	other threads:[~2020-11-13 11:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13 11:07 Jonathan Wakely
2020-11-13 11:16 ` Jonathan Wakely
2020-11-13 11:22   ` Iain Sandoe [this message]
2020-11-16 10:23   ` Rainer Orth
2020-11-16 10:28     ` Jonathan Wakely
2020-11-16 10:17 ` Rainer Orth
2020-11-16 10:32   ` Jonathan Wakely
2020-11-16 10:37     ` Jonathan Wakely
2020-11-16 11:47       ` Rainer Orth
2020-11-16 11:46     ` Rainer Orth
2020-11-16 11:54       ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FE90EBC2-620C-415F-8936-ADEC726A284A@googlemail.com \
    --to=idsandoe@googlemail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    --cc=ro@cebitec.uni-bielefeld.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).