Error message when building WxWidgets sample program - c++

I was trying to follow the instructions here to setup WxWidgets.
I've managed to run the commands wx-config --version and wx-config --list but not the commands to compile the minimal example, which are:
cd gtk-build/samples/minimal
make
./minimal
After lots of display messages I arrive at:
/usr/bin/ld: cannot find -lwxtiff-3.1
/usr/bin/ld: cannot find -lwxjpeg-3.1
/usr/bin/ld: cannot find -lwxregexu-3.1
collect2: error: ld returned 1 exit status
make: *** [minimal] Error 1
Makefile:149: recipe for target 'minimal' failed
The command '/bin/sh -c make' returned a non-zero code: 2
Did I miss the installation of some library?
There is a similar question for windows here, but the answers there seem not to apply for linux.

First of all, please look at the official instructions rather than the wiki which may, or not, be up to date.
Second, by running make clean you removed the libraries used by the in-tree makefiles. So, unsurprisingly, you can't use them any more, but you can use makefile.unx from the source tree, i.e. if wx-config is in your PATH, just use make -f makefile.unx in $wx/samples/minimal (and not under gtk-build/samples/minimal).

Related

Fedora 22 - compile - __atomic_is_lock_free

I am try to compile a software (SuperCollider) on Fedora 22 but I run into a problem:
libsupernova.a(server.cpp.o): In function `std::atomic<boost::lockfree::detail::tagged_index>::is_lock_free() const':
/usr/include/c++/5.1.1/atomic:212: undefined reference to `__atomic_is_lock_free'
collect2: error: ld returned 1 exit status
server/supernova/CMakeFiles/supernova.dir/build.make:96: recipe for target 'server/supernova/supernova' failed
make[2]: *** [server/supernova/supernova] Error 1
CMakeFiles/Makefile2:3383: recipe for target 'server/supernova/CMakeFiles/supernova.dir/all' failed
make[1]: *** [server/supernova/CMakeFiles/supernova.dir/all] Error 2
Makefile:146: recipe for target 'all' failed
make: *** [all] Error 2
It seems to me that this is a problem with libatomic. Is it possible that gcc does not link to libatomic?
Does someone have any idea on how to solve this problem?
Another idea would be to try to install -latomic, but I cannot find information about.
Instead I already installed libatomic. I don't know if they are the same.
i ran into the same issue, and yes you do need to link libatomic. the way to do this is to add to the line: set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic") to the top level CMakeLists.txt file before running cmake.
the full flow might look like this:
git clone https://github.com/supercollider/supercollider.git
cd supercollider
add set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -latomic") to top level CMakeLists.txt
run ccmake . to configure the install
mkdir _build ; cd _build
cmake ..
make && <sudo> make install
you may or may not need sudo depending on where you have decided to install supercollider.
It seems to me that this is a problem with libatomic. Is it possible that gcc does not link to libatomic?
It only links to libatomic if you tell it to.
Does someone have any idea on how to solve this problem?
Link to libatomic.
Another idea would be to try to install -latomic, but I cannot find information about. Instead I already installed libatomic. I don't know if they are the same.
You can't "install -latomic" because -latomic is the compiler/linker option that says to link to libatomic, and you can't "install a linker option" because it's an option to a program, not a package.
You install libatomic, then you link to it with -latomic
(Aside: I hope to fix GCC so that you won't need to use -latomic explicitly for simple cases, only more complex ones, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65913)

opencv installation error ubuntu

I'm trying to install opencv to my Ubuntu 14.04 machine using the documentation provided in
http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation
However, during the compilation process I get the following error.
Linking CXX shared library ../../lib/libopencv_videoio.so
/usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_videoio.so.3.0.0] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make: *** [all] Error 2
I noticed a few posts mentioning similar errors and some solutions suggest removing the libavcodec.a from /usr/local/lib/. I'd like not to do that as I need ffmpeg libraries in the machine as well.
Could someone please help me to resolve this issue?.
Thanks
I got it to work (for installing ffmpeg) by simply reinstalling the whole thing from the beginning with all instances of $ ./configure replaced by $ ./configure --enable-shared (first make sure to delete all the folders and files including the .so files from the previous attempt).
Apparently this works because https://stackoverflow.com/a/13812368/10593190.
And this matches with #camino's comment on https://stackoverflow.com/a/19365454/10593190 and XavierStuvw's answer.
Just run these 2 lines in your terminal/environment:
pip install opencv-python==3.4.5.20
pip install opencv-contrib-python==3.4.5.20

