Error building Quantlib involving Boost (Ubuntu) - boost

I am attempting to build QuantLib 1.9 on my machine (Xubuntu 16.04), and I got Boost via "sudo apt-get...."
QuantLib compiles fine until the following sequence of events:
make[1]: Entering directory '/home/Downloads/packages/QuantLib-1.9/test-suite'
There are two calls to libtool, the first looks like this:
/bin/bash ../libtool --tag=CXX --mode=link g++ -g -O2 -o quantlib-test-suite
Followed by nearly 100 *.o files, and terminated by this string:
libUnitMain.la ../ql/libQuantLib.la -lboost_unit_test_framework
There is a second call to libtool after that one:
libtool: link: g++ -g -O2 -o .libs/quantlib-test-suite
Also followed by 100 *.o files, and terminated by this string:
./.libs/libUnitMain.a ../ql/.libs/libQuantLib.so -lboost_unit_test_framework
Here is where the error crops up, and the build then fails:
quantlibtestsuite.o: In function `make_test_case':
/usr/include/boost/test/unit_test_suite_impl.hpp:255: undefined reference to boost::unit_test::ut_detail::normalize_test_case_name(boost::unit_test::basic_cstring<char const>)'
/usr/include/boost/test/unit_test_suite_impl.hpp:255: undefined reference to `boost::unit_test::ut_detail::normalize_test_case_name(boost::unit_test::basic_cstring<char const>)'
americanoption.o: In function `make_test_case':
/usr/include/boost/test/unit_test_suite_impl.hpp:255: undefined reference to `boost::unit_test::ut_detail::normalize_test_case_name(boost::unit_test::basic_cstring<char const>)'
/usr/include/boost/test/unit_test_suite_impl.hpp:255: undefined reference to `boost::unit_test::ut_detail::normalize_test_case_name(boost::unit_test::basic_cstring<char const>)'
americanoption.o: In function `boost::unit_test::make_test_case(boost::unit_test::callback0<boost::unit_test::ut_detail::unused> const&, boost::unit_test::basic_cstring<char const>)':
/usr/include/boost/test/unit_test_suite_impl.hpp:255: undefined reference to `boost::unit_test::ut_detail::normalize_test_case_name(boost::unit_test::basic_cstring<char const>)'
amortizingbond.o:/usr/include/boost/test/unit_test_suite_impl.hpp:255: more undefined references to `boost::unit_test::ut_detail::normalize_test_case_name(boost::unit_test::basic_cstring<char const>)' follow
collect2: error: ld returned 1 exit status
Makefile:1075: recipe for target 'quantlib-test-suite' failed
make[1]: *** [quantlib-test-suite] Error 1
make[1]: Leaving directory '/home/Downloads/packages/QuantLib-1.9/test-suite'
Makefile:601: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

It's possible that you're compiling with a version of Boost and you're trying to link with another (you're saying that you got Boost via apt-get, which installs into /usr, but then you pass to ./configure a path in your home directory). This would explain why the linker is looking for a method in boost::unit_test::ut_detail that's not in the library.
If you want to use the version of Boost that came with apt-get, removing the boost paths from the call to ./configure should make it work. If you want to use the one you have installed locally, you should first check that you actually have the compiled libraries in /home/EmilioW/Downloads/boost_1_62_0/libs. If they are in fact there, and if you don't need Boost for something else, you can use apt-get to uninstall the packaged version. If you need both installed, you'll have to check the order in which the compiler and linker list the -I and -L paths and ensure that the ones you want come first...

Related

net-snmp flags in CMAKE

