I am trying to compile a program written in C++ using the lpsolve external library.
I have written the following line in my .cpp :
#include</var/lib/lpsolve/lp_lib.h>
However, when I'm trying to compile this using g++, I get this weird message :
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/liblpsolve55.so when searching for -llpsolve55
/usr/bin/ld: skipping incompatible /usr/lib/../lib/liblpsolve55.so when searching for -llpsolve55
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/5/../../../liblpsolve55.so when searching for -llpsolve55
/usr/bin/ld: skipping incompatible //usr/local/lib/liblpsolve55.so when searching for -llpsolve55
/usr/bin/ld: skipping incompatible //usr/local/lib/liblpsolve55.a when searching for -llpsolve55
/usr/bin/ld: skipping incompatible //usr/lib/liblpsolve55.so when searching for -llpsolve55
/usr/bin/ld: cannot find -llpsolve55
/usr/bin/ld: cannot find -lcolamd
collect2: error: ld returned 1 exit status
I tried many different things... Even tried to install the library manually, by downloading it from sourceforge taking care of the right version (dev-ux64 in my case) and it seems like none of the solutions I've found on the internet are working ...
By the way, I am using the following command to compile my program :
g++ prog.cpp -llpsolve55 -lcolamd -ldl -o MyExe
EDIT : after specifying the path to the librairies explicitly, i get this :
/tmp/ccIvoPiS.o: In function `main':
flot_max.cpp:(.text+0x36): undefined reference to `make_lp'
flot_max.cpp:(.text+0xd7): undefined reference to `set_int'
flot_max.cpp:(.text+0x159): undefined reference to `set_maxim'
flot_max.cpp:(.text+0x16c): undefined reference to `set_obj_fn'
flot_max.cpp:(.text+0x1d6): undefined reference to `add_constraint'
flot_max.cpp:(.text+0x240): undefined reference to `add_constraint'
flot_max.cpp:(.text+0x2aa): undefined reference to `add_constraint'
flot_max.cpp:(.text+0x314): undefined reference to `add_constraint'
flot_max.cpp:(.text+0x37e): undefined reference to `add_constraint'
/tmp/ccIvoPiS.o:flot_max.cpp:(.text+0x3e8): more undefined references to `add_constraint' follow
/tmp/ccIvoPiS.o: In function `main':
flot_max.cpp:(.text+0x6a4): undefined reference to `solve'
flot_max.cpp:(.text+0x6bd): undefined reference to `get_objective'
flot_max.cpp:(.text+0x704): undefined reference to `get_variables'
collect2: error: ld returned 1 exit status
It just looks like the library isn't loaded as every function listed above are part of the library...
Related
I have installed Proj 6.3.1 and I tried to run a Proj example from https://proj.org/development/quickstart.html. I implemented it with CLion on Ubuntu 20.04. And I got many undefined reference errors as follows,
cd "/path_to_the_file/" && g++ transformation.cpp -o transformation && "/path_to_the_file/"transformation
/usr/bin/ld: /tmp/cckO2X58.o: in function `main':
transformation.cpp:(.text+0x1f): undefined reference to `proj_context_create'
/usr/bin/ld: transformation.cpp:(.text+0x42): undefined reference to `proj_create_crs_to_crs'
/usr/bin/ld: transformation.cpp:(.text+0x8a): undefined reference to `proj_normalize_for_visualization'
/usr/bin/ld: transformation.cpp:(.text+0xcb): undefined reference to `proj_destroy'
/usr/bin/ld: transformation.cpp:(.text+0x102): undefined reference to `proj_coord'
/usr/bin/ld: transformation.cpp:(.text+0x14f): undefined reference to `proj_trans'
/usr/bin/ld: transformation.cpp:(.text+0x1c3): undefined reference to `proj_trans'
/usr/bin/ld: transformation.cpp:(.text+0x21c): undefined reference to `proj_destroy'
/usr/bin/ld: transformation.cpp:(.text+0x228): undefined reference to `proj_context_destroy'
collect2: error: ld returned 1 exit status
This problem is similar to https://gis.stackexchange.com/questions/370771/unable-to-run-proj-c-example, but I can't find the solutions accordingly. The <proj.h> header is in my usr/include folder and Clion can detect it automatically. Could anyone help?
I have a large codebase with multiple files and multiple Cmake files as well. The structure is src/folder1 src/folder2 etc and I run catkin_make -j1 from the src directory level. I am unable to link MKL. A small clip of the error is
/usr/bin/ld: /opt/intel/oneapi/mkl/2021.3.0/lib/intel64/libmkl_intel_thread.so: undefined reference to `mkl_sparse_d_xESB_SpMV_8_i4'
/usr/bin/ld: /opt/intel/oneapi/mkl/2021.3.0/lib/intel64/libmkl_intel_thread.so: undefined reference to `mkl_spblas_zcoo0ssunc__mmout_par'
/usr/bin/ld: /opt/intel/oneapi/mkl/2021.3.0/lib/intel64/libmkl_intel_thread.so: undefined reference to `mkl_spblas_zcoo1ntuuf__mmout_par'
/usr/bin/ld: /opt/intel/oneapi/mkl/2021.3.0/lib/intel64/libmkl_intel_thread.so: undefined reference to `mkl_spblas_lp64_scsr0ntunc__smout_par'
/usr/bin/ld: /opt/intel/oneapi/mkl/2021.3.0/lib/intel64/libmkl_intel_thread.so: undefined reference to `mkl_spblas_lp64_ccsr0nd_nc__svout_seq'
/usr/bin/ld: /opt/intel/oneapi/mkl/2021.3.0/lib/intel64/libmkl_intel_thread.so: undefined reference to `mkl_spblas_ccoo1stlnf__svout_seq'
/usr/bin/ld: /opt/intel/oneapi/mkl/2021.3.0/lib/intel64/libmkl_intel_thread.so: undefined reference to `mkl_pds_pds_her_pos_fwd_ker_seq_nrhs_cmplx'
collect2: error: ld returned 1 exit status
I even added the following line to each cmake:
SET(GCC_COVERAGE_LINK_FLAGS " -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_intel_ilp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl")
The code does not use MKL BLAS directly but rather it is used by libraries like Opencv and Eigen (OpenCV was built with MKL).
I do define EIGEN_USE_MKL_ALL.
How do I link MKL?
You can make use of oneMKL link line advisor which recommends what are the required libraries and necessary compiler options for the use case on which you are working.
Here is the link
https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl/link-line-advisor.html
I downloaded and built the wxWidgets library on Ubuntu 21.04 using the following flags:
--enable-monolithic
--disable-shared
--enable-cxx11
--enable-stl
--enable-std_containers_compat
--enable-std_iostreams
--enable-std_string
--enable-std_string_conv_in_wxstring
--disable-unsafe_conv_in_wxstring
--enable-utf8
--enable-profile
--disable-vararg_macros
--enable-universal_binary
--enable-intl
--enable-config
--enable-protocols
--enable-ftp
--enable-http
--enable-fileproto
--enable-sockets
--enable-ipv6
--enable-dataobj
--enable-webrequest
--enable-ipc
--enable-baseevtloop
--enable-epollloop
--enable-selectloop
--enable-any
--enable-arcstream
--enable-base64
--enable-backtrace
--enable-catch_segvs
--enable-cmdline
--enable-datetime
--enable-debugreport
--enable-dialupman
--enable-dynlib
--enable-dynamicloader
--enable-exceptions
--enable-ffile
--enable-file
--enable-filehistory
--enable-filesystem
--enable-fontenum
--enable-fontmap
--enable-fs_archive
--enable-fs_inet
--enable-fsvolume
--enable-fswatcher
--enable-geometry
--enable-log
--enable-longlong
--enable-mimetype
--enable-printfposparam
--enable-secretstore
--enable-snglinst
--enable-sound
--enable-stdpaths
--enable-stopwatch
--enable-streams
--enable-sysoptions
--enable-tarstream
--enable-textbuf
--enable-textfile
--enable-timer
--enable-variant
--enable-zipstream
--enable-url
--enable-protocol
--enable-protocol-http
--enable-protocol-ftp
--enable-protocol-file
--enable-threads
--enable-docview
--enable-help
--enable-html
--enable-htmlhelp
--enable-xrc
--enable-aui
--enable-propgrid
--enable-ribbon
--enable-stc
--enable-constraints
--enable-loggui
--enable-logwin
--enable-logdialog
--enable-mdi
--enable-mdidoc
--enable-mediactrl
--enable-richtext
--enable-postscript
--enable-printarch
--enable-svg
--enable-webview
--enable-graphics_ctx
--enable-clipboard
--enable-dnd
--enable-markup
--enable-accel
--enable-actindicator
--enable-addremovectrl
--enable-animatectrl
--enable-bannerwindow
--enable-artstd
--enable-arttango
--enable-bmpbutton
--enable-bmpcombobox
--enable-button
--enable-calendar
--enable-caret
--enable-checkbox
--enable-checklst
--enable-choice
--enable-choicebook
--enable-collpane
--enable-colourpicker
--enable-combobox
--enable-comboctrl
--enable-commandlinkbutton
--enable-dataviewctrl
--enable-datepick
--enable-detect_sm
--enable-dirpicker
--enable-display
--enable-editablebox
--enable-filectrl
--enable-filepicker
--enable-fontpicker
--enable-gauge
--enable-grid
--enable-headerctrl
--enable-hyperlink
--enable-imaglist
--enable-infobar
--enable-listbook
--enable-listbox
--enable-listctrl
--enable-notebook
--enable-notifmsg
--enable-odcombobox
--enable-popupwin
--enable-prefseditor
--enable-privatefonts
--enable-radiobox
--enable-radiobtn
--enable-richmsgdlg
--enable-richtooltip
--enable-rearrangectrl
--enable-sash
--enable-scrollbar
--enable-searchctrl
--enable-slider
--enable-spinbtn
--enable-spinctrl
--enable-splitter
--enable-statbmp
--enable-statbox
--enable-statline
--enable-stattext
--enable-statusbar
--enable-taskbaricon
--enable-tbarnative
--enable-textctrl
--enable-timepick
--enable-tipwindow
--enable-togglebtn
--enable-toolbar
--enable-toolbook
--enable-treebook
--enable-treectrl
--enable-treelist
--enable-commondlg
--enable-aboutdlg
--enable-choicedlg
--enable-coldlg
--enable-creddlg
--enable-filedlg
--enable-finddlg
--enable-fontdlg
--enable-dirdlg
--enable-msgdlg
--enable-numberdlg
--enable-splash
--enable-textdlg
--enable-tipdlg
--enable-progressdlg
--enable-wizarddlg
--enable-menus
--enable-menubar
--enable-miniframe
--enable-tooltips
--enable-splines
--enable-mousewheel
--enable-validators
--enable-busyinfo
--enable-hotkey
--enable-joystick
--enable-metafile
--enable-dragimage
--enable-dctransform
--enable-webviewwebkit
--enable-palette
--enable-image
--enable-gif
--enable-pcx
--enable-tga
--enable-iff
--enable-pnm
--enable-xpm
--enable-ico_cur
--enable-autoidman
I used all these flags because I mainly want to play around with the library and having a static, monolithic library with all the features enabled suits that purpose. At first I faced some issues at configuration with GStreamer which wasn't installed but after I installed it the library compiled just fine. For the sake of completeness, these are the exact steps I followed:
#Current dir -> ~/Programs/C++/wxWidgets-3.1.5
mkdir build-gtk
cd build-gtk
../configure #all the above flags
make
sudo checkinstall
and finally I installed the library through the generated .deb file.
I then proceeded to build the sample files with the provided make files. All but two compiled, mediaplayer and splash directories. Again, the exact procedure I followed was:
cd samples
make
The error I got for mediaplayer is:
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `draw':
mediactrl.cpp:(.text+0x195): undefined reference to `gst_video_overlay_expose'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::SetPosition(wxLongLongNative)':
mediactrl.cpp:(.text+0x200): undefined reference to `gst_element_seek'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::GetDuration()':
mediactrl.cpp:(.text+0x24f): undefined reference to `gst_element_query_duration'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::GetDownloadTotal()':
mediactrl.cpp:(.text+0x2cf): undefined reference to `gst_element_query_duration'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::GetPosition()':
mediactrl.cpp:(.text+0x545): undefined reference to `gst_element_query_position'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `gtk_window_realize_callback':
mediactrl.cpp:(.text+0x615): undefined reference to `gst_video_overlay_set_window_handle'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::~wxGStreamerMediaBackend()':
mediactrl.cpp:(.text+0x6e6): undefined reference to `gst_object_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0x75a): undefined reference to `gst_element_set_state'
/usr/bin/ld: mediactrl.cpp:(.text+0x75f): undefined reference to `gst_object_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0x773): undefined reference to `gst_object_unref'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::SetupXOverlay()':
mediactrl.cpp:(.text+0x918): undefined reference to `gst_video_overlay_set_window_handle'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::TryAudioSink(_GstElement*)':
mediactrl.cpp:(.text+0xac8): undefined reference to `gst_element_get_type'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::TryVideoSink(_GstElement*)':
mediactrl.cpp:(.text+0xb5e): undefined reference to `gst_bin_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0xb89): undefined reference to `gst_video_overlay_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0xbaf): undefined reference to `gst_bin_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0xbd1): undefined reference to `gst_video_overlay_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0xbd9): undefined reference to `gst_bin_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0xbef): undefined reference to `gst_bin_get_by_interface'
/usr/bin/ld: mediactrl.cpp:(.text+0xbfb): undefined reference to `gst_video_overlay_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0xc2a): undefined reference to `gst_element_set_state'
/usr/bin/ld: mediactrl.cpp:(.text+0xc50): undefined reference to `gst_video_overlay_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0xc61): undefined reference to `gst_video_overlay_get_type'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::CreateControl(wxControl*, wxWindow*, int, wxPoint const&, wxSize const&, long, wxValidator const&, wxString const&)':
mediactrl.cpp:(.text+0x100c): undefined reference to `gst_init_check'
/usr/bin/ld: mediactrl.cpp:(.text+0x122a): undefined reference to `gst_element_factory_make'
/usr/bin/ld: mediactrl.cpp:(.text+0x1236): undefined reference to `gst_element_get_type'
/usr/bin/ld: mediactrl.cpp:(.text+0x190c): undefined reference to `gst_element_get_bus'
/usr/bin/ld: mediactrl.cpp:(.text+0x191e): undefined reference to `gst_bus_add_watch'
/usr/bin/ld: mediactrl.cpp:(.text+0x1927): undefined reference to `gst_element_get_bus'
/usr/bin/ld: mediactrl.cpp:(.text+0x193b): undefined reference to `gst_bus_set_sync_handler'
/usr/bin/ld: mediactrl.cpp:(.text+0x194e): undefined reference to `gst_element_factory_make'
/usr/bin/ld: mediactrl.cpp:(.text+0x1977): undefined reference to `gst_element_factory_make'
/usr/bin/ld: mediactrl.cpp:(.text+0x19a0): undefined reference to `gst_element_factory_make'
/usr/bin/ld: mediactrl.cpp:(.text+0x1b4f): undefined reference to `gst_element_factory_make'
/usr/bin/ld: mediactrl.cpp:(.text+0x1b7f): undefined reference to `gst_element_factory_make'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o):mediactrl.cpp:(.text+0x1ba8): more undefined references to `gst_element_factory_make' follow
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::CreateControl(wxControl*, wxWindow*, int, wxPoint const&, wxSize const&, long, wxValidator const&, wxString const&)':
mediactrl.cpp:(.text+0x1d2b): undefined reference to `gst_element_get_static_pad'
/usr/bin/ld: mediactrl.cpp:(.text+0x1d5c): undefined reference to `gst_object_unref'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::Play()':
mediactrl.cpp:(.text+0x30d1): undefined reference to `gst_element_set_state'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::Pause()':
mediactrl.cpp:(.text+0x312c): undefined reference to `gst_element_set_state'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::QueryVideoSizeFromPad(_GstPad*)':
mediactrl.cpp:(.text+0x3f44): undefined reference to `gst_pad_get_current_caps'
/usr/bin/ld: mediactrl.cpp:(.text+0x3f5a): undefined reference to `gst_caps_get_structure'
/usr/bin/ld: mediactrl.cpp:(.text+0x3f79): undefined reference to `gst_structure_get_int'
/usr/bin/ld: mediactrl.cpp:(.text+0x3f8c): undefined reference to `gst_structure_get_int'
/usr/bin/ld: mediactrl.cpp:(.text+0x3fa2): undefined reference to `gst_structure_get_value'
/usr/bin/ld: mediactrl.cpp:(.text+0x40be): undefined reference to `gst_mini_object_unref'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `gst_bus_async_callback':
mediactrl.cpp:(.text+0x5fe7): undefined reference to `gst_message_parse_state_changed'
/usr/bin/ld: mediactrl.cpp:(.text+0x6014): undefined reference to `gst_message_parse_error'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `gst_bus_sync_callback':
mediactrl.cpp:(.text+0x607a): undefined reference to `gst_is_video_overlay_prepare_window_handle_message'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::SyncStateChange(_GstElement*, GstState, long)':
mediactrl.cpp:(.text+0x6497): undefined reference to `gst_element_get_bus'
/usr/bin/ld: mediactrl.cpp:(.text+0x64b0): undefined reference to `gst_bus_have_pending'
/usr/bin/ld: mediactrl.cpp:(.text+0x64f4): undefined reference to `gst_bus_pop'
/usr/bin/ld: mediactrl.cpp:(.text+0x6505): undefined reference to `gst_mini_object_unref'
/usr/bin/ld: mediactrl.cpp:(.text+0x656b): undefined reference to `gst_mini_object_unref'
/usr/bin/ld: mediactrl.cpp:(.text+0x65b9): undefined reference to `gst_message_parse_state_changed'
/usr/bin/ld: mediactrl.cpp:(.text+0x65d3): undefined reference to `gst_mini_object_unref'
/usr/bin/ld: mediactrl.cpp:(.text+0x65fa): undefined reference to `gst_message_parse_error'
/usr/bin/ld: mediactrl.cpp:(.text+0x661c): undefined reference to `gst_mini_object_unref'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaEventHandler::OnMediaFinish(wxMediaEvent&)':
mediactrl.cpp:(.text+0x69d1): undefined reference to `gst_element_set_state'
/usr/bin/ld: mediactrl.cpp:(.text+0x69fa): undefined reference to `gst_element_set_state'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::DoLoad(wxString const&)':
mediactrl.cpp:(.text+0x6ad6): undefined reference to `gst_element_set_state'
/usr/bin/ld: mediactrl.cpp:(.text+0x703a): undefined reference to `gst_element_set_state'
/usr/bin/ld: mediactrl.cpp:(.text+0x7046): undefined reference to `gst_uri_protocol_is_valid'
/usr/bin/ld: mediactrl.cpp:(.text+0x70c0): undefined reference to `gst_uri_is_valid'
/usr/bin/ld: mediactrl.cpp:(.text+0x71f0): undefined reference to `gst_element_set_state'
/usr/bin/ld: ~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib/libwx_gtk3u-3.1.a(monolib_unix_mediactrl.o): in function `wxGStreamerMediaBackend::Stop()':
mediactrl.cpp:(.text+0x7759): undefined reference to `gst_element_set_state'
collect2: error: ld returned 1 exit status
make tried to compile the the sample running g++ with the following flags (quoting them in separate lines for readability):
g++
-std=gnu++11
-o mediaplayer mediaplayer_mediaplayer.o
-L~/Programs/C++/wxWidgets-3.1.5/build-gtk/lib
-pthread
-pg
-lgstvideo-1.0
-lgstbase-1.0
-lgstreamer-1.0
-lgobject-2.0
-lglib-2.0
-lwx_gtk3u-3.1
-lwxscintilla-3.1
-lwxregexu-3.1
-pthread
-lz
-ldl
-lcurl
-llzma
-lm
-lexpat
-lgtk-3
-lgdk-3
-lpangocairo-1.0
-lpango-1.0
-lharfbuzz
-latk-1.0
-lcairo-gobject
-lcairo
-lgdk_pixbuf-2.0
-lgio-2.0
-lgobject-2.0
-lgthread-2.0
-pthread
-lglib-2.0
-lX11
-lSM
-lgtk-3
-lgdk-3
-lpangocairo-1.0
-lpango-1.0
-lharfbuzz
-latk-1.0
-lcairo-gobject
-lcairo
-lgdk_pixbuf-2.0
-lgio-2.0
-lgobject-2.0
-lglib-2.0
-lnotify
-lgdk_pixbuf-2.0
-lgio-2.0
-lgobject-2.0
-lglib-2.0
-lXtst
-lpangoft2-1.0
-lpango-1.0
-lgobject-2.0
-lglib-2.0
-lharfbuzz
-lfontconfig
-lfreetype
-lpng
-lz
-ljpeg
-ltiff
-llzma
-ljbig
-lz
-ldl
-lcurl
-llzma
-lm
I've been trying two days now to solve this but I can't figured it out. I've tried installing all the possible GStreamer packages, copying the GStreamer libraries and header files to a bunch of different location, I tried --reinstall and other things but at this point I haven't managed to get anywhere. Does anyone know what am I missing here? How can I compile these sample files?
Edit:
As #VZ. pointed out I should make more clear that:
The make files were autogenerated by building wxWidgets library.
There was a makefile in the build-gtk/samples directory which would compile in batch all examples.
In each example (e.g. build-gtk/samples/mediaplayer) there was a makefile generated by a bakefile - the first lines are a block comment saying:
# =========================================================================
# This makefile was generated by
# Bakefile 0.2.12 ([http://www.bakefile.org][1])
# Do not modify, all changes will be overwritten!
# =========================================================================
I ran make in build-gtk/samples, which compiled all examples except build-gtk/samples/mediaplayer and build-gtk/samples/splash.
Following #VZ.'s answer I also tried to manually compile build-gtk/samples/mediaplayer using g++ and changing the order of the libraries I got the following error:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/libgstvideo-1.0.so: undefined reference to `gst_event_parse_instant_rate_change'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/libgstvideo-1.0.so: undefined reference to `gst_aggregator_simple_get_next_time'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/libgstvideo-1.0.so: undefined reference to `gst_base_sink_set_processing_deadline'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/libgstvideo-1.0.so: undefined reference to `gst_mini_object_add_parent'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/libgstvideo-1.0.so: undefined reference to `gst_mini_object_remove_parent'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/libgstvideo-1.0.so: undefined reference to `gst_aggregator_selected_samples'
collect2: error: ld returned 1 exit status
Edit 2:
I fixed the aforementioned error by running the following:
sudo rm /usr/local/lib/libgstbase-1.0.so*
sudo rm /usr/local/lib/libgstreamer-1.0.*
effectively removing any gstreamer libraries under /usr/local/lib that seemed to be conflicting with some other gstreamer libraries elsewhere in the system.
There is a problem with the order of the libraries in the link command you show, gstreamer libraries must come after -lwx_gtk3u-3.1 and not before it as they do, when using static libraries.
It's not clear to me where does this command actually come from, normally you should run make inside build-gtk/samples/mediaplayer directory, is this really what you're doing? I.e. how exactly do you the provided makefiles and which ones are you using?
This looks like a bug in static monolithic build when using media library and should be fixed in wxWidgets itself. I don't know about the new errors, i.e. the missing gst_event_parse_instant_rate_change and other symbols, I don't have anything like this on my system, so I suspect this might be due to a mix of gstreamer libraries on your system due to your previous attempts to circumvent the problem.
P.S. Avoid using all these --enable-xxx options, they're all on by default anyhow (and those that are off are usually off for a good reason).
a C++ code built into a shared library for HELib is using NTL and GMP static library. But it gets following error:
/usr/bin/ld: /usr/local/lib/libntl.a(FFT.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libntl.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
It was suggested int the post Click here
to recompile NTL and GMP with "-fPIC " flags.
I'am not able to find how I should do that.
Edit:
I'm able to build the shared library now after :
recompiling GMP and NTL by:
./configure --enable-shared
for gmp and
./configure SHARED=on
After make Install of HELib. I get error when I run the example codes.
The link to the Makefile : click to see makefile
Error:
g++ -g -O2 -std=c++11 -pthread -DFHE_THREADS -DFHE_BOOT_THREADS -DFHE_DCRT_THREADS -o Test_General_x Test_General.cpp -L/usr/local/lib -lntl -lgmp -lm -lfhe
/usr/local/lib/libfhe.so: undefined reference to write_raw_int(std::ostream&, long, long)'
/usr/local/lib/libfhe.so: undefined reference toread_raw_ZZ(std::istream&, NTL::ZZ&)'
/usr/local/lib/libfhe.so: undefined reference to void write_raw_vector<long>(std::ostream&, std::vector<long, std::allocator<long> > const&)'
/usr/local/lib/libfhe.so: undefined reference towriteEyeCatcher(std::ostream&, char const*)'
/usr/local/lib/libfhe.so: undefined reference to write_raw_xdouble(std::ostream&, NTL::xdouble)'
/usr/local/lib/libfhe.so: undefined reference toread_ntl_vec_long(std::istream&, NTL::Vec&)'
/usr/local/lib/libfhe.so: undefined reference to void read_raw_vector<long>(std::istream&, std::vector<long, std::allocator<long> >&)'
/usr/local/lib/libfhe.so: undefined reference toreadEyeCatcher(std::istream&, char const*)'
/usr/local/lib/libfhe.so: undefined reference to read_raw_int(std::istream&, long)'
/usr/local/lib/libfhe.so: undefined reference toread_raw_xdouble(std::istream&)'
/usr/local/lib/libfhe.so: undefined reference to write_raw_ZZ(std::ostream&, NTL::ZZ const&)'
/usr/local/lib/libfhe.so: undefined reference towrite_ntl_vec_long(std::ostream&, NTL::Vec const&, long)'
collect2: error: ld returned 1 exit status
Makefile:179: recipe for target 'Test_General_x' failed
make: *** [Test_General_x] Error 1
For NTL v11.5.1 atleast, doing ./configure --help | grep -i pic (as suggested in one of the comments for GMP) did not help at all - it found no matches. However, making a one line change in the file ntl-11.5.1/src/DoConfig (on line 17) from:
'CXXFLAGS' => '-g -O2'
to:
'CXXFLAGS' => '-g -O2 -fPIC',
solved the problem for me.
Marc Glisse provided the answer for the first two parts of the question.For the third part "Undefined Reference error" the answer is I'd not compiled and linked a x.cpp containing the functions that caused the undefined reference into my shared library. hence check : nm -CD /usr/local/lib/libfhe.so to see if these functions are listed with a linking address or not. If not then check which code provides this functionality. Link that code to the shared library.
we use boost1.46.1 in our c++ project. When I am building my c++ project using cmake, I am getting following errors.
I am not sure why I am getting this error. Can any one please hemp me to fix the following errors?
/usr/bin/ld: warning: libicuuc.so.44, needed by /efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libicui18n.so.44, needed by /efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libicudata.so.44, needed by /efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so, not found (try using -rpath or -rpath-link)
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `u_isspace_44'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `icu_44::Collator::createInstance(icu_44::Locale const&, UErrorCode&)'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `u_charFromName_44'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `u_charType_44'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `u_digit_44'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `u_tolower_44'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `icu_44::Locale::~Locale()'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `u_isblank_44'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `icu_44::Locale::Locale()'
/efs/dist/fsf/boost/1.46.1-build001/.exec/x86-32.rhel.5/rh346/lib/libboost_regex.so: undefined reference to `icu_44::Locale::Locale(icu_44::Locale const&)'
collect2: ld returned 1 exit status
http://www.boost.org/doc/libs/1_47_0/libs/regex/doc/html/boost_regex/install.html
It looks like boost::regex sometimes depends on the ICU library. You can either link against that library, or you can follow the instructions in the link to disable ICU.
Your Boost.Regex is built with Unicode support — you need to link to ICU as well.