I am trying to install the Trans-Proteomic Pipeline found here. I have installed each of the necessary libraries mentioned in the readme, but when I run make all or make install it progresses through much of the compilation, and then errors out with the following message:
undefined reference to `boost::iostreams::zlib::deflated'
The error log is much longer with what seems to be redundant information but it generally looks like this:
/usr/bin/ld: /home/nkho/proj/tpp/release_6-0-0/build/gnu-x86_64-rc28/lib/libpwiz.a(MSDataFile.o): in function `pwiz::msdata::(anonymous namespace)::openFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)':
MSDataFile.cpp:(.text+0x1cda): undefined reference to `boost::iostreams::zlib::deflated'
/usr/bin/ld: MSDataFile.cpp:(.text+0x1cf8): undefined reference to `boost::iostreams::zlib::default_strategy'
/usr/bin/ld: /home/nkho/proj/tpp/release_6-0-0/build/gnu-x86_64-rc28/lib/libpwiz.a(MSDataFile.o): in function `boost::detail::sp_counted_impl_p<boost::iostreams::symmetric_filter<boost::iostreams::detail::zlib_compressor_impl<std::allocator<char> >, std::allocator<char> >::impl>::dispose()':
MSDataFile.cpp:(.text._ZN5boost6detail17sp_counted_impl_pINS_9iostreams16symmetric_filterINS2_6detail20zlib_compressor_implISaIcEEES6_E4implEE7disposeEv[_ZN5boost6detail17sp_counted_impl_pINS_9iostreams16symmetric_filterINS2_6detail20zlib_compressor_implISaIcEEES6_E4implEE7disposeEv]+0x27): undefined reference to `boost::iostreams::detail::zlib_base::reset(bool, bool)'
/usr/bin/ld: MSDataFile.cpp:(.text._ZN5boost6detail17sp_counted_impl_pINS_9iostreams16symmetric_filterINS2_6detail20zlib_compressor_implISaIcEEES6_E4implEE7disposeEv[_ZN5boost6detail17sp_counted_impl_pINS_9iostreams16symmetric_filterINS2_6detail20zlib_compressor_implISaIcEEES6_E4implEE7disposeEv]+0x2f): undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()'
/usr/bin/ld: /home/nkho/proj/tpp/release_6-0-0/build/gnu-x86_64-rc28/lib/libpwiz.a(MSDataFile.o): in function `boost::iostreams::basic_gzip_compressor<std::allocator<char> >::basic_gzip_compressor(boost::iostreams::gzip_params const&, int)':
MSDataFile.cpp:(.text._ZN5boost9iostreams21basic_gzip_compressorISaIcEEC2ERKNS0_11gzip_paramsEi[_ZN5boost9iostreams21basic_gzip_compressorISaIcEEC5ERKNS0_11gzip_paramsEi]+0x1d7): undefined reference to `boost::iostreams::detail::zlib_base::zlib_base()'
/usr/bin/ld: MSDataFile.cpp:(.text._ZN5boost9iostreams21basic_gzip_compressorISaIcEEC2ERKNS0_11gzip_paramsEi[_ZN5boost9iostreams21basic_gzip_compressorISaIcEEC5ERKNS0_11gzip_paramsEi]+0x1f9): undefined reference to `boost::iostreams::detail::zlib_base::do_init(boost::iostreams::zlib_params const&, bool, void* (*)(void*, unsigned int, unsigned int), void (*)(void*, void*), void*)'
/usr/bin/ld: MSDataFile.cpp:(.text._ZN5boost9iostreams21basic_gzip_compressorISaIcEEC2ERKNS0_11gzip_paramsEi[_ZN5boost9iostreams21basic_gzip_compressorISaIcEEC5ERKNS0_11gzip_paramsEi]+0x337): undefined reference to `boost::iostreams::zlib::best_compression'
/usr/bin/ld: MSDataFile.cpp:(.text._ZN5boost9iostreams21basic_gzip_compressorISaIcEEC2ERKNS0_11gzip_paramsEi[_ZN5boost9iostreams21basic_gzip_compressorISaIcEEC5ERKNS0_11gzip_paramsEi]+0x34e): undefined reference to `boost::iostreams::zlib::best_speed'
/usr/bin/ld: MSDataFile.cpp:(.text._ZN5boost9iostreams21basic_gzip_compressorISaIcEEC2ERKNS0_11gzip_paramsEi[_ZN5boost9iostreams21basic_gzip_compressorISaIcEEC5ERKNS0_11gzip_paramsEi]+0xa51): undefined reference to `boost::iostreams::detail::zlib_base::reset(bool, bool)'
/usr/bin/ld: MSDataFile.cpp:(.text._ZN5boost9iostreams21basic_gzip_compressorISaIcEEC2ERKNS0_11gzip_paramsEi[_ZN5boost9iostreams21basic_gzip_compressorISaIcEEC5ERKNS0_11gzip_paramsEi]+0xa59): undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()'
/usr/bin/ld: MSDataFile.cpp:(.text._ZN5boost9iostreams21basic_gzip_compressorISaIcEEC2ERKNS0_11gzip_paramsEi[_ZN5boost9iostreams21basic_gzip_compressorISaIcEEC5ERKNS0_11gzip_paramsEi]+0xa75): undefined reference to `boost::iostreams::detail::zlib_base::reset(bool, bool)'
/usr/bin/ld: MSDataFile.cpp:(.text._ZN5boost9iostreams21basic_gzip_compressorISaIcEEC2ERKNS0_11gzip_paramsEi[_ZN5boost9iostreams21basic_gzip_compressorISaIcEEC5ERKNS0_11gzip_paramsEi]+0xa7d): undefined reference to `boost::iostreams::detail::zlib_base::~zlib_base()'
I've seen a variety of other questions with similar messages that mention one should define the path to the boost installation/binaries in the g++ command, but all I am running is make install, so I am not sure where I would specify this.
Related
I'm trying out this library:
https://github.com/dacap/clip
I've git-cloned it, then built it using the following:
cmake .
make
This produces a library called libclip.a.
Now, I've taken the sample Hello World code, which is this:
#include "clip/clip.h"
int main() {
clip::set_text("Hello World");
}
Given that the above is in a file called cliptest2.cpp, I compile it as follows:
g++ -lclip cliptest2.cpp -o cliptest2
Every time, I get the following:
/usr/bin/ld: /tmp/cc71SQmy.o: in function `main':
cliptest2.cpp:(.text+0x47): undefined reference to `clip::set_text(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)'
collect2: error: ld returned 1 exit status
I do understand how the linker works and have gone through dozens of other questions with similar errors. However, given that I am building the third party library and linking it into my sample program, I don't understand why the set_text() method is not being resolved.
Edit: I've tried a few things, also as a result of the comments below. The source code for the clip library resides at ~/git/clip, and I am compiling cliptest2.cpp from the home directory itself. Therefore, adjusting the command suggested by #MathiasSchmid to my environment, I end up with this:
g++ cliptest2.cpp -I git -L git/clip -lclip -lxcb -lpthread -o cliptest2
I run this on my Kubuntu 20.04 LTS, and get all the following errors:
daniel#orion:~$ g++ cliptest2.cpp -I git -L git/clip -lclip -lxcb -lpthread -o cliptest2
/usr/bin/ld: git/clip/libclip.a(clip_x11.cpp.o): in function `clip::x11::write_data_fn(png_struct_def*, unsigned char*, unsigned long)':
clip_x11.cpp:(.text+0x4f): undefined reference to `png_get_io_ptr'
/usr/bin/ld: git/clip/libclip.a(clip_x11.cpp.o): in function `clip::x11::write_png(clip::image const&, std::vector<unsigned char, std::allocator<unsigned char> >&)':
clip_x11.cpp:(.text+0x117): undefined reference to `png_create_write_struct'
/usr/bin/ld: clip_x11.cpp:(.text+0x13a): undefined reference to `png_create_info_struct'
/usr/bin/ld: clip_x11.cpp:(.text+0x158): undefined reference to `png_destroy_write_struct'
/usr/bin/ld: clip_x11.cpp:(.text+0x17d): undefined reference to `png_set_longjmp_fn'
/usr/bin/ld: clip_x11.cpp:(.text+0x1a5): undefined reference to `png_destroy_write_struct'
/usr/bin/ld: clip_x11.cpp:(.text+0x1cb): undefined reference to `png_set_write_fn'
/usr/bin/ld: clip_x11.cpp:(.text+0x232): undefined reference to `png_set_IHDR'
/usr/bin/ld: clip_x11.cpp:(.text+0x249): undefined reference to `png_write_info'
/usr/bin/ld: clip_x11.cpp:(.text+0x255): undefined reference to `png_set_packing'
/usr/bin/ld: clip_x11.cpp:(.text+0x268): undefined reference to `png_get_rowbytes'
/usr/bin/ld: clip_x11.cpp:(.text+0x27a): undefined reference to `png_malloc'
/usr/bin/ld: clip_x11.cpp:(.text+0x3cd): undefined reference to `png_write_rows'
/usr/bin/ld: clip_x11.cpp:(.text+0x3e9): undefined reference to `png_free'
/usr/bin/ld: clip_x11.cpp:(.text+0x3fc): undefined reference to `png_write_end'
/usr/bin/ld: clip_x11.cpp:(.text+0x40f): undefined reference to `png_destroy_write_struct'
/usr/bin/ld: git/clip/libclip.a(clip_x11.cpp.o): in function `clip::x11::read_data_fn(png_struct_def*, unsigned char*, unsigned long)':
clip_x11.cpp:(.text+0x45d): undefined reference to `png_get_io_ptr'
/usr/bin/ld: git/clip/libclip.a(clip_x11.cpp.o): in function `clip::x11::read_png(unsigned char const*, unsigned long, clip::image*, clip::image_spec*)':
clip_x11.cpp:(.text+0x575): undefined reference to `png_create_read_struct'
/usr/bin/ld: clip_x11.cpp:(.text+0x5a1): undefined reference to `png_create_info_struct'
/usr/bin/ld: clip_x11.cpp:(.text+0x5cd): undefined reference to `png_destroy_read_struct'
/usr/bin/ld: clip_x11.cpp:(.text+0x5f5): undefined reference to `png_set_longjmp_fn'
/usr/bin/ld: clip_x11.cpp:(.text+0x628): undefined reference to `png_destroy_read_struct'
/usr/bin/ld: clip_x11.cpp:(.text+0x68f): undefined reference to `png_set_read_fn'
/usr/bin/ld: clip_x11.cpp:(.text+0x6a8): undefined reference to `png_read_info'
/usr/bin/ld: clip_x11.cpp:(.text+0x6ea): undefined reference to `png_get_IHDR'
/usr/bin/ld: clip_x11.cpp:(.text+0x747): undefined reference to `png_get_rowbytes'
/usr/bin/ld: clip_x11.cpp:(.text+0x8bf): undefined reference to `png_set_strip_16'
/usr/bin/ld: clip_x11.cpp:(.text+0x8ce): undefined reference to `png_set_packing'
/usr/bin/ld: clip_x11.cpp:(.text+0x8dd): undefined reference to `png_set_expand_gray_1_2_4_to_8'
/usr/bin/ld: clip_x11.cpp:(.text+0x8ec): undefined reference to `png_set_palette_to_rgb'
/usr/bin/ld: clip_x11.cpp:(.text+0x8fb): undefined reference to `png_set_gray_to_rgb'
/usr/bin/ld: clip_x11.cpp:(.text+0x90a): undefined reference to `png_set_tRNS_to_alpha'
/usr/bin/ld: clip_x11.cpp:(.text+0x919): undefined reference to `png_set_interlace_handling'
/usr/bin/ld: clip_x11.cpp:(.text+0x938): undefined reference to `png_read_update_info'
/usr/bin/ld: clip_x11.cpp:(.text+0x95a): undefined reference to `png_malloc'
/usr/bin/ld: clip_x11.cpp:(.text+0x9ab): undefined reference to `png_malloc'
/usr/bin/ld: clip_x11.cpp:(.text+0xa19): undefined reference to `png_read_rows'
/usr/bin/ld: clip_x11.cpp:(.text+0xbe0): undefined reference to `png_free'
/usr/bin/ld: clip_x11.cpp:(.text+0xc05): undefined reference to `png_free'
/usr/bin/ld: clip_x11.cpp:(.text+0xc4b): undefined reference to `png_destroy_read_struct'
collect2: error: ld returned 1 exit status
It is still not clear to me what the problem here is.
This question already has answers here:
GCC linker can't find standard library?
(4 answers)
Closed 3 years ago.
The problem is compounded by the fact that I am far from programming.
I need to use the TPC-E test. I downloaded the source codes from their website.
There is a miserable and almost meaningless ReadMe.
Here are its contents:
To use the Makefile you must first set the following environment variables
to match your system and compiler requirements:
CXX: path and name of compiler
ex: export CXX=/opt/SUNWspro/bin/CC (C++ compiler on Solaris)
CCFLAGS: compiler options
ex: export CCFLAGS="-g -O"
-g enable debug
-O optimize code
LDFLAGS: linker/loader options
ex: export LDFLAGS="-g"
LIBS: extra libraries to link in
ex: export LIBS="-lpthread"
According to the instructions there, I created the necessary environment variables (I just removed the -g switch from the CCFLAGS variable). After that, I ran the make utility and got more than five thousand lines of errors. Apparently he lacks some libraries. On this my knowledge ends.
Here are some error messages received:
...
/usr/bin/ld: DateTime.o: in function `TPCE::CDateTime::Validate(int, int, int, int, int, int, int)': DateTime.cpp:(.text+0xee): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)'
/usr/bin/ld: DateTime.cpp:(.text+0xfd): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/usr/bin/ld: DateTime.cpp:(.text+0x107): undefined reference to `__cxa_allocate_exception'
/usr/bin/ld: DateTime.cpp:(.text+0x117): undefined reference to `std::__cxx11::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const'
/usr/bin/ld: DateTime.cpp:(.text+0x122): undefined reference to `std::out_of_range::out_of_range(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
/usr/bin/ld: DateTime.cpp:(.text+0x135): undefined reference to `operator delete(void*)'
...
/usr/bin/ld: error.cpp:(.text._ZN4TPCE10CSystemErrD0Ev[_ZN4TPCE10CSystemErrD5Ev]+0x24): undefined reference to `std::exception::~exception()'
/usr/bin/ld: error.cpp:(.text._ZN4TPCE10CSystemErrD0Ev[_ZN4TPCE10CSystemErrD5Ev]+0x31): undefined reference to `operator delete(void*, unsigned long)'
/usr/bin/ld: error.o: in function `TPCE::CSystemErr::~CSystemErr()':error.cpp:(.text._ZN4TPCE10CSystemErrD2Ev[_ZN4TPCE10CSystemErrD5Ev]+0x1c): undefined reference to `operator delete(void*)'
...
/usr/bin/ld: locking.cpp:(.text+0x1fb): undefined reference to `operator delete(void*)'
/usr/bin/ld: locking.cpp:(.text+0x202): undefined reference to `std::runtime_error::~runtime_error()'
/usr/bin/ld: locking.cpp:(.text+0x209): undefined reference to `typeinfo for std::runtime_error'
/usr/bin/ld: locking.cpp:(.text+0x211): undefined reference to `__cxa_throw'
/usr/bin/ld: locking.o: in function `TPCE::CMutex::lock()':locking.cpp:(.text+0x246): undefined reference to `std::__cxx11::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)'
...
A search on the internet made me think of installing the libboost-all-dev package, but that didn't help. In the end, I gave up - I’m completely incomprehensible to the terminology and I don’t have time to study C ++ programming.
Operating System - Debian 10
Questions: which libraries need to be installed and is there anyone who used these tests, how to adapt them to PostgreSQL?
Full error log (892 230 bytes)
I replaced
export CXX=/usr/bin/gcc
with
export CXX=/usr/bin/c++
I'm trying to compile a C++ program which includes the libuvc.h header file and some more header files of opencv2.
The problem is, that I'm getting the following errors (undefinded references):
root#Raspi_DataHarvest:~/Schreibtisch# g++ UVCCameraHandler.cpp -I/usr/local/include/libuvc -I/usr/local/include/opencv2
/tmp/ccvQZdkd.o: In function `UVCCameraHandler::start(int, CameraProperties, int)':
UVCCameraHandler.cpp:(.text+0x164): undefined reference to `uvc_init'
UVCCameraHandler.cpp:(.text+0x184): undefined reference to `uvc_perror'
UVCCameraHandler.cpp:(.text+0x204): undefined reference to `uvc_get_device_descriptor'
UVCCameraHandler.cpp:(.text+0x334): undefined reference to `uvc_open'
UVCCameraHandler.cpp:(.text+0x354): undefined reference to `uvc_perror'
UVCCameraHandler.cpp:(.text+0x3a8): undefined reference to `uvc_get_stream_ctrl_format_size'
UVCCameraHandler.cpp:(.text+0x3e8): undefined reference to `uvc_get_stream_ctrl_format_size'
UVCCameraHandler.cpp:(.text+0x40c): undefined reference to `uvc_print_diag'
UVCCameraHandler.cpp:(.text+0x424): undefined reference to `uvc_print_stream_ctrl'
UVCCameraHandler.cpp:(.text+0x43c): undefined reference to `uvc_perror'
UVCCameraHandler.cpp:(.text+0x46c): undefined reference to `uvc_stream_open_ctrl'
UVCCameraHandler.cpp:(.text+0x48c): undefined reference to `uvc_stream_start_iso'
UVCCameraHandler.cpp:(.text+0x4a4): undefined reference to `uvc_perror'
/tmp/ccvQZdkd.o: In function `UVCCameraHandler::grabFramesGrayscale(cv::Mat&, cv::Mat&)':
UVCCameraHandler.cpp:(.text+0x5c8): undefined reference to `uvc_stream_get_frame'
/tmp/ccvQZdkd.o: In function `UVCCameraHandler::grabFramesColor(cv::Mat&, cv::Mat&)':
UVCCameraHandler.cpp:(.text+0x864): undefined reference to `uvc_stream_get_frame'
UVCCameraHandler.cpp:(.text+0x92c): undefined reference to `cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
/tmp/ccvQZdkd.o: In function `UVCCameraHandler::uvcFindDevice(uvc_context*, uvc_device**, int, int, char const*, int)':
UVCCameraHandler.cpp:(.text+0xae0): undefined reference to `uvc_get_device_list'
UVCCameraHandler.cpp:(.text+0xb10): undefined reference to `uvc_get_device_descriptor'
UVCCameraHandler.cpp:(.text+0xd0c): undefined reference to `uvc_get_device_descriptor'
/tmp/ccvQZdkd.o: In function `UVCCameraHandler::setProperties(CameraProperties)':
UVCCameraHandler.cpp:(.text+0xfb0): undefined reference to `uvc_get_gain'
UVCCameraHandler.cpp:(.text+0xff8): undefined reference to `uvc_set_gain'
UVCCameraHandler.cpp:(.text+0x103c): undefined reference to `uvc_set_ae_mode'
UVCCameraHandler.cpp:(.text+0x1050): undefined reference to `uvc_set_exposure_abs'
UVCCameraHandler.cpp:(.text+0x1068): undefined reference to `uvc_set_ae_mode'
/tmp/ccvQZdkd.o: In function `cv::String::String(char const*)':
UVCCameraHandler.cpp:(.text._ZN2cv6StringC2EPKc[_ZN2cv6StringC5EPKc]+0x60): undefined reference to `cv::String::allocate(unsigned int)'
/tmp/ccvQZdkd.o: In function `cv::String::~String()':
UVCCameraHandler.cpp:(.text._ZN2cv6StringD2Ev[_ZN2cv6StringD5Ev]+0x14): undefined reference to `cv::String::deallocate()'
/tmp/ccvQZdkd.o: In function `cv::String::operator=(cv::String const&)':
UVCCameraHandler.cpp:(.text._ZN2cv6StringaSERKS0_[_ZN2cv6StringaSERKS0_]+0x30): undefined reference to `cv::String::deallocate()'
/tmp/ccvQZdkd.o: In function `cv::Mat::Mat(cv::Size_<int>, int, void*, unsigned int)':
UVCCameraHandler.cpp:(.text._ZN2cv3MatC2ENS_5Size_IiEEiPvj[_ZN2cv3MatC5ENS_5Size_IiEEiPvj]+0x140): undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
UVCCameraHandler.cpp:(.text._ZN2cv3MatC2ENS_5Size_IiEEiPvj[_ZN2cv3MatC5ENS_5Size_IiEEiPvj]+0x244): undefined reference to `cv::error(int, cv::String const&, char const*, char const*, int)'
/tmp/ccvQZdkd.o: In function `cv::Mat::~Mat()':
UVCCameraHandler.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x3c): undefined reference to `cv::fastFree(void*)'
/tmp/ccvQZdkd.o: In function `cv::Mat::operator=(cv::Mat const&)':
UVCCameraHandler.cpp:(.text._ZN2cv3MataSERKS0_[_ZN2cv3MataSERKS0_]+0x140): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
/tmp/ccvQZdkd.o: In function `cv::Mat::create(int, int, int)':
UVCCameraHandler.cpp:(.text._ZN2cv3Mat6createEiii[_ZN2cv3Mat6createEiii]+0xc4): undefined reference to `cv::Mat::create(int, int const*, int)'
/tmp/ccvQZdkd.o: In function `cv::Mat::release()':
UVCCameraHandler.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x68): undefined reference to `cv::Mat::deallocate()'
/tmp/ccvQZdkd.o: In function `cv::Mat::operator()(cv::Rect_<int> const&) const':
UVCCameraHandler.cpp:(.text._ZNK2cv3MatclERKNS_5Rect_IiEE[_ZNK2cv3MatclERKNS_5Rect_IiEE]+0x24): undefined reference to `cv::Mat::Mat(cv::Mat const&, cv::Rect_<int> const&)'
collect2: error: ld returned 1 exit status
So, this looks to me like g++ does not find the location of the header files, but they are installed in the correct directory!
root#Raspi_DataHarvest:~# find / | grep libuvc.h
/usr/local/include/libuvc/libuvc.h
root#Raspi_DataHarvest:~# find / | grep opencv2/opencv.hpp
/usr/local/include/opencv2/opencv.hpp
Furthermore, there's no effect using the absolute paths, like:
#include "/usr/local/include/libuvc.h"
...
Does anyone know how to solve the reference errors?
Try
g++ UVCCameraHandler.cpp -I/usr/local/include/libuvc -I/usr/local/include/opencv2 -luvc -lopencv
The most preferable
g++ UVCCameraHandler.cpp `pkg-config --libs --cflags opencv` `pkg-config --libs --cflags lubuvc`
Building a C++ program is a three-step process:
Editing the source
Compiling the source files into object files
Linking the object files into the final executable
Modern compilers often use front-end programs (like e.g. GCC with the g++ program) that combine steps 2 and 3 into a single action.
In step 2 above, the header files are included.
In step 3 you need to link with the actual libraries. You do not do this, so the linker will complain that it can't find the functions you use.
Linking with the libraries using GCC is done with the -l (lower-case L) option, listing the library name. Like for example -lopencv to link with the OpenCV library.
If the libraries are in a non-standard location (which /usr/local/lib usually is) then you need to tell the linker where to find the libraries as well. This is done with the -L option, similar to the -I option you already use to tell the compiler where to search for header-files. For example -L/usr/local/lib.
You need to link against the correct libraries (assuming your libs are in /usr/local/lib):
g++ UVCCameraHandler.cpp -I/usr/local/include/libuvc -I/usr/local/include/opencv2 -L/usr/local/lib -luvc -lopencv_core
I followed the clang/llvm directions TO THE TEE (and this is my 5th time doing it so I'm very certain I put everything in the right place). The directions I followed are here: https://clang.llvm.org/get_started.html
(steps 1-7, including the optional ones).
At that point everything is fine, no error messages.
When I try to build with 'make', when it gets to libcxx it has linker errors:
.
.
.
[100%] Built target cxx_objects
[100%] Linking CXX shared library ../../../lib/libc++.so
CMakeFiles/cxx_objects.dir/__/src/locale.cpp.o: In function `std::__1::(anonymous namespace)::__throw_runtime_error(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)':
locale.cpp:(.text.unlikely._ZNSt3__112_GLOBAL__N_1L21__throw_runtime_errorERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+0xf): undefined reference to `__cxa_allocate_exception'
locale.cpp:(.text.unlikely._ZNSt3__112_GLOBAL__N_1L21__throw_runtime_errorERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+0x33): undefined reference to `__cxa_throw'
locale.cpp:(.text.unlikely._ZNSt3__112_GLOBAL__N_1L21__throw_runtime_errorERKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE+0x3e): undefined reference to `__cxa_free_exception'
CMakeFiles/cxx_objects.dir/__/src/locale.cpp.o: In function `std::__1::ctype_byname<wchar_t>::do_widen(char) const':
locale.cpp:(.text._ZNKSt3__112ctype_bynameIwE8do_widenEc+0x43): undefined reference to `__cxa_call_unexpected'
CMakeFiles/cxx_objects.dir/__/src/locale.cpp.o: In function `std::__1::ctype_byname<wchar_t>::do_widen(char const*, char const*, wchar_t*) const':
locale.cpp:(.text._ZNKSt3__112ctype_bynameIwE8do_widenEPKcS3_Pw+0x7a): undefined reference to `__cxa_call_unexpected'
CMakeFiles/cxx_objects.dir/__/src/locale.cpp.o: In function `std::__1::ctype_byname<wchar_t>::do_narrow(wchar_t, char) const':
locale.cpp:(.text._ZNKSt3__112ctype_bynameIwE9do_narrowEwc+0x46): undefined reference to `__cxa_call_unexpected'
CMakeFiles/cxx_objects.dir/__/src/locale.cpp.o: In function `std::__1::ctype_byname<wchar_t>::do_narrow(wchar_t const*, wchar_t const*, char, char*) const':
locale.cpp:(.text._ZNKSt3__112ctype_bynameIwE9do_narrowEPKwS3_cPc+0x8d): undefined reference to `__cxa_call_unexpected'
CMakeFiles/cxx_objects.dir/__/src/locale.cpp.o: In function `std::__1::locale::__imp::use_facet(long) const [clone .part.18]':
locale.cpp:(.text.unlikely._ZNKSt3__16locale5__imp9use_facetEl.part.18+0x7): undefined reference to `__cxa_allocate_exception'
locale.cpp:(.text.unlikely._ZNKSt3__16locale5__imp9use_facetEl.part.18+0x28): undefined reference to `__cxa_throw'
CMakeFiles/cxx_objects.dir/__/src/locale.cpp.o: In function `std::__1::__time_get_c_storage<char>::__weeks() const':
locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE7__weeksEv+0x21): undefined reference to `__cxa_guard_acquire'
locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE7__weeksEv+0x167): undefined reference to `__cxa_guard_release'
locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE7__weeksEv+0x178): undefined reference to `__cxa_guard_acquire'
locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE7__weeksEv+0x35a): undefined reference to `__cxa_guard_release'
locale.cpp:(.text._ZNKSt3__120__time_get_c_storageIcE7__weeksEv+0x383): undefined reference to `__cxa_guard_abort'
.
.
.
What am I doing wrong? Again, a fresh Ubuntu install, so I didn't install anything with apt install or change my PATH or anything like that.
I've just installed Eclipse CDT and tryied to install sfml 2 in it. I seem to have a problem at linking the libs as it won't compile neither with static or dynamic linking. It just gives me these errors:
22:08:57 **** Incremental Build of configuration Debug for project sdl ****
Info: Internal Builder is used for build
g++ "-LC:\\Users\\Romeo\\Desktop\\SFML-2.0-rc\\lib" -o sdl.exe "src\\sdl.o" -lsfml-graphics-s-d -lsfml-window-s-d -lsfml-system-s-d
src\sdl.o: In function `main':
D:\_workspace\_eclipsec++\sdl\Debug/../src/sdl.cpp:5: undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
D:\_workspace\_eclipsec++\sdl\Debug/../src/sdl.cpp:5: undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, std::string const&, unsigned int, sf::ContextSettings const&)'
D:\_workspace\_eclipsec++\sdl\Debug/../src/sdl.cpp:6: undefined reference to `sf::CircleShape::CircleShape(float, unsigned int)'
D:\_workspace\_eclipsec++\sdl\Debug/../src/sdl.cpp:7: undefined reference to `sf::Color::Green'
D:\_workspace\_eclipsec++\sdl\Debug/../src/sdl.cpp:7: undefined reference to `sf::Shape::setFillColor(sf::Color const&)'
D:\_workspace\_eclipsec++\sdl\Debug/../src/sdl.cpp:15: undefined reference to `sf::Window::close()'
D:\_workspace\_eclipsec++\sdl\Debug/../src/sdl.cpp:12: undefined reference to `sf::Window::pollEvent(sf::Event&)'
D:\_workspace\_eclipsec++\sdl\Debug/../src/sdl.cpp:18: undefined reference to `sf::Color::Color(unsigned char, unsigned char, unsigned char, unsigned char)'
D:\_workspace\_eclipsec++\sdl\Debug/../src/sdl.cpp:18: undefined reference to `sf::RenderTarget::clear(sf::Color const&)'
D:\_workspace\_eclipsec++\sdl\Debug/../src/sdl.cpp:19: undefined reference to `sf::RenderStates::Default'
D:\_workspace\_eclipsec++\sdl\Debug/../src/sdl.cpp:19: undefined reference to `sf::RenderTarget::draw(sf::Drawable const&, sf::RenderStates const&)'
D:\_workspace\_eclipsec++\sdl\Debug/../src/sdl.cpp:20: undefined reference to `sf::Window::display()'
D:\_workspace\_eclipsec++\sdl\Debug/../src/sdl.cpp:9: undefined reference to `sf::Window::isOpen() const'
D:\_workspace\_eclipsec++\sdl\Debug/../src/sdl.cpp:5: undefined reference to `sf::RenderWindow::~RenderWindow()'
D:\_workspace\_eclipsec++\sdl\Debug/../src/sdl.cpp:5: undefined reference to `sf::RenderWindow::~RenderWindow()'
D:\_workspace\_eclipsec++\sdl\Debug/../src/sdl.cpp:5: undefined reference to `sf::RenderWindow::~RenderWindow()'
src\sdl.o: In function `~CircleShape':
C:/Users/Romeo/Desktop/SFML-2.0-rc/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `vtable for sf::CircleShape'
C:/Users/Romeo/Desktop/SFML-2.0-rc/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `vtable for sf::CircleShape'
C:/Users/Romeo/Desktop/SFML-2.0-rc/include/SFML/Graphics/CircleShape.hpp:41: undefined reference to `sf::Shape::~Shape()'
collect2: ld returned 1 exit status
22:08:59 Build Finished (took 1s.419ms)
I think i'm doing something wrong but i can't figure out what. A little help?
Because your g++ is different from the compiler to build sfml. Any following combination will cause your problem:
g++ <-> cl(vc++'s compiler)
g++32 <-> g++64
g++ <-> gcc