Before anything, I just want to say I am very new to CMAKE, almost never used it but now forced to...
I am trying to include snmp features in a previous project, using Net-SNMP library. But first, I wrote a minimalistic code just to test my functions. According to the library tutorial, this is how I must compile the code:
First, I must create object file:
gcc -I. `net-snmp-config --cflags` -c -o tfsnmpset.o tfsnmpset.c
Then, I must generate the executable:
gcc -o tfsnmpset tfsnmpset.o `net-snmp-config --libs`
By doing this, the program compiles perfectly and everything is fine.
Now the project in which I want to incorporate that piece of code uses CMakeLists.txt to generate its makefile.
My question is, how do I include the following flags in my CMakeLists.txt?
When creating object files: `net-snmp-config --cflags`
When generating executable: `net-snmp-config --libs`
I actually tried to build a library out of my code that uses Net-SNMP that I could just use in my main project:
cmake_minimum_required(VERSION 3.12)
project(snmp_daemon C)
set(CMAKE_C_STANDARD 99)
SET(CMAKE_C_COMPILER /usr/bin/gcc)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I. `net-snmp-config --cflags`" )
add_library(tfsnmpset tfsnmp.c tfsnmp.h)
add_executable(snmp_daemon main.c ./tfsnmp.h)
target_link_libraries(snmp_daemon tfsnmpset)
The errors:
/media/user/xtra/apps/clion-2018.2.1/bin/cmake/linux/bin/cmake --build /home/fabrice/projects/snmp-daemon/cmake-build-debug --target snmp_daemon -- -j 2
[ 25%] Linking C static library libtfsnmpset.a
[ 50%] Built target tfsnmpset
[ 75%] Linking C executable snmp_daemon
libtfsnmpset.a(tfsnmp.c.o): In function `tfsnmpset':
/home/user/projects/snmp-daemon/tfsnmp.c:121: undefined reference to `snmp_parse_args'
/home/user/projects/snmp-daemon/tfsnmp.c:147: undefined reference to `snmp_get_do_debugging'
/home/user/projects/snmp-daemon/tfsnmp.c:147: undefined reference to `debugmsgtoken'
/home/user/projects/snmp-daemon/tfsnmp.c:147: undefined reference to `debugmsg'
/home/user/projects/snmp-daemon/tfsnmp.c:147: undefined reference to `debugmsgtoken'
/home/user/projects/snmp-daemon/tfsnmp.c:147: undefined reference to `debugmsg'
/home/user/projects/snmp-daemon/tfsnmp.c:194: undefined reference to `snmp_open'
/home/user/projects/snmp-daemon/tfsnmp.c:199: undefined reference to `snmp_sess_perror'
/home/user/projects/snmp-daemon/tfsnmp.c:207: undefined reference to `snmp_pdu_create'
/home/user/projects/snmp-daemon/tfsnmp.c:210: undefined reference to `snmp_parse_oid'
/home/user/projects/snmp-daemon/tfsnmp.c:211: undefined reference to `snmp_perror'
/home/user/projects/snmp-daemon/tfsnmp.c:214: undefined reference to `snmp_add_var'
/home/user/projects/snmp-daemon/tfsnmp.c:216: undefined reference to `snmp_perror'
/home/user/projects/snmp-daemon/tfsnmp.c:222: undefined reference to `snmp_close'
/home/user/projects/snmp-daemon/tfsnmp.c:230: undefined reference to `snmp_synch_response'
/home/user/projects/snmp-daemon/tfsnmp.c:236: undefined reference to `print_variable'
/home/user/projects/snmp-daemon/tfsnmp.c:239: undefined reference to `snmp_errstring'
/home/user/projects/snmp-daemon/tfsnmp.c:247: undefined reference to `fprint_objid'
/home/user/projects/snmp-daemon/tfsnmp.c:257: undefined reference to `snmp_sess_perror'
/home/user/projects/snmp-daemon/tfsnmp.c:262: undefined reference to `snmp_free_pdu'
/home/user/projects/snmp-daemon/tfsnmp.c:263: undefined reference to `snmp_close'
collect2: error: ld returned 1 exit status
CMakeFiles/snmp_daemon.dir/build.make:84: recipe for target 'snmp_daemon' failed
make[3]: *** [snmp_daemon] Error 1
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/snmp_daemon.dir/all' failed
make[2]: *** [CMakeFiles/snmp_daemon.dir/all] Error 2
CMakeFiles/Makefile2:84: recipe for target 'CMakeFiles/snmp_daemon.dir/rule' failed
make[1]: *** [CMakeFiles/snmp_daemon.dir/rule] Error 2
Makefile:118: recipe for target 'snmp_daemon' failed
make: *** [snmp_daemon] Error 2
You should link to snmp libraries
find_library(NETSNMPAGENT "netsnmpagent")
find_library(NETSNMPMIBS "netsnmpmibs")
find_library(NETSNMP "netsnmp")
target_link_libraries(snmp_daemon tfsnmpset ${NETSNMPAGENT} ${NETSNMPMIBS} ${NETSNMP})

How to resolve undefined reference to wxString, when making File for Aqua3d?

