Re: ld: error: unable to find library -lstdc++

From: Herbert J. Skuhra <herbert_at_gojira.at>
Date: Fri, 03 Mar 2023 14:54:58 UTC
On Fri, Mar 03, 2023 at 12:55:43PM +0300, Odhiambo Washington wrote:
> 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
> 
> --8<---------------cut here---------------start------------->8---
> depbase=`echo xapian_wrap.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`; /bin/sh
> ../libtool  --tag=CXX    --mode=compile c++ -DHAVE_CONFIG_H  -I. -I..
>  -I/usr/local/include/python3.9   -fno-strict-aliasing -Wall -Wno-unused
> -Wno-uninitialized -fvisibility=hidden -fvisibility-inlines-hidden
> -I/opt/mailman/mm/venv/include -g -O2 -MT xapian_wrap.lo -MD -MP -MF
> $depbase.Tpo -c -o xapian_wrap.lo xapian_wrap.cc && mv -f $depbase.Tpo
> $depbase.Plo
> libtool: compile:  c++ -DHAVE_CONFIG_H -I. -I..
> -I/usr/local/include/python3.9 -fno-strict-aliasing -Wall -Wno-unused
> -Wno-uninitialized -fvisibility=hidden -fvisibility-inlines-hidden
> -I/opt/mailman/mm/venv/include -g -O2 -MT xapian_wrap.lo -MD -MP -MF
> .deps/xapian_wrap.Tpo -c xapian_wrap.cc  -fPIC -DPIC -o .libs/xapian_wrap.o
> /bin/sh ../libtool  --tag=CXX    --mode=link c++ -fno-strict-aliasing -Wall
> -Wno-unused -Wno-uninitialized -fvisibility=hidden
> -fvisibility-inlines-hidden -I/opt/mailman/mm/venv/include  -g -O2
> -avoid-version -module -shrext ".cpython-39.so"   -o _xapian.la -rpath
> /opt/mailman/mm/venv/lib/python3.9/site-packages/xapian xapian_wrap.lo
> -L/opt/mailman/mm/venv/lib -lxapian -lstdc++
> libtool: link: c++  -fPIC -DPIC -shared -nostdlib /usr/lib/crti.o
> /usr/lib/crtbeginS.o  .libs/xapian_wrap.o   -Wl,-rpath
> -Wl,/opt/mailman/mm/venv/lib -Wl,-rpath -Wl,/opt/mailman/mm/venv/lib
> -L/opt/mailman/mm/venv/lib /opt/mailman/mm/venv/lib/libxapian.so -lz -lrt
> -lstdc++ -L/usr/lib -lc++ -lm -lc -lgcc -lgcc_s /usr/lib/crtendS.o
> /usr/lib/crtn.o  -g -O2   -Wl,-soname -Wl,_xapian.cpython-39.so -o .libs/_
> xapian.cpython-39.so
> ld: error: unable to find library -lstdc++
> c++: error: linker command failed with exit code 1 (use -v to see
> invocation)
> *** Error code 1
> 
> Stop.
> make[3]: stopped in
> /opt/mailman/mm/venv/packages/xapian-bindings-1.4.21/python3
> *** Error code 1
> 
> Stop.
> make[2]: stopped in
> /opt/mailman/mm/venv/packages/xapian-bindings-1.4.21/python3
> *** Error code 1
> 
> Stop.
> make[1]: stopped in /opt/mailman/mm/venv/packages/xapian-bindings-1.4.21
> *** Error code 1
> 
> Stop.
> make: stopped in /opt/mailman/mm/venv/packages/xapian-bindings-1.4.21
> 
> --8<---------------cuthere----------------end--------------->8---

The port databases/py-xapian does:

post-patch:
        @${REINPLACE_CMD} -e 's|-lstdc++||g' ${WRKSRC}/configure

So you can try to add

sed -i.bak -e 's|-lstdc++||g' configure

before line 45 of install_xapian.sh. 

-- 
Herbert