Boost Regex not playing welll with Snow leopard - regex

So I inherited code written in C++ that uses the Boost library. I could compile (using Code Blocks) and run the code on Linux Ubuntu but when I ported it over to the mac and installed the boost library, I can compile it using code blocks (and specifying the location of the regex libraries) but it won't run.
It just gives me the error:
$ ./BLAH_PD
dyld: Library not loaded: libboost_regex.dylib
Referenced from: /Users/spinach/Desktop/B/BLAH/bin/Release/./BLAH_PD
Reason: image not found
Trace/BPT trap
I'm not sure what to do next but any help would be greatly appreciated.
David

You need to set the DYLD_LIBRARY_PATH environment variable to include the path where you installed the compiled Boost libs.

Did you follow these directions?
Boost.Regex is not a header only library. You will need to install/compile the .dynlib. If you did this, did you remember to correctly link it? (-llibboost_regex -LPATH_TO_BOOST_BIN)

Related

C++ (gcc) dyld: Library not loaded: #loader_path/libssl.1.1.dylib

I am trying to link to a dynamic library on MacOs using gcc (C++). When I compile, there are no issues. But when I try running the program, this is what I get:
dyld: Library not loaded: #loader_path/libssl.1.1.dylib
I haven't moved the library from its directory, so I have no idea how to fix this. What should I do? (If you need more information, let me know as I would be happy to provide it)

Can I compile a Qt application while ignoring Qt's packaged libraries?

I am attempting to compile a Qt application in Antergos Arch Linux, and the application makes use of icu-related libraries. I was a little confused when I got the following linker errors:
/usr/bin/ld: warning: libicuuc.so.60, needed by /usr/lib/libxml2.so.2, may conflict with libicuuc.so.56
/usr/bin/ld: warning: libicudata.so.60, needed by /usr/lib/libicuuc.so.60, may conflict with libicudata.so.56
These were followed by several undefined references to functions from the libraries. I double-checked all the versions of libicu* that I had on my system and could only find version 60; it wasn't until I looked in my Qt install directory, under Qt/5.10.0/gcc_64/lib, that I realised Qt was providing the version 56 library files.
I'm not all that hot on linker-related problems. Is it possible to have the compiler ignore the libraries provided with Qt and just link against the version 60 libs that I already have on my system? If not, what are my options for workarounds?
Yes and no.
In theory Qt could simply use the v60 instead of the v56 icu library, provided that the 2 versions are binary compatible.
However, Qt libraries specifically require the version 56 of the icu libraries. Also you are trying to use libxml which requires the version 60 of the icu libraries. That means that you need both version 56 and 60 at the same time, which is not possible because you end up with conflicting symbols.
The origin of you issue is likely that you use the Qt packages provided by the Qt Company. Such packages are built to work with most Linux distributions, but they cannot be 100% compatible.
The solution is to use builds of Qt and libxml that use the same version of the icu libraries.
The easiest solution is to use the Qt libraries provided by your Linux distro. Another solution is to build Qt from source.
Define the order of of the v60 libs before Qt/(...)/lib; in your PATH variable. If you're using a bash shell, refresh it after you change the PATH variable by running hash.

Issues with Boost Linking/Build in Dev-C++

I'm trying to compile a personal program that uses the Boost/Regex library in Orwell Dev-C++ with TDM-GCC 4.8.2 64 bit Release, and when I attempt to initialize a Boost::Regex object I get these error messages.
text$_ZN5boost9re_detail27cpp_regex_traits_char_layerIcEC2ERKNS0_21cpp_regex_traits_baseIcEE[_ZN5boost9re_detail27cpp_regex_traits_char_layerIcEC2ERKNS0_21cpp_regex_traits_baseIcEE]+0x2b): undefined reference to `boost::re_detail::cpp_regex_traits_char_layer<char>::init()'
regex_tester_main.cpp:(.text$_ZN5boost9re_detail11raw_storage6extendEy[_ZN5boost9re_detail11raw_storage6extendEy]+0x5f): undefined reference to `boost::re_detail::raw_storage::resize(unsigned long long)'
regex_tester_main.o: bad reloc address 0x5f in section `.text$_ZN5boost9re_detail11raw_storage6extendEy[_ZN5boost9re_detail11raw_storage6extendEy]'
I've followed this guide to install Boost and I used gcc as my toolkit parameters for the bootstrap.bat and the b2 builder. I've included the include and lib paths in my includes and library options. And lastly linked the appropriate libboost_regex*.a file. Before this I tried using the mingw toolkit option for the bootstrap and gcc option for b2 like the tutorial linked above does, and encountered the same errors. Can anyone shed insight into what has gone wrong?
SOLVED!
I also have the Haskell GHC installed which comes packaged with a mingw/GCC package which was located earlier in the PATH environment variable than the TDM-GCC/minGW-64 package I was aiming to use to build Boost. And so when I specified my toolset it was targeting the wrong complier and thus when I tried to build other programs with Boost it probably ran into some name-mangling issues. I removed GHC's mingw/GCC complier package from PATH and rebuilt Boost, it complies and links fine now :).

Build issues with libzbar based Qt application

I am using libzbarQT (libzbarQT.so) in my QT code.I am facing an error while building the code saying "undefined reference to QWidget::qwsEvent(QWSEvent *event)".I am not using this function in my QT code.I want to know which function is internally calling this function so that I can tweak the library a bit.
Any suggestions please..
Thanks in advance for any help.
PS: I am crosscompiling my code using arm-none-linux-gnueabi-g++ toolchain with LTIB.
To solve error '/usr/lib/libzbarqt.so: undefined reference to QX11Info::display()', I have build Qt with X11.Now I am getting error:libzbarqt.so: undefined reference toQWidget::qwsEvent(QWSEvent*)' error.
In general, you could make sure that the symbols are present in the library unless it is built without symbols. I usually use the nm -a and objdump utilities for that operation.
More to the point: it seems that the zbar dynamic library that you have was built against the embedded version of Qt rather than the desktop Linux.
It is an unfortunate issue that both versions have the same dynamic library file names, so things like ldd cannot be much of help.
You will need to make sure to use exactly the same version of Qt installation that the library was built against. This means, if you use the desktop Linux installation for this, it will not work.

Is there any way to extract Boost Regex so I can package it with my project?

I'm working on a project written in C++ that uses the Boost Regex library to do some parsing. My problem is, I need to run the program on a remote machine that doesn't have the boost library installed. I also don't have admin access to this computer so I can't just install it myself.
Is there any way to separate out just the Boost Regex library so that I can put it in the same directory as my other code? I tried doing this already by downloading the boost library and separating out all of the unneeded headers and such. I managed to get it to a point where it calmost compiled but it failed at the linking stage.
Is there anything I can do to fix this or will I be forced to rewrite the parsing code?
You can use the Boost.BCP tool to extract a subset of Boost.
include the static library libboost_regex-gcc-1_35.a your list of object files to compile.
1_35 is an older version number on my linux box, you may have a newer library