I m trying to install Aqua3d "obinet.engr.uconn.edu/wiki/index.php/Aqua-3D_dev_manual`", for which I need to first make the file provided with the package, When I try to do so by using the command on terminal:
$ make -f Makefile.txt
I am getting the following output:
g++ wx-config --libs --cxxflags --gl-libs -lglut -lGLU -lGL -o aqua3d Aqua3D.o ControlPanel.o EnvironmentPanel.o FileChooser.o InformationPanel.o MainFrame.o PlaybackPanel.o PreferenceWindow.o ViewFileHandler.o NodeAttributeDialog.o Event.o AnnotationEvent.o DequeueEvent.o DropEvent.o EnqueueEvent.o HopEvent.o HopSignal.o NodeEvent.o ReceiveEvent.o WorldEvent.o DataManager.o Environment.o EventManager.o Node.o Parser.o vmath.o trackball.o
Aqua3D.o: In function Aqua3D::OnInit()':
Aqua3D.cpp:(.text+0x35): undefined reference towxStandardPathsBase::Get()'
Aqua3D.cpp:(.text+0x7a): undefined reference to wxString::Bef>
.
.
.
Parser.cpp:(.text+0x1e4d): undefined reference towxLogError(wchar_t const*, ...)'
collect2: error: ld returned 1 exit status
make: * [aqua3d] Error 1**
Kindly guide me how to resolve this problem?
FYI, I've already installed freeglut3-dev, libwxgtk2.8-dev, libgtk2.0-dev.
Aqua3d can be compiled with g++-4.4 : sudo apt-get install g++-4.4
Example, edited Makefile https://drive.google.com/file/d/0B7S255p3kFXNWC13UXZFZHJ6OUU/view?usp=sharing

Cannot build capybara-webkit 1.3 on Windows 7 64-bit (ruby 2.1.3)