linking things in c++ using object file

PROBLEM SOLVED:::
I am using LEDA library in c++.
command used to make object file.
g++ -I$LEDAROOT/incl -c mult.cpp
this command runs fine
I am getting eroor while linking step.
HERE IS THE EROOR
varun#Kinley:~/Documents/LEDA/test/numbers$ g++ -L$LEDAROOT mult.o -lleda -lX11 -lm
/usr/bin/ld: cannot find -lX11
collect2: error: ld returned 1 exit status
I think I need to install some package,because when I googled this error the most of problems are solved by installing some package .
I didn't find lx11 error
some of the eroor messages that I googled.
error 1
/usr/bin/ld: cannot find -lfreetype collect2: ld returned 1 exit
status
error 2
/usr/bin/ld: cannot find -lz collect2: ld returned 1 exit status
Links where I find these posts
http://www.qtcentre.org/threads/21069-collect2-ld-returned-1-exit-status
http://www.cyberciti.biz/faq/centos-rhel-redhat-usrbinld-cannot-findlc-error/
Do I need to install some package or there is some other problem
Could be two things
1) The X11 library is installed in a non-standard path. Use the search command to see if libX11.a or libX11.so is available on your system. If yes add the directory path to the -L option.
2) You are missing the libX11 library.
In this case, login as admin and use yum (assuming linux) to install this library.
Eg:
"yum install libX11.i386" or "yum install libX11.x86_64", depending on your architecture (32 bit or 64 bit).

Why can't the linker find the CppUnit libraries?

I am trying to learn the CPPUNIT i looked at the following link:
CPPUNIT
although the selected language here is c i have selected c++ while creating this application and have added the
C:\cppunit\cppunit-1.12.1\include to the include directories i have also added cppunitd,cppunit in the linker options however i still the errors as while i try to test the cppunit.
Errors:
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: cannot find
-lcppunitd
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: cannot find -lcppunit
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../../mingw32/bin/ld.exe: cannot find -lcppunit
collect2: ld returned 1 exit status
make[1]: *** [build/Debug/MinGW_1-Windows/tests/TestFiles/f1] Error 1
make: *** [.build-tests-impl] Error 2
BUILD TESTS FAILED (exit value 2, total time: 4s)
Need to use the -L flag and have a path to the library.
I experienced the same linker error and found that I only had 64-bit version of CppUnit installed while building 32-bit application. I solved it by installing 32-bit version of the library.

Building Boost with ICU using MinGW

I downloaded the last ICU release (49) binaries and add the following arg to b2:
-sICU_PATH="D:\lib64\icu"
I got
gcc.link D:\boost\1.51.0\boost\boost\bin.v2\libs\locale\build\gcc-mingw-4.7.1\debug\has_icu64.exe
d:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -licui18n
d:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.7.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -licudata
collect2.exe: error: ld returned 1 exit status
There were not such libicui18n, libicudata among icu binaries.
So I tried to build it myself. I got this error
PATH=../../lib:../../stubdata:../../tools/ctestfw:$PATH ../../bin/genrb -e UTF-8 -s resources -d uconvmsg root.txt
Makefile:173: recipe for target `uconvmsg/root.res' failed
make[2]: *** [uconvmsg/root.res] Error 127
Could somebody suggest me how I should build Boost with ICU using MinGW?
1.) the libraries in the package you downloaded are named icuin49.dll, icudt49.dll. We build regularly with mingw (and many other platforms) to test, but don't post those binaries.
2.) uconv is just an extra. You can disable it with --disable-extras on the configure line. (not enough info there to tell me why it failed.)