boost::asio::streambuf -- linker error - gcc

I'm having trouble getting a boost program to compile. The example I'm trying to compile is here: http://rosettacode.org/wiki/Web_scraping#C.2B.2B
This is what happens when I try to compile:
% g++ -Wall test.c -lboost_regex -lboost_system -lboost_thread
/tmp/ccJSxOji.o: In function `boost::exception_detail::error_info_injector<std::length_error>::error_info_injector(boost::exception_detail::error_info_injector<std::length_error> const&)':
test.c:(.text._ZN5boost16exception_detail19error_info_injectorISt12length_errorEC2ERKS3_[_ZN5boost16exception_detail19error_info_injectorISt12length_errorEC5ERKS3_]+0x53): undefined reference to `std::length_error::~length_error()'
/tmp/ccJSxOji.o: In function `boost::exception_detail::error_info_injector<std::length_error>::~error_info_injector()':
test.c:(.text._ZN5boost16exception_detail19error_info_injectorISt12length_errorED2Ev[_ZN5boost16exception_detail19error_info_injectorISt12length_errorED5Ev]+0x2e): undefined reference to `std::length_error::~length_error()'
collect2: ld returned 1 exit status
I think I've narrowed the problem down to this line:
boost::asio::streambuf response ;
I'm using gcc 4.6.0, linux of course:
% gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-linux-gnu/4.6.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: /build/src/gcc-4.6-20110429/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --enable-gnu-unique-object --enable-linker-build-id --with-ppl --enable-cloog-backend=isl --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --disable-multilib --disable-libstdcxx-pch --enable-checking=release
Thread model: posix
gcc version 4.6.0 20110429 (prerelease) (GCC)
Possibly related thread:
Code using boost::asio::streambuf causes segfault

I hate to answer my own question, but as it turns out, I was bitten by this: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found
I did some more digging:
% ldd /usr/lib/libboost_regex.so
/usr/lib/libboost_regex.so: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/libboost_regex.so)
linux-gate.so.1 => (0xb77b3000)
libicuuc.so.46 => /usr/lib/libicuuc.so.46 (0xb7553000)
libicui18n.so.46 => /usr/lib/libicui18n.so.46 (0xb7389000)
libicudata.so.46 => /usr/lib/libicudata.so.46 (0xb650a000)
librt.so.1 => /lib/librt.so.1 (0xb6501000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb6412000)
libm.so.6 => /lib/libm.so.6 (0xb63e8000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0xb63cc000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb63b1000)
libc.so.6 => /lib/libc.so.6 (0xb624b000)
libdl.so.2 => /lib/libdl.so.2 (0xb6246000)
/lib/ld-linux.so.2 (0xb77b4000)
% ldd /usr/lib/libboost_date_time.so
/usr/lib/libboost_date_time.so: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/libboost_date_time.so)
linux-gate.so.1 => (0xb78cf000)
librt.so.1 => /lib/librt.so.1 (0xb788f000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb77a1000)
libm.so.6 => /lib/libm.so.6 (0xb7777000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0xb775b000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb773f000)
libc.so.6 => /lib/libc.so.6 (0xb75d9000)
/lib/ld-linux.so.2 (0xb78d0000)
In sum, my gcc-libs were out of date. To fix it, I did:
# pacman -Q -o /usr/lib/libstdc++.so.6
/usr/lib/libstdc++.so.6 is owned by gcc-libs 4.6.0-5
# pacman -S gcc-libs
Thanks to everyone who commented, you got me thinking in the right direction.

Related

after upgrade to gcc9.3 linking segfaults in lto-wrapper but LTO is disabled