I've followed the process outlined in the guide for several different versions of Qt (I've tried 4.8.4, 4.8.5 and 4.8.6 - now trying 4.5.4), but none have managed to complete the rake build step.
This is my current environment:
which qmake
C:\Qt\5.4\msvc2013_64\bin\qmake.EXE
which ruby
C:\Ruby21-x64\bin\ruby.EXE
which make
C:\Ruby21-x64\devkit\bin\make.EXE
And this is the current error returned from running bundle exec rake build in the capybara-webkit repository.
H:\capybara-webkit>bundle exec rake build
DL is deprecated, please use Fiddle
DL is deprecated, please use Fiddle
c:/Qt/5.4/msvc2013_64/bin/qmake.exe -spec win32-g++ CONFIG\+\=test -o Makefile w
ebkit_server.pro
cd src/ && ( test -e Makefile.webkit_server || c:/Qt/5.4/msvc2013_64/bin/qmake.e
xe H:/capybara-webkit/src/webkit_server.pro -spec win32-g++ CONFIG\+\=test -o Ma
kefile.webkit_server ) && make -f Makefile.webkit_server
make[1]: Entering directory `/h/capybara-webkit/src'
c:/Qt/5.4/msvc2013_64/bin/qmake.exe -spec win32-g++ CONFIG+=test -o Makefile.web
kit_server webkit_server.pro
make[1]: Leaving directory `/h/capybara-webkit/src'
make[1]: Entering directory `/h/capybara-webkit/src'
make -f Makefile.webkit_server.Release
make[2]: Entering directory `/h/capybara-webkit/src'
g++ -Wl,-s -Wl,-subsystem,console -mthreads -o release/webkit_server.exe object_
script.webkit_server.Release -LC:/Qt/5.4/msvc2013_64/lib -lQt5WebKitWidgets -lQ
t5Widgets -lQt5WebKit -lQt5Gui -lQt5Network -lQt5Core
./build/SetUnknownUrlMode.o:SetUnknownUrlMode.cpp:(.text+0x23): undefined refere
nce to `__imp__ZN10QArrayData10deallocateEPS_yy'
./build/SetUnknownUrlMode.o:SetUnknownUrlMode.cpp:(.text+0x92): undefined refere
nce to `__imp__ZN9QListData7disposeEPNS_4DataE'
./build/SetUnknownUrlMode.o:SetUnknownUrlMode.cpp:(.text+0x167): undefined refer
ence to `__imp__ZN9QListData11shared_nullE'
./build/SetUnknownUrlMode.o:SetUnknownUrlMode.cpp:(.text+0x16e): undefined refer
ence to `__imp__ZN7QString16fromAscii_helperEPKci'
./build/SetUnknownUrlMode.o:SetUnknownUrlMode.cpp:(.text+0x289): undefined refer
ence to `__imp__ZeqRK7QStringS1_'
./build/SetUnknownUrlMode.o:SetUnknownUrlMode.cpp:(.text+0x2fa): undefined refer
ence to `__imp__ZN7QString6appendERKS_'
./build/SetUnknownUrlMode.o:SetUnknownUrlMode.cpp:(.text+0x4b7): undefined refer
ence to `__imp__ZN10QArrayData10deallocateEPS_yy'
./build/SetUnknownUrlMode.o:SetUnknownUrlMode.cpp:(.text+0x4e5): undefined refer
ence to `__imp__ZN10QArrayData10deallocateEPS_yy'
./build/SetUnknownUrlMode.o:SetUnknownUrlMode.cpp:(.text+0x515): undefined refer
ence to `__imp__ZN10QArrayData10deallocateEPS_yy'
./build/SetUnknownUrlMode.o:SetUnknownUrlMode.cpp:(.text+0x595): undefined refer
ence to `__imp__ZN10QArrayData10deallocateEPS_yy'
./build/SetUnknownUrlMode.o:SetUnknownUrlMode.cpp:(.text+0x5c0): undefined refer
ence to `__imp__ZN10QArrayData10deallocateEPS_yy'
./build/SetUnknownUrlMode.o:SetUnknownUrlMode.cpp:(.text+0x5e6): more undefined
references to `__imp__ZN10QArrayData10deallocateEPS_yy' follow
c:/ruby21-x64/devkit/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x
86_64-w64-mingw32/bin/ld.exe: ./build/SetUnknownUrlMode.o: bad reloc address 0x0
in section `.pdata'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [release/webkit_server.exe] Error 1
make[2]: Leaving directory `/h/capybara-webkit/src'
make[1]: *** [release] Error 2
make[1]: Leaving directory `/h/capybara-webkit/src'
make: *** [sub-src-webkit_server-pro-make_first-ordered] Error 2
Command 'make' failed
If anyone has problems compiling capybara-webkit on Windows (and doesn't want to spend two days in google-purgatory) they can read this.

Install nullfs on Debian

I am using a java program. It automatically creates log files in a directory, but I am doing that myself a different way with tee. I cannot find an easy way to disable the logs, so I am resorting to using nullfs.
I cloned it with
git clone https://github.com/xrgtn/nullfs.git
and I ran
make nul1fs
as instructed. It terminates within a second, with the following output:
cc "-lfuse" nul1fs.c -o nul1fs
nul1fs.c:13:18: fatal error: fuse.h: No such file or directory
compilation terminated.
make: *** [nul1fs] Error 1
I tried apt-get source fuse and copying fuse.h into the nullfs directory, but nothing changed.
I have FUSE installed. I'm running Debian wheezy x86_64.
You need the development package of FUSE, which contains the fuse.h you're missing. Do a apt-get install libfuse-dev and it should work.
Copying the header file in the source directory did not work, because in nul1fs.c you'll notice that fuse.h is included with angle brackets. This means, the header file will be searched in the system-wide include paths. That usually means /usr/include.
Note that you then may run into this error:
$ make nul1fs
cc "-lfuse" nul1fs.c -o nul1fs
/tmp/ccbt0X7c.o: In function `main':
nul1fs.c:(.text+0x3c3): undefined reference to `fuse_main_real'
collect2: error: ld returned 1 exit status
make: *** [nul1fs] Error 1
It's a documented bug with a workaround: put the linker flags after the file lists. I.e. compile nul1fs with:
cc nul1fs.c -o nul1fs -lfuse
and not with make nul1fs, which boils down to
cc -lfuse nul1fs.c -o nul1fs

Problems linking to a library with gcc

I installed SFML from scratch today so I could work on a game. I downloaded the source, ran sudo make install, tried compiling one of my old projects, and I couldn't get it to link properly. So I tried running a simpler project: one of the samples in the tutorials. I tried to compile this one specifically, but I get these errors:
g++ -o atest test.cpp -lsfml-graphics -lsfml-window -lsfml-system /tmp/ccaa86fR.o: In function `main':
test.cpp:(.text+0x1d2): undefined reference to `gluPerspective'
collect2: ld returned 1 exit status
make: *** [test] Error 1
Trying an even simpler project, the one in the initial tutorial, I don't run into problems compiling. However, when I try to run it, I get this error:
./atest: error while loading shared libraries: libsfml-graphics.so.1.6: cannot open shared object file: No such file or directory
I checked, and the files did install to /usr/local/lib/ which is where they're supposed to go as far as I know. What am I doing wrong here?
-lGLU should fix the first error and for the second one make sure /usr/local/lib/ is in your ldconfig search path (/etc/ld.so.conf and /etc/ld.so.conf.d/* under Ubuntu) and that you ran ldconfig: sudo ldconfig -v then try running again.
see also man ldconfig

Resources