Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 03 Mar 2023 16:20:46 +0100
From:      Jan Beich <jbeich@FreeBSD.org>
To:        Odhiambo Washington <odhiambo@gmail.com>
Cc:        questions <questions@freebsd.org>
Subject:   Re: ld: error: unable to find library -lstdc++
Message-ID:  <8rgd-dfox-wny@FreeBSD.org>
In-Reply-To: <CAAdA2WO8Viy3Yy4GeVJxm9jZ9eqAUqzX9dPTt2v2HT5BLwBNww@mail.gmail.com> (Odhiambo Washington's message of "Fri, 3 Mar 2023 12:55:43 %2B0300")
References:  <CAAdA2WO8Viy3Yy4GeVJxm9jZ9eqAUqzX9dPTt2v2HT5BLwBNww@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail

Odhiambo Washington <odhiambo@gmail.com> writes:

> Hi,
> FreeBSD-13.1-RELEASE here.
>
> I am installing Xapian within a virtual environment and I am getting stuck
>
> It might help to mention that I am using the script at:
> https://github.com/notanumber/xapian-haystack/blob/master/install_xapian.sh

-lstdc++ is part of lang/gcc* but FreeBSD >= 10 ships Clang with -lc++ instead.
C++ compiler automatically adds -lstdc++ or -lc++ unless -nostdlib or -nostdlib++.
Modern Clang converts -lstdc++ into -lc++ unless -nostdlib or -nostdlib++.
xapian-bindings uses libtool which adds -nostdlib and uses autoconf to detect
GCC which includes Clang due to __GNUC__ defined for compatibility.

Why not use ports/packages where this is already solved?

>From databases/py-xapian/Makefile
  post-patch:
  	@${REINPLACE_CMD} -e 's|-lstdc++||g' ${WRKSRC}/configure

Alternatively, replace -lstdc++ with -lc++ in Clang via environ(7)

  $ export CCC_OVERRIDE_OPTIONS='# s/stdc\+\+/c++/' # sh(1) style
  $ setenv CCC_OVERRIDE_OPTIONS '# s/stdc\+\+/c++/' # csh(1) style


help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8rgd-dfox-wny>