I just upgraded gcc form 7.5 to 9.3 and started to have gcc linker segfaults - but only on armv7 target (the same all sources are building/linking OK for aarch64/x86_64 targets).
Segfault is in lto-wrapper - but I disabled LTO so I'm a bit confused....
here is gcc linking output:
armv7a-minimyth-linux-gnueabihf-g++ -v -Wl,-O1 -Wl,-rpath,/usr/lib/qt5/lib -Wl,-rpath,/usr/lib/qt5/lib -shared -Wl,-soname,libmythtv-32.so.32 -o libmythtv-32.so.32.0.0 obj/cc.o obj/vbi.o obj/lang.o obj/recordinginfo.o obj/dbcheck.o obj/videodbcheck.o obj/tvremoteutil.o obj/tv.o obj/jobqueue.o obj/recordingprofile.o obj/remoteencoder.o obj/videosource.o obj/cardutil.o obj/sourceutil.o obj/videometadatautil.o obj/vbi608extractor.o obj/cc608decoder.o obj/cc608reader.o obj/cc708decoder.o obj/cc708reader.o obj/cc708window.o obj/subtitlereader.o obj/scheduledrecording.o obj/signalmonitorvalue.o obj/livetvchain.o obj/playgroup.o obj/channelsettings.o obj/previewgenerator.o obj/previewgeneratorqueue.o obj/transporteditor.o obj/channelgroup.o obj/recordingrule.o obj/mythsystemevent.o obj/mythmediabuffer.o obj/mythavformatbuffer.o obj/mythfilebuffer.o obj/mythstreamingbuffer.o obj/mythinteractivebuffer.o obj/mythopticalbuffer.o obj/metadataimagehelper.o obj/mythframe.o obj/mythavutil.o obj/recordingfile.o obj/diseqc.o obj/diseqcsettings.o obj/mythmediawriter.o obj/mythavformatwriter.o obj/mythfifowriter.o obj/teletextdecoder.o obj/teletextreader.o obj/vbilut.o obj/tspacket.o obj/pespacket.o obj/mpegtables.o obj/atsctables.o obj/dvbtables.o obj/premieretables.o obj/sctetables.o obj/mpegstreamdata.o obj/atscstreamdata.o obj/dvbstreamdata.o obj/scanstreamdata.o obj/mpegdescriptors.o obj/atscdescriptors.o obj/dvbdescriptors.o obj/sctedescriptors.o obj/splicedescriptors.o obj/dishdescriptors.o obj/premieredescriptors.o obj/atsc_huffman.o obj/freesat_huffman.o obj/iso6937tables.o obj/H264Parser.o obj/tablestatus.o obj/tsstreamdata.o obj/frequencies.o obj/frequencytables.o obj/channelutil.o obj/channelinfo.o obj/dtvmultiplex.o obj/dtvconfparser.o obj/dtvconfparserhelpers.o obj/scaninfo.o obj/channelimporter.o obj/iptvchannelfetcher.o obj/srtwriter.o obj/mythdvdbuffer.o obj/mythdvdcontext.o obj/mythdvdinfo.o obj/mythdvdstream.o obj/mythdvdplayer.o obj/mythdvddecoder.o obj/mythbdiowrapper.o obj/mythbdbuffer.o obj/mythbdinfo.o obj/mythbdoverlay.o obj/mythbdplayer.o obj/mythbddecoder.o obj/mythbdoverlayscreen.o obj/httplivestream.o obj/httplivestreambuffer.o obj/m3u.o obj/profilegroup.o obj/tv_play.o obj/mythplayer.o obj/audioplayer.o obj/mythccextractorplayer.o obj/teletextextractorreader.o obj/playercontext.o obj/tv_play_win.o obj/deletemap.o obj/mythcommflagplayer.o obj/commbreakmap.o obj/tvbrowsehelper.o obj/netstream.o obj/mythiowrapper.o obj/textsubtitleparser.o obj/xine_demux_sputext.o obj/decoderbase.o obj/nuppeldecoder.o obj/avformatdecoder.o obj/privatedecoder.o obj/mythcodeccontext.o obj/osd.o obj/teletextscreen.o obj/subtitlescreen.o obj/interactivescreen.o obj/mythvideoout.o obj/mythvideooutnull.o obj/videobuffers.o obj/jitterometer.o obj/videodisplayprofile.o obj/mythcodecid.o obj/videooutwindow.o obj/videocolourspace.o obj/videovisual.o obj/mythdeinterlacer.o obj/mythvaapicontext.o obj/mythdrmprimecontext.o obj/mythopenglvideo.o obj/mythvideooutopengl.o obj/mythopenglinterop.o obj/mythvideotexture.o obj/mythopengltonemap.o obj/mythvaapiinterop.o obj/mythvaapiglxinterop.o obj/mythdrmprimeinterop.o obj/mythegldmabuf.o obj/mythvaapidrminterop.o obj/filters.o obj/goom_core.o obj/graphic.o obj/tentacle3d.o obj/ifs.o obj/ifs_display.o obj/lines.o obj/surf3d.o obj/zoom_filter_mmx.o obj/zoom_filter_xmmx.o obj/videovisualgoom.o obj/DetectLetterbox.o obj/mythairplayserver.o obj/mythraopdevice.o obj/mythraopconnection.o obj/dsmcc.o obj/dsmcccache.o obj/dsmccbiop.o obj/dsmccobjcarousel.o obj/mhegic.o obj/interactivetv.o obj/mhi.o obj/channelbase.o obj/dtvchannel.o obj/signalmonitor.o obj/dtvsignalmonitor.o obj/inputinfo.o obj/scanwizard.o obj/channelscan_sm.o obj/channelscanner.o obj/channelscanner_gui.o obj/channelscanner_gui_scan_pane.o obj/channelscanner_cli.o obj/frequencytablesetting.o obj/inputselectorsetting.o obj/multiplexsetting.o obj/paneanalog.o obj/scanmonitor.o obj/scanwizardconfig.o obj/externrecscanner.o obj/eithelper.o obj/eitscanner.o obj/eitfixup.o obj/eitcache.o obj/programdata.o obj/tv_rec.o obj/recordingquality.o obj/recorderbase.o obj/DeviceReadBuffer.o obj/dtvrecorder.o obj/importrecorder.o obj/RTjpegN.o obj/audioinput.o obj/audioinputalsa.o obj/audioinputoss.o obj/v4lrecorder.o obj/v4l2util.o obj/v4lchannel.o obj/analogsignalmonitor.o obj/v4l2encrecorder.o obj/v4l2encstreamhandler.o obj/v4l2encsignalmonitor.o obj/mythv4l2m2mcontext.o obj/firewirechannel.o obj/firewirerecorder.o obj/firewiresignalmonitor.o obj/firewiredevice.o obj/avcinfo.o obj/linuxfirewiredevice.o obj/linuxavcinfo.o obj/cetonrtsp.o obj/iptvchannel.o obj/iptvrecorder.o obj/iptvsignalmonitor.o obj/iptvstreamhandler.o obj/streamhandler.o obj/packetbuffer.o obj/rtppacketbuffer.o obj/httptsstreamhandler.o obj/hlsstreamhandler.o obj/HLSPlaylistWorker.o obj/HLSReader.o obj/HLSSegment.o obj/HLSStream.o obj/HLSStreamWorker.o obj/vboxutils.o obj/vboxchannelfetcher.o obj/mpegrecorder.o obj/ExternalChannel.o obj/ExternalRecChannelFetcher.o obj/ExternalRecorder.o obj/ExternalStreamHandler.o obj/ExternalSignalMonitor.o obj/dvbtypes.o obj/dvbchannel.o obj/dvbsignalmonitor.o obj/dvbcam.o obj/dvbrecorder.o obj/dvbstreamhandler.o obj/dvbci.o obj/moc_jobqueue.o obj/moc_recordingprofile.o obj/moc_videosource.o obj/moc_playgroup.o obj/moc_channelsettings.o obj/moc_previewgenerator.o obj/moc_previewgeneratorqueue.o obj/moc_transporteditor.o obj/moc_mythsystemevent.o obj/moc_diseqcsettings.o obj/moc_profilegroup.o obj/moc_tv_play.o obj/moc_tv_play_win.o obj/moc_netstream.o obj/moc_osd.o obj/moc_videooutwindow.o obj/moc_videocolourspace.o obj/moc_mythopenglvideo.o obj/moc_mythopenglinterop.o obj/moc_mythopengltonemap.o obj/moc_mythvaapiglxinterop.o obj/moc_mythairplayserver.o obj/moc_mythraopdevice.o obj/moc_mythraopconnection.o obj/moc_mhegic.o obj/moc_scanwizard.o obj/moc_channelscanner_gui.o obj/moc_channelscanner_gui_scan_pane.o obj/moc_inputselectorsetting.o obj/moc_multiplexsetting.o obj/moc_paneatsc.o obj/moc_panedvbutilsimport.o obj/moc_scanmonitor.o obj/moc_scanwizardconfig.o obj/moc_cetonrtsp.o obj/moc_iptvchannel.o obj/moc_iptvstreamhandler.o obj/moc_httptsstreamhandler.o -L/home/piotro/minimyth-dev/images/main/usr/lib -L../../external/libmythdvdnav -lmythdvdnav-32 -L../../external/libudfread -lmythudfread-32 -lva-glx -L../libmyth -L../../external/FFmpeg/libswresample -lmythswresample -L../../external/FFmpeg/libavutil -L../../external/FFmpeg/libavcodec -L../../external/FFmpeg/libavformat -L../../external/FFmpeg/libswscale -L../../external/FFmpeg/libpostproc -L../../external/FFmpeg/libavfilter -L../libmythui -L../libmythupnp -L../libmythbase -L../libmythservicecontracts -lmyth-32 -lmythswscale -lmythavformat -lmythavcodec -lmythavutil -lmythpostproc -lmythavfilter -lmythui-32 -lmythupnp-32 -lmythbase-32 -lmythservicecontracts-32 -L../libmythfreemheg -lmythfreemheg-32 -llzo2 -lXext -lXinerama -lXxf86vm -lXrandr -ldns_sd -lcrypto -lass -lEGL -lva-x11 -lX11 -lva-drm -lva -lasound -lfreetype -ldrm -lxml2 -lm -lz -lbluray -pthread -lsamplerate -lraw1394 -liec61883 -lavc1394 -lrom1394 -ldl -lpthread /home/piotro/minimyth-dev/images/main/usr/lib/qt5/lib/libQt5Widgets.so /home/piotro/minimyth-dev/images/main/usr/lib/qt5/lib/libQt5Gui.so /home/piotro/minimyth-dev/images/main/usr/lib/qt5/lib/libQt5Network.so /home/piotro/minimyth-dev/images/main/usr/lib/qt5/lib/libQt5Xml.so /home/piotro/minimyth-dev/images/main/usr/lib/qt5/lib/libQt5Sql.so /home/piotro/minimyth-dev/images/main/usr/lib/qt5/lib/libQt5Core.so -lGLESv2
Using built-in specs.
COLLECT_GCC=armv7a-minimyth-linux-gnueabihf-g++
COLLECT_LTO_WRAPPER=/home/piotro/minimyth-dev/images/build/usr/libexec/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/lto-wrapper
Target: armv7a-minimyth-linux-gnueabihf
Configured with: .//../../../work/build_main.d/gcc-9.3.0/configure --prefix=/home/piotro/minimyth-dev/images/build/usr --exec_prefix=/home/piotro/minimyth-dev/images/build/usr --bindir=/home/piotro/minimyth-dev/images/build/usr/bin --sbindir=/home/piotro/minimyth-dev/images/build/usr/sbin --libexecdir=/home/piotro/minimyth-dev/images/build/usr/libexec --datadir=/home/piotro/minimyth-dev/images/build/usr/share --sysconfdir=/home/piotro/minimyth-dev/images/build/etc --sharedstatedir=/home/piotro/minimyth-dev/images/build/usr/share --localstatedir=/home/piotro/minimyth-dev/images/build/var --libdir=/home/piotro/minimyth-dev/images/build/usr/lib --infodir=/home/piotro/minimyth-dev/images/build/usr/info --includedir=/home/piotro/minimyth-dev/images/build/usr/include --oldincludedir=/home/piotro/minimyth-dev/images/build/usr/include --mandir=/home/piotro/minimyth-dev/images/build/usr/share/man --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=armv7a-minimyth-linux-gnueabihf --with-gnu-as --with-gnu-ld --with-local-prefix=/usr --enable-plugin --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++ --enable-libatommic --enable-libgomp --enable-gold --enable-ld --disable-libquadmath --disable-libquadmath-support --disable-libada --disable-libssp --enable-lto --disable-multilib --enable-nls --enable-decimal-float --enable-shared --enable-host-shared --enable-threads=posix --enable-version-specific-runtime-libs --with-mpc-include=//home/piotro/minimyth-dev/images/build/usr/include --with-mpc-lib=//home/piotro/minimyth-dev/images/build/usr/lib --with-mpfr-include=//home/piotro/minimyth-dev/images/build/usr/include --with-mpfr-lib=//home/piotro/minimyth-dev/images/build/usr/lib --with-gmp-include=//home/piotro/minimyth-dev/images/build/usr/include --with-gmp-lib=//home/piotro/minimyth-dev/images/build/usr/lib --with-isl-include=//home/piotro/minimyth-dev/images/build/usr/include --with-isl-lib=//home/piotro/minimyth-dev/images/build/usr/lib --with-libelf-include=//home/piotro/minimyth-dev/images/build/usr/include --with-libelf-lib=//home/piotro/minimyth-dev/images/build/usr/lib --with-sysroot=/home/piotro/minimyth-dev/images/main
Thread model: posix
gcc version 9.3.0 (GCC)
COMPILER_PATH=/home/piotro/minimyth-dev/images/build/usr/libexec/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/:/home/piotro/minimyth-dev/images/build/usr/libexec/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/:/home/piotro/minimyth-dev/images/build/usr/libexec/gcc/armv7a-minimyth-linux-gnueabihf/:/home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/:/home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/:/home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/../../../../armv7a-minimyth-linux-gnueabihf/bin/
LIBRARY_PATH=/home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/:/home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/../../../../armv7a-minimyth-linux-gnueabihf/lib/:/home/piotro/minimyth-dev/images/main/lib/:/home/piotro/minimyth-dev/images/main/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-shared' '-o' 'libmythtv-32.so.32.0.0' '-L/home/piotro/minimyth-dev/images/main/usr/lib' '-L../../external/libmythdvdnav' '-L../../external/libudfread' '-L../libmyth' '-L../../external/FFmpeg/libswresample' '-L../../external/FFmpeg/libavutil' '-L../../external/FFmpeg/libavcodec' '-L../../external/FFmpeg/libavformat' '-L../../external/FFmpeg/libswscale' '-L../../external/FFmpeg/libpostproc' '-L../../external/FFmpeg/libavfilter' '-L../libmythui' '-L../libmythupnp' '-L../libmythbase' '-L../libmythservicecontracts' '-L../libmythfreemheg' '-pthread' '-shared-libgcc' '-mcpu=arm10tdmi' '-mtls-dialect=gnu' '-marm' '-march=armv5t'
/home/piotro/minimyth-dev/images/build/usr/libexec/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/collect2 -plugin /home/piotro/minimyth-dev/images/build/usr/libexec/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/liblto_plugin.so -plugin-opt=/home/piotro/minimyth-dev/images/build/usr/libexec/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccUX1bUc.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s --sysroot=/home/piotro/minimyth-dev/images/main --eh-frame-hdr -shared -X -m armelf_linux_eabi -o libmythtv-32.so.32.0.0 /home/piotro/minimyth-dev/images/main/usr/lib/crti.o /home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/crtbeginS.o -L/home/piotro/minimyth-dev/images/main/usr/lib -L../../external/libmythdvdnav -L../../external/libudfread -L../libmyth -L../../external/FFmpeg/libswresample -L../../external/FFmpeg/libavutil -L../../external/FFmpeg/libavcodec -L../../external/FFmpeg/libavformat -L../../external/FFmpeg/libswscale -L../../external/FFmpeg/libpostproc -L../../external/FFmpeg/libavfilter -L../libmythui -L../libmythupnp -L../libmythbase -L../libmythservicecontracts -L../libmythfreemheg -L/home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0 -L/home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/../../../../armv7a-minimyth-linux-gnueabihf/lib -L/home/piotro/minimyth-dev/images/main/lib -L/home/piotro/minimyth-dev/images/main/usr/lib -O1 -rpath /usr/lib/qt5/lib -rpath /usr/lib/qt5/lib -soname libmythtv-32.so.32 obj/cc.o obj/vbi.o obj/lang.o obj/recordinginfo.o obj/dbcheck.o obj/videodbcheck.o obj/httplivestreambuffer.o obj/m3u.o obj/profilegroup.o obj/tv_play.o obj/mythplayer.o obj/audioplayer.o obj/mythccextractorplayer.o obj/teletextextractorreader.o obj/playercontext.o obj/tv_play_win.o obj/deletemap.o obj/mythcommflagplayer.o obj/commbreakmap.o obj/tvbrowsehelper.o obj/netstream.o obj/mythiowrapper.o obj/textsubtitleparser.o obj/xine_demux_sputext.o obj/decoderbase.o obj/nuppeldecoder.o obj/avformatdecoder.o obj/privatedecoder.o obj/ifs_display.o obj/lines.o obj/surf3d.o obj/zoom_filter_mmx.o obj/channelscanner_gui_scan_pane.o obj/channelscanner_cli.o obj/frequencytablesetting.o obj/inputselectorsetting.o obj/multiplexsetting.o obj/paneanalog.o obj/scanmonitor.o obj/scanwizardconfig.o obj/externrecscanner.o obj/eithelper.o obj/eitscanner.o obj/eitfixup.o obj/eitcache.o obj/programdata.o obj/tv_rec.o obj/recordingquality.o obj/recorderbase.o obj/DeviceReadBuffer.o obj/dtvrecorder.o obj/importrecorder.o obj/RTjpegN.o obj/audioinput.o obj/audioinputalsa.o obj/audioinputoss.o obj/v4lrecorder.o obj/v4l2util.o obj/v4lchannel.o obj/analogsignalmonitor.o obj/v4l2encrecorder.o obj/v4l2encstreamhandler.o obj/v4l2encsignalmonitor.o obj/mythv4l2m2mcontext.o obj/firewirechannel.o obj/firewirerecorder.o obj/firewiresignalmonitor.o obj/firewiredevice.o obj/avcinfo.o obj/linuxfirewiredevice.o obj/linuxavcinfo.o obj/cetonrtsp.o obj/iptvchannel.o obj/iptvrecorder.o obj/iptvsignalmonitor.o obj/iptvstreamhandler.o obj/streamhandler.o obj/packetbuffer.o obj/rtppacketbuffer.o obj/httptsstreamhandler.o obj/hlsstreamhandler.o obj/HLSPlaylistWorker.o obj/HLSReader.o obj/HLSSegment.o obj/HLSStream.o obj/HLSStreamWorker.o obj/vboxutils.o obj/vboxchannelfetcher.o obj/mpegrecorder.o obj/ExternalChannel.o obj/ExternalRecChannelFetcher.o obj/ExternalRecorder.o obj/ExternalStreamHandler.o obj/ExternalSignalMonitor.o obj/dvbtypes.o obj/dvbchannel.o obj/dvbsignalmonitor.o obj/dvbcam.o obj/dvbrecorder.o obj/dvbstreamhandler.o obj/dvbci.o obj/moc_jobqueue.o obj/moc_recordingprofile.o obj/moc_videosource.o obj/moc_playgroup.o obj/moc_channelsettings.o obj/moc_previewgenerator.o obj/moc_previewgeneratorqueue.o obj/moc_transporteditor.o obj/moc_mythsystemevent.o obj/moc_diseqcsettings.o obj/moc_profilegroup.o obj/moc_tv_play.o obj/moc_tv_play_win.o obj/moc_netstream.o obj/moc_osd.o obj/moc_videooutwindow.o obj/moc_videocolourspace.o obj/moc_mythopenglvideo.o obj/moc_mythopenglinterop.o obj/moc_mythopengltonemap.o obj/moc_mythvaapiglxinterop.o obj/moc_mythairplayserver.o obj/moc_mythraopdevice.o obj/moc_mythraopconnection.o obj/moc_mhegic.o obj/moc_scanwizard.o obj/moc_channelscanner_gui.o obj/moc_channelscanner_gui_scan_pane.o obj/moc_inputselectorsetting.o obj/moc_multiplexsetting.o obj/moc_paneatsc.o obj/moc_panedvbutilsimport.o obj/moc_scanmonitor.o obj/moc_scanwizardconfig.o obj/moc_cetonrtsp.o obj/moc_iptvchannel.o obj/moc_iptvstreamhandler.o obj/moc_httptsstreamhandler.o -lmythdvdnav-32 -lmythudfread-32 -lva-glx -lmythswresample -lmyth-32 -lmythswscale -lmythavformat -lmythavcodec -lmythavutil -lmythpostproc -lmythavfilter -lmythui-32 -lmythupnp-32 -lmythbase-32 -lmythservicecontracts-32 -lmythfreemheg-32 -llzo2 -lXext -lXinerama -lXxf86vm -lXrandr -ldns_sd -lcrypto -lass -lEGL -lva-x11 -lX11 -lva-drm -lva -lasound -lfreetype -ldrm -lxml2 -lz -lbluray -lsamplerate -lraw1394 -liec61883 -lavc1394 -lrom1394 -ldl -lpthread /home/piotro/minimyth-dev/images/main/usr/lib/qt5/lib/libQt5Widgets.so /home/piotro/minimyth-dev/images/main/usr/lib/qt5/lib/libQt5Gui.so /home/piotro/minimyth-dev/images/main/usr/lib/qt5/lib/libQt5Network.so /home/piotro/minimyth-dev/images/main/usr/lib/qt5/lib/libQt5Xml.so /home/piotro/minimyth-dev/images/main/usr/lib/qt5/lib/libQt5Sql.so /home/piotro/minimyth-dev/images/main/usr/lib/qt5/lib/libQt5Core.so -lGLESv2 -lstdc++ -lm -lgcc_s -lpthread -lc -lgcc_s /home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/crtendS.o /home/piotro/minimyth-dev/images/main/usr/lib/crtn.o
/home/piotro/minimyth-dev/images/build/usr/libexec/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/lto-wrapper -fresolution=/tmp/ccUX1bUc.res -flinker-output=dyn /home/piotro/minimyth-dev/images/main/usr/lib/liblzo2.a#0x93a84 /home/piotro/minimyth-dev/images/main/usr/lib/liblzo2.a#0xdd748
armv7a-minimyth-linux-gnueabihf-g++ #/tmp/ccBzlLps
Using built-in specs.
COLLECT_GCC=armv7a-minimyth-linux-gnueabihf-g++
Target: armv7a-minimyth-linux-gnueabihf
Configured with: .//../../../work/build_main.d/gcc-9.3.0/configure --prefix=/home/piotro/minimyth-dev/images/build/usr --exec_prefix=/home/piotro/minimyth-dev/images/build/usr --bindir=/home/piotro/minimyth-dev/images/build/usr/bin --sbindir=/home/piotro/minimyth-dev/images/build/usr/sbin --libexecdir=/home/piotro/minimyth-dev/images/build/usr/libexec --datadir=/home/piotro/minimyth-dev/images/build/usr/share --sysconfdir=/home/piotro/minimyth-dev/images/build/etc --sharedstatedir=/home/piotro/minimyth-dev/images/build/usr/share --localstatedir=/home/piotro/minimyth-dev/images/build/var --libdir=/home/piotro/minimyth-dev/images/build/usr/lib --infodir=/home/piotro/minimyth-dev/images/build/usr/info --includedir=/home/piotro/minimyth-dev/images/build/usr/include --oldincludedir=/home/piotro/minimyth-dev/images/build/usr/include --mandir=/home/piotro/minimyth-dev/images/build/usr/share/man --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=armv7a-minimyth-linux-gnueabihf --with-gnu-as --with-gnu-ld --with-local-prefix=/usr --enable-plugin --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++ --enable-libatommic --enable-libgomp --enable-gold --enable-ld --disable-libquadmath --disable-libquadmath-support --disable-libada --disable-libssp --enable-lto --disable-multilib --enable-nls --enable-decimal-float --enable-shared --enable-host-shared --enable-threads=posix --enable-version-specific-runtime-libs --with-mpc-include=//home/piotro/minimyth-dev/images/build/usr/include --with-mpc-lib=//home/piotro/minimyth-dev/images/build/usr/lib --with-mpfr-include=//home/piotro/minimyth-dev/images/build/usr/include --with-mpfr-lib=//home/piotro/minimyth-dev/images/build/usr/lib --with-gmp-include=//home/piotro/minimyth-dev/images/build/usr/include --with-gmp-lib=//home/piotro/minimyth-dev/images/build/usr/lib --with-isl-include=//home/piotro/minimyth-dev/images/build/usr/include --with-isl-lib=//home/piotro/minimyth-dev/images/build/usr/lib --with-libelf-include=//home/piotro/minimyth-dev/images/build/usr/include --with-libelf-lib=//home/piotro/minimyth-dev/images/build/usr/lib --with-sysroot=/home/piotro/minimyth-dev/images/main
Thread model: posix
gcc version 9.3.0 (GCC)
COLLECT_GCC_OPTIONS='-c' '-fno-openmp' '-fno-openacc' '-fno-pie' '-mtune=cortex-a7' '-mfloat-abi=softfp' '-mfpu=neon-vfpv4' '-mtls-dialect=gnu' '-O2' '-v' '-shared' '-L/home/piotro/minimyth-dev/images/main/usr/lib' '-L../../external/libmythdvdnav' '-L../../external/libudfread' '-L../libmyth' '-L../../external/FFmpeg/libswresample' '-L../../external/FFmpeg/libavutil' '-L../../external/FFmpeg/libavcodec' '-L../../external/FFmpeg/libavformat' '-L../../external/FFmpeg/libswscale' '-L../../external/FFmpeg/libpostproc' '-L../../external/FFmpeg/libavfilter' '-L../libmythui' '-L../libmythupnp' '-L../libmythbase' '-L../libmythservicecontracts' '-L../libmythfreemheg' '-pthread' '-shared-libgcc' '-mcpu=arm10tdmi' '-mtls-dialect=gnu' '-marm' '-dumpdir' './' '-dumpbase' 'libmythtv-32.so.32.0.0.wpa' '-fltrans-output-list=/tmp/libmythtv-32.so.32.0.0.bfgQHe.ltrans.out' '-fwpa' '-fresolution=/tmp/ccUX1bUc.res' '-flinker-output=dyn' '-shared-libgcc' '-march=armv5t'
/home/piotro/minimyth-dev/images/build/usr/libexec/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/lto1 -quiet -dumpdir ./ -dumpbase libmythtv-32.so.32.0.0.wpa -mtune=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 -mtls-dialect=gnu -mcpu=arm10tdmi -mtls-dialect=gnu -marm -march=armv5t -auxbase liblzo2 -O2 -version -fno-openmp -fno-openacc -fno-pie -fltrans-output-list=/tmp/libmythtv-32.so.32.0.0.bfgQHe.ltrans.out -fwpa -fresolution=/tmp/ccUX1bUc.res -flinker-output=dyn #/tmp/cckNBYDe
GNU GIMPLE (GCC) version 9.3.0 (armv7a-minimyth-linux-gnueabihf)
compiled by GNU C version 9.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.18-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU GIMPLE (GCC) version 9.3.0 (armv7a-minimyth-linux-gnueabihf)
compiled by GNU C version 9.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.18-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COMPILER_PATH=/home/piotro/minimyth-dev/images/build/usr/libexec/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/:/home/piotro/minimyth-dev/images/build/usr/libexec/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/:/home/piotro/minimyth-dev/images/build/usr/libexec/gcc/armv7a-minimyth-linux-gnueabihf/:/home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/:/home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/:/home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/../../../../armv7a-minimyth-linux-gnueabihf/bin/:/home/piotro/minimyth-dev/images/build/usr/libexec/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/:/home/piotro/minimyth-dev/images/build/usr/libexec/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/:/home/piotro/minimyth-dev/images/build/usr/libexec/gcc/armv7a-minimyth-linux-gnueabihf/:/home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/:/home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/:/home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/../../../../armv7a-minimyth-linux-gnueabihf/bin/
LIBRARY_PATH=/home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/:/home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/../../../../armv7a-minimyth-linux-gnueabihf/lib/:/home/piotro/minimyth-dev/images/main/lib/:/home/piotro/minimyth-dev/images/main/usr/lib/
COLLECT_GCC_OPTIONS='-c' '-fno-openmp' '-fno-openacc' '-fno-pie' '-mtune=cortex-a7' '-mfloat-abi=softfp' '-mfpu=neon-vfpv4' '-mtls-dialect=gnu' '-O2' '-v' '-shared' '-L/home/piotro/minimyth-dev/images/main/usr/lib' '-L../../external/libmythdvdnav' '-L../../external/libudfread' '-L../libmyth' '-L../../external/FFmpeg/libswresample' '-L../../external/FFmpeg/libavutil' '-L../../external/FFmpeg/libavcodec' '-L../../external/FFmpeg/libavformat' '-L../../external/FFmpeg/libswscale' '-L../../external/FFmpeg/libpostproc' '-L../../external/FFmpeg/libavfilter' '-L../libmythui' '-L../libmythupnp' '-L../libmythbase' '-L../libmythservicecontracts' '-L../libmythfreemheg' '-pthread' '-shared-libgcc' '-mcpu=arm10tdmi' '-mtls-dialect=gnu' '-marm' '-dumpdir' './' '-dumpbase' 'libmythtv-32.so.32.0.0.wpa' '-fltrans-output-list=/tmp/libmythtv-32.so.32.0.0.bfgQHe.ltrans.out' '-fwpa' '-fresolution=/tmp/ccUX1bUc.res' '-flinker-output=dyn' '-shared-libgcc' '-march=armv5t'
armv7a-minimyth-linux-gnueabihf-g++ #/tmp/ccKCtvMG
Using built-in specs.
COLLECT_GCC=armv7a-minimyth-linux-gnueabihf-g++
Target: armv7a-minimyth-linux-gnueabihf
Configured with: .//../../../work/build_main.d/gcc-9.3.0/configure --prefix=/home/piotro/minimyth-dev/images/build/usr --exec_prefix=/home/piotro/minimyth-dev/images/build/usr --bindir=/home/piotro/minimyth-dev/images/build/usr/bin --sbindir=/home/piotro/minimyth-dev/images/build/usr/sbin --libexecdir=/home/piotro/minimyth-dev/images/build/usr/libexec --datadir=/home/piotro/minimyth-dev/images/build/usr/share --sysconfdir=/home/piotro/minimyth-dev/images/build/etc --sharedstatedir=/home/piotro/minimyth-dev/images/build/usr/share --localstatedir=/home/piotro/minimyth-dev/images/build/var --libdir=/home/piotro/minimyth-dev/images/build/usr/lib --infodir=/home/piotro/minimyth-dev/images/build/usr/info --includedir=/home/piotro/minimyth-dev/images/build/usr/include --oldincludedir=/home/piotro/minimyth-dev/images/build/usr/include --mandir=/home/piotro/minimyth-dev/images/build/usr/share/man --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=armv7a-minimyth-linux-gnueabihf --with-gnu-as --with-gnu-ld --with-local-prefix=/usr --enable-plugin --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++ --enable-libatommic --enable-libgomp --enable-gold --enable-ld --disable-libquadmath --disable-libquadmath-support --disable-libada --disable-libssp --enable-lto --disable-multilib --enable-nls --enable-decimal-float --enable-shared --enable-host-shared --enable-threads=posix --enable-version-specific-runtime-libs --with-mpc-include=//home/piotro/minimyth-dev/images/build/usr/include --with-mpc-lib=//home/piotro/minimyth-dev/images/build/usr/lib --with-mpfr-include=//home/piotro/minimyth-dev/images/build/usr/include --with-mpfr-lib=//home/piotro/minimyth-dev/images/build/usr/lib --with-gmp-include=//home/piotro/minimyth-dev/images/build/usr/include --with-gmp-lib=//home/piotro/minimyth-dev/images/build/usr/lib --with-isl-include=//home/piotro/minimyth-dev/images/build/usr/include --with-isl-lib=//home/piotro/minimyth-dev/images/build/usr/lib --with-libelf-include=//home/piotro/minimyth-dev/images/build/usr/include --with-libelf-lib=//home/piotro/minimyth-dev/images/build/usr/lib --with-sysroot=/home/piotro/minimyth-dev/images/main
Thread model: posix
gcc version 9.3.0 (GCC)
COLLECT_GCC_OPTIONS='-c' '-fno-openmp' '-fno-openacc' '-fno-pie' '-mtune=cortex-a7' '-mfloat-abi=softfp' '-mfpu=neon-vfpv4' '-mtls-dialect=gnu' '-O2' '-v' '-shared' '-L/home/piotro/minimyth-dev/images/main/usr/lib' '-L../../external/libmythdvdnav' '-L../../external/libudfread' '-L../libmyth' '-L../../external/FFmpeg/libswresample' '-L../../external/FFmpeg/libavutil' '-L../../external/FFmpeg/libavcodec' '-L../../external/FFmpeg/libavformat' '-L../../external/FFmpeg/libswscale' '-L../../external/FFmpeg/libpostproc' '-L../../external/FFmpeg/libavfilter' '-L../libmythui' '-L../libmythupnp' '-L../libmythbase' '-L../libmythservicecontracts' '-L../libmythfreemheg' '-pthread' '-shared-libgcc' '-mcpu=arm10tdmi' '-mtls-dialect=gnu' '-marm' '-dumpdir' './' '-dumpbase' 'libmythtv-32.so.32.0.0.ltrans0' '-fltrans' '-o' '/tmp/libmythtv-32.so.32.0.0.bfgQHe.ltrans0.ltrans.o' '-shared-libgcc' '-march=armv5t'
/home/piotro/minimyth-dev/images/build/usr/libexec/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/lto1 -quiet -dumpdir ./ -dumpbase libmythtv-32.so.32.0.0.ltrans0 -mtune=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 -mtls-dialect=gnu -mcpu=arm10tdmi -mtls-dialect=gnu -marm -march=armv5t -auxbase-strip /tmp/libmythtv-32.so.32.0.0.bfgQHe.ltrans0.ltrans.o -O2 -version -fno-openmp -fno-openacc -fno-pie -fltrans #/tmp/ccD9DwUp -o /tmp/ccdmhKhE.s
GNU GIMPLE (GCC) version 9.3.0 (armv7a-minimyth-linux-gnueabihf)
compiled by GNU C version 9.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.18-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU GIMPLE (GCC) version 9.3.0 (armv7a-minimyth-linux-gnueabihf)
compiled by GNU C version 9.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.18-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
In function ‘u2p’:
lto1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
lto-wrapper: fatal error: armv7a-minimyth-linux-gnueabihf-g++ returned 1 exit status
compilation terminated.
/home/piotro/minimyth-dev/images/build/usr/lib/gcc/armv7a-minimyth-linux-gnueabihf/9.3.0/../../../../armv7a-minimyth-linux-gnueabihf/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
Well - partial explanation/solution: my toolchain seems to be configured with LTO enabled by default. I'm not passing explicitly -fno-lto to turn it off at app. compilation. Adding this solves issue....

