Building Boost with ICU using MinGW - c++

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.)

Related

ld: library not found for -lrt

I am trying to run a project that was made and works for Ubuntu but on Mac OS. And when I am doing the make I got the following error:
ld: library not found for -lrt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [consumer] Error 1
make[1]: *** [CMakeFiles/consumer.dir/all] Error 2
make: *** [all] Error 2
I can't see any library with that name at thole project.
Can anyone explain what it is and how to solve it?
On old Linux systems, several functions, such as clock_gettime, are documented to need -lrt for old versions of GNU libc. This is no more the case on recent glibc (after 2.17 from 2013).
So you can remove -lrt from your Makefile (and remove the thing from your cmake configuration thing generating it).
BTW, removing -lrt should also fit for recent Linux distributions.
PS. If you are paying support for your Linux system, you should ask your support for advice.

Error building MLT framework on Windows

I've been following the official building guide provided here. I need MLT to create a video player and I opted to only install the first 4 libraries, as stated on the guide (FFmpeg, SDL, dlfcn-win32, and libXML). I'm also using QT as my main framework for my application.
I'm a bit confused as far as this guide goes because I find the instructions for where the libraries should go a bit confusing. This is my current folder structure:
$HOME = C:\MinGW\msys\1.0\home\TKB (TKB is my user)
$HOME/build/lib -> libraries
$HOME/build/bin -> binaries
$HOME/build/include -> includes
$HOME/build/share/ffmpeg -> for the "presets" folder
At the same time, because I was confused, I have the same folders (bin, lib, include, share) inside $HOME/.
Then I have $HOME/src/mlt with the mlt files.
When I run the configure command I get this (I disabled the libraries I didn't install to reduce the output on the console):
Command: ./configure --prefix=$HOME/build --target-os=MinGW --enable-gpl --disable-decklink --disable-frei0r --disable-gtk2 --disable-sox --disable-jackrack --disable-swfdec --disable-resample
Configuring framework:
Configuring modules:
Configuring modules/avformat:
- libavformat not found: disabling
Configuring modules/core:
Configuring modules/feeds:
Configuring modules/kdenlive:
Configuring modules/linsys:
- does not build on OS X or Windows:disabling
Configuring modules/lumas:
Configuring modules/motion_est:
Configuring modules/normalize:
Configuring modules/oldfilm:
Configuring modules/opengl:
- movit not found: disabling
Configuring modules/plus:
Configuring modules/plusgpl:
Configuring modules/qt:
- Libexif not found, disabling exif features (auto rotate)
- Qt not found: disabling
Configuring modules/rtaudio:
Configuring modules/sdl:
Configuring modules/vid.stab:
- vid.stab not found: disabling
Configuring modules/videostab:
Configuring modules/vmfx:
Configuring modules/xine:
Configuring modules/xml:
- xml2 not found: disabling xml module
Configuring mlt++:
Configuring swig:
GPLv2 license used; GPLv3 components disabled
I have ffmpeg and the xml2 libraries on the folders but it looks like the script is not able to find them. I also have QT installed on the default folder and it also doesn't seem to find it.
I tried installing anyway (make all install) and I get the following error:
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -ldl
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lpthread
collect2.exe: error: ld returned 1 exit status
make[1]: *** [libmlt-6.dll] Error 1
make[1]: Leaving directory '/home/TKB/src/mlt-0.9.6/src/framework'
make: *** [all] Error 1
Can anyone help me with these errors?
Thank you for your time.
EDIT:
I found out that I made a naming mistake when creating the pkgconfig folder, changing that solved the xml2 not being detected problem. Also, I've added the paths for ffmpeg and qt manually and that also seemed to solve the problem. So now what I get with the configure is the following:
./configure --prefix=/home/TKB/build --enable-gpl --disable-decklink --disable-frei0r --disable-gtk2 --disable-sox --disable-jackrack --disable-swfdec --disable-resample --qt-libdir=C:/Qt/5.3/mingw482_32/lib --qt-includedir=C:/Qt/5.3/mingw482_32/include --avformat-shared=/home/TKB/share/ffmpeg --avformat-static=/home/TKB/bin
Configuring framework:
Configuring modules:
Configuring modules/avformat:
Configuring modules/core:
Configuring modules/feeds:
Configuring modules/kdenlive:
Configuring modules/linsys:
- does not build on OS X or Windows:disabling
Configuring modules/lumas:
Configuring modules/motion_est:
Configuring modules/normalize:
Configuring modules/oldfilm:
Configuring modules/opengl:
- movit not found: disabling
Configuring modules/plus:
Configuring modules/plusgpl:
Configuring modules/qt:
- Libexif not found, disabling exif features (auto rotate)
- Qt version 5.x detected
- Include directory: C:/Qt/5.3/mingw482_32/include
Configuring modules/rtaudio:
Configuring modules/sdl:
Configuring modules/vid.stab:
- vid.stab not found: disabling
Configuring modules/videostab:
Configuring modules/vmfx:
Configuring modules/xine:
Configuring modules/xml:
Configuring mlt++:
Configuring swig:
GPLv2 license used; GPLv3 components disabled
When I run make all install I still get an error, which is the following:
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -ldl
collect2.exe: error: ld returned 1 exit status
make[1]: *** [libmlt-6.dll] Error 1
make[1]: Leaving directory '/home/TKB/src/mlt/src/framework'
make: *** [all] Error 1
EDIT2: I have added dlfcn-win32's bin, lib and include to the respective bin, lib and include folders in c:/Qt/Tools/mingw482_32, which solved my problem. Now I am getting a new error, which seems of similar solution but I don't see what -lbz2 is.
The error follows below:
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lbz2
collect2.exe: error: ld returned 1 exit status
make[2]: *** [../libmltavformat.dll] Error 1
make[2]: Leaving directory '/home/TKB/src/mlt/src/modules/avformat'
make[1]: *** [all] Error 1
make[1]: Leaving directory '/home/TKB/src/mlt/src/modules'
make: *** [all] Error 1
EDIT3: Right now I'm getting the following error:
After the compile code runs (it generates the .o) I get "undefined reference to 'ffmpeg_function'" in every file of the avformat module. I've noticed that it locates the includes correctly, so the problem must be in finding the libs.
I've noticed that on the config.mak file the LDFLAGS are like this:
LDFLAGS+=-L/home/TKB/bin/libavformat -L/home/TKB/bin/libavcodec -L/home/TKB/bin/libavutil
LDFLAGS+=-L/home/TKB/bin/libswscale
LDFLAGS+=-L/home/TKB/bin/libavdevice
Shouldn't it be -l (lower case) to identify a file instead of a folder? Or is it expecting one folder per lib? Besides the ffmpeg libs are named differently (e.g. avformat-56.dll)
EDIT4: To test things out I have added the following to the config.mak of the avformat module:
LDFLAGS+=-l/home/TKB/bin/avformat-56 -l/home/TKB/bin/avcodec-56 -l/home/TKB/bin/avutil-54
LDFLAGS+=-l/home/TKB/bin/swscale-3
LDFLAGS+=-l/home/TKB/bin/avdevice-56
The previous error disappeared but now I am getting the following one:
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lC:/MinGW/mysys/1.0/home/TKB/bin/avformat-56
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lC:/MinGW/mysys/1.0/home/TKB/bin/avcodec-56
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lC:/MinGW/mysys/1.0/home/TKB/bin/avutil-54
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lC:/MinGW/mysys/1.0/home/TKB/bin/swscale-3
c:/Qt/Tools/mingw482_32/bin/../lib/gcc/i68-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lC:/MinGW/mysys/1.0/home/TKB/bin/avdevice-56
collect2.exe: error: ld returned 1 exit status
make[2]: *** [../libmltavformat.dll] Error 1
make[2]: Leaving directory '/home/TKB/src/mlt/src/modules/avformat'
make[1]: *** [all] Error 1
make[1]: Leaving directory '/home/TKB/src/mlt/src/modules'
make: *** [all] Error 1
The dlls are on that folder.
EDIT5: It seems I finally managed to compile! I changed the LDFLAGS to the following:
LDFLAGS+=-L/home/TKB/bin
LDFLAGS+=-lavformat-56 -lavcodec-56 -lavutil-54
LDFLAGS+=-lswscale-3
LDFLAGS+=-lavdevice-56
And it finished without errors.
Thank you Brian for all the time and help you gave me!
Make sure you have pkg-config installed:
http://www.mltframework.org/pub/Shotcut/SetupWindowsDev/pkg-config.exe
You should be able to run pkg-config from the command line and get a good response. e.g:
# pkg-config --modversion libxml-2.0
2.9.1
# pkg-config --modversion QtGui
4.8.6
If you don't get a good response from pkg-config, you may need to set PKG_CONFIG_PATH to point at the .pc files for each of the dependencies.
Also, have a good look at the pkg-config documentation. There are some special considerations you may need to make for Windows:
http://linux.die.net/man/1/pkg-config
You also need to install dlfcn-win32. From the MLT Windows instructions:
Download dlfcn-win32
cd ~/src/dlfcn-win32-r19
./configure --enable-shared make all install
To make this redistributable, copy /mingw/bin/libdl.dll to your build directory.
If you did follow those instructions, perhaps you need to find a place to put libdl.dll so that the linker finds it.
For the "-lbz2" error, it looks like you need to download, compile and install the bzip2 library to match the one that ffmpeg was compiled against:
bzip2 1.0.6
Have a look at the README.txt file that came with the ffmpeg-shared package you downloaded. There is a long list of external libraries that ffmpeg was compiled against. bzip2 is the first one. You might need to download/compile/install more of those.
EDIT 3:
You should not specify both --avformat-shared and --avformat-static - they are mutually exclusive. You could try specifying neither of them. Or, try setting --avformat-shared=$HOME/build/
EDIT 4:
I think the reason that you are having trouble linking is because the Zeranoe builds no longer include pkg-config files (.pc).
http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=7&t=532&hilit=pkg+config
The MLT configure script relies on pkg-config to set the correct linker flags. The MLT configure script could be extended to allow the user to specify the correct linker flags. Until that happens, I think that hacking config.mak (like you did) will be the only way to make it work on Windows.
I'm glad you got it to work. Cheers!

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

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.

ld lookup to find library

I'm cross compiling to an arm embedded system and receiving an error that I have questions about. Here is the error:
[ 19%] Built target cxjpeg-6b
Linking CXX shared library /home/botbear/JAUS++-2.110519- src/libraries/jaus++/2.0/lib/libcxutils.so
/home/botbear/openwrt/trunk/staging_dir/toolchain-arm_v6k_gcc-linaro_uClibc- 0.9.32_eabi/lib/gcc/arm-openwrt-linux-uclibcgnueabi/4.5.4/../../../../arm-openwrt-linux- uclibcgnueabi/bin/ld: cannot find -lpng
collect2: ld returned 1 exit status
make[2]: *** [/home/botbear/JAUS++-2.110519-src/libraries/jaus++/2.0/lib/libcxutils.so] Error 1
make[1]: *** [libcxutils/CxUtils/libcxutils/CMakeFiles/cxutils.dir/all] Error 2
make: *** [all] Error 2
As you can see the linker is looking for a static library named 'libpng'. In addition to the libpng lib., the command in the sub-make file using the -l switch to link to the following libraries: -lpng -lz -lX11 -lXtst -lpthread -Wl. All of the libraries (libpng,libz,libX11, etc) are in my host /usr/lib/ directory but my target toolchain does not have the the libraries. My question is if I manually recompile the libraries with my target compiler will that solved my problem? Or I'm going to have find and install packages for each of the libraries for my target platform.
Thanks in advance.
You seem to compile for the target, so you need target libraries. Either compiled by yourself or provided by the toolchain development environment (if you have one). The latter usually saves you some headaches (cross compiling and setting the paths where necessary).
I see you are using openwrt toolchain. Openwrt seems to have libpng as a package. I'd go with that if possible.