Ffmpeg ./configure not found

I'm trying to install ffmpeg with libvpx & libx264 on my vps. Centos07. I've followed these instructions https://trac.ffmpeg.org/wiki/CompilationGuide/Centos to the T.
Now when I try to run
cd ~/ffmpeg; ./configure --enable-libvpx --enable-gpl --enable-libx264
it returns
-bash: ./configure: No such file or directory
When I try ffmpeg -v
ffmpeg: error while loading shared libraries: libx264.so.148: cannot open shared object file: No such file or directory
and ldd $(which ffmpeg) returns
root#host [~/ffmpeg_sources]# ldd $(which ffmpeg)
linux-vdso.so.1 => (0x00007fff4fb86000)
libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f4972e27000)
libxcb-shm.so.0 => /lib64/libxcb-shm.so.0 (0x00007f4972c23000)
libxcb-xfixes.so.0 => /lib64/libxcb-xfixes.so.0 (0x00007f4972a1a000)
libxcb-shape.so.0 => /lib64/libxcb-shape.so.0 (0x00007f4972816000)
libx264.so.148 => not found
libm.so.6 => /lib64/libm.so.6 (0x00007f4972513000)
liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f49722ee000)
libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f49720de000)
libz.so.1 => /lib64/libz.so.1 (0x00007f4971ec7000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f4971cab000)
libc.so.6 => /lib64/libc.so.6 (0x00007f49718e9000)
libXau.so.6 => /lib64/libXau.so.6 (0x00007f49716e4000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4973056000)
I've followed all the instructions exactly - is there something I'm missing?

Missing a library in ldd after using gcc -l

I'm compiling an executable called "interrogate" with:
g++ -o built/bin/interrogate -Lbuilt/lib -Lbuilt/tmp -L/usr/X11R6/lib \
built/tmp/interrogate_composite1.o built/tmp/interrogate_composite2.o \
-lp3cppParser -lp3dtool -lp3dtoolconfig -lp3pystub -pthread -ldl
After the compilation, when i try to execute the executable:
$ LD_LIBRARY_PATH=built/lib built/bin/interrogate
built/bin/interrogate: symbol lookup error: built/lib/libp3dtool.so.1.8: undefined symbol: _Py_NoneStruct
This symbol is provided by the libp3pystub.so, but the interrogate executable doesn't have any reference to this library (I did used the -lp3pystub):
$ LD_LIBRARY_PATH=built/lib ldd built/bin/interrogate
linux-vdso.so.1 => (0x00007fff2016a000)
libp3dtool.so.1.8 => built/lib/libp3dtool.so.1.8 (0x00007f498d57a000)
libp3dtoolconfig.so.1.8 => built/lib/libp3dtoolconfig.so.1.8 (0x00007f498d51b000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f498d1f2000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f498cfdc000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f498cdbf000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f498c9ff000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f498c7fb000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f498c4ff000)
/lib64/ld-linux-x86-64.so.2 (0x00007f498d5bc000)
If i manually load the libp3pystub.so, the executable works:
$ LD_PRELOAD=built/lib/libp3pystub.so LD_LIBRARY_PATH=built/lib built/bin/interrogate
Usage:
interrogate [opts] file.C [file.C ...]
interrogate -h
My question is: why the library i've added with -lp3pystub is not referenced by the interrogate executable?
I actually find the answer myself. I was compiling on Ubuntu, and they added a default optimization flags: -Wl,--as-needed. This optimization check if no symbol from the libraries passed with -l are used in the main executable, they will be removed.
And that's where my error was: _Py_NoneStruct is not directly used by interrogate, but by another shared library. So i must manually specify that the p3pystub is needed.
One possible fix would be:
$ g++ -o built/bin/interrogate -Lbuilt/lib -Lbuilt/tmp -L/usr/X11R6/lib \
built/tmp/interrogate_composite1.o built/tmp/interrogate_composite2.o \
-Wl,--no-as-needed -lp3cppParser -lp3dtool -lp3dtoolconfig -lp3pystub \
-pthread -ldl
And then i correctly got the library in the ldd output:
$ LD_LIBRARY_PATH=built/lib ldd built/bin/interrogate
linux-vdso.so.1 => (0x00007fff0edff000)
libp3dtool.so.1.8 => built/lib/libp3dtool.so.1.8 (0x00007fa1c36be000)
libp3dtoolconfig.so.1.8 => built/lib/libp3dtoolconfig.so.1.8 (0x00007fa1c365f000)
>>> libp3pystub.so.1.8 => built/lib/libp3pystub.so.1.8 (0x00007fa1c3658000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa1c342f000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fa1c312c000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fa1c2e2f000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fa1c2c19000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa1c29fc000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa1c263c000)
/lib64/ld-linux-x86-64.so.2 (0x00007fa1c3700000)
Reference:
https://wiki.ubuntu.com/NattyNarwhal/ToolchainTransition

How to enable GMP on freebsd?

I installed swi-prolog as below:
$./configure --prefix=/home/***/swi-prolog/ --enable-gmp
$gmake && gmake check && gmake install
however, it still reports no GMP syupport:
?- random(33).
Warning: This version of SWI-Prolog is not compiled with GMP support.
Warning: Floating point random operations are not supported.
ERROR: is/2: Arithmetic: `random_float/0' is not a functionenter code here
$find /usr/local/lib -name "libgmp*"
/usr/local/lib/libgmp.so.10
/usr/local/lib/libgmp.so
/usr/local/lib/libgmp.la
/usr/local/lib/libgmpxx.so.6
/usr/local/lib/libgmpxx.so
/usr/local/lib/libgmpxx.la
/usr/local/lib/libgmp.a
/usr/local/lib/libgmpxx.a
I am using FreeBSD and swi-prolog is stable release http://www.swi-prolog.org/download/stable/src/pl-6.2.6.tar.gz .
Any suggestion is appreciated !
It is fixed by set CFLAGS and LDFLAGS:
$echo $LDFLAGS
-L/usr/local/lib
$echo $CFLAGS
-I/usr/local/include
$./configure --prefix=/home/sw2wolf/swi-prolog/ --enable-gmp
$gmake && gmake install
$ldd ~/swi-prolog/lib/swipl-6.3.8/bin/i386-freebsd9.0/swipl
**libgmp.so.10** => /usr/local/lib/libgmp.so.10 (0x2815b000)
libexecinfo.so.1 => /usr/local/lib/libexecinfo.so.1 (0x281b9000)
librt.so.1 => /usr/lib/librt.so.1 (0x281c4000)
libreadline.so.6 => /usr/local/lib/libreadline.so.6 (0x281ca000)
libncursesw.so.5.9 => /usr/local/lib/libncursesw.so.5.9 (0x281ff000)
libm.so.5 => /lib/libm.so.5 (0x28229000)
libthr.so.3 => /lib/libthr.so.3 (0x28243000)
libc.so.7 => /lib/libc.so.7 (0x28264000)
libncurses.so.8 => /lib/libncurses.so.8 (0x28383000)
libtinfow.so.5.9 => /usr/local/lib/libtinfow.so.5.9 (0x283c3000)
Regards!

How do I make the linker and loader choose a shared library at a specific path?

I wrote a code for which I have a Makefile like this:
CC=gcc
CXX=g++
DEBUG=-g
COMPILER=${CXX}
#INCLUDE= -I Re2/ -I Re2/re2/
#WARN=-Wall
spambin: main.cpp Mail.o trie.o Spambin.o config.o getdns.o
${COMPILER} ${DEBUG} ${WARN} -o spambin main.cpp Mail.o trie.o Spambin.o config.o getdns.o /usr/lib/libre2.so
trie.o: trie.cpp
${COMPILER} ${DEBUG} ${WARN} -c trie.cpp ${INCLUDE}
Mail.o: Mail.cpp
${COMPILER} ${DEBUG} ${WARN} -c Mail.cpp ${INCLUDE}
config.o: config.cpp
${COMPILER} ${DEBUG} ${WARN} -c config.cpp ${INCLUDE}
Spambin.o: Spambin.cpp
${COMPILER} ${DEBUG} ${WARN} -c Spambin.cpp ${INCLUDE}
getdns.o: getdns.c
${CC} ${DEBUG} ${WARN} -c getdns.c ${INCLUDE}
clean:
rm -f *.o
The issue I'm facing is that I want my code to directly pick the /usr/lib/libre2.so.
Doing ldd on the final output binary gives:
linux-gate.so.1 => (0x00693000)
libre2.so.0 => /usr/lib/libre2.so.0 (0x00159000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x004f4000)
libm.so.6 => /lib/libm.so.6 (0x00ce8000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x002b8000)
libc.so.6 => /lib/libc.so.6 (0x00b83000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00d13000)
/lib/ld-linux.so.2 (0x00b64000)
But when I move this file to live servers and do ldd on the binary, the result is:
linux-gate.so.1 => (0x0018b000)
libre2.so.0 => /usr/local/lib/libre2.so.0 (0x00b89000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x0040f000)
libm.so.6 => /lib/libm.so.6 (0x00ad2000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00c5e000)
libc.so.6 => /lib/libc.so.6 (0x0096c000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00ab9000)
/lib/ld-linux.so.2 (0x00949000)
The binary path is /usr/local/lib/libre2.so.0.
Is there any way we can force compiler to pick the .so file from our preferred path?
Yes, there is a way: you can specify full path to the shared library when linking,e.g.:
Let my library is: libtest2.so (it is in /projects/tests/test_so)
Let my main program cpp file is: main.cpp
Then:
g++ main.cpp -o test /projects/tests/test_so/libtest2.so
Produces binary test which has embedded absolute path /projects/tests/test_so in it. No matter where you move the test binary it will always look for /projects/tests/test_so/libtest2.so
Alternatively you may look at -rpath switch that you can use with gcc (actually it is a linker switch),e.g:
gcc -Wl,-rpath,'<path-to-lib-directory>'
But this approach may cause your program to look also for other shared libraries in <path-to-lib-directory> which may not be exactly what you want.

Resources