Boost: std_interoperability.hpp error: ‘std_category’ does not name a type - c++

While I was trying to compile some C++ project on a fresh Ubuntu 20.04 installation, CMake complained that it couldn't find Boost at some point.
So I've installed it using
sudo apt-get install libboost-all-dev
Now when I'm trying to compile the project, the compilation of some transitive dependency fails with the error message
/usr/include/boost/system/detail/std_interoperability.hpp:88:22:
error: ‘std_category’ does not name a type
88 | static const std_category generic_instance( &cat, 0x1F4D3 );
|
The gcc version that I'm using is 9.3.0, the cmake --version is 3.16.3. The project itself should be more or less "fine", in the sense that it builds on at least one another machine; So, it must be something with the way I've installed the boost library locally.
I'd appreciate any hints about what could have gone wrong here and how to fix it.
I also see that it's not exactly an mcve (the non-reproducibility of the build, as well as the fact that something breaks in a transitive dependency are exactly my main problems right now), so I'd also greatly appreciate any hints on how to convert it into something reproducible, so that I can improve the question.

Related

Can't build with libusb. ‘_Atomic’ does not name a type

I am attempting to use libusb for a project and my C++ is rusty. I think I've resolved the dependencies for libtool and libdev on my ubuntu box, but now when I run, I get the following error.
/usr/lib/gcc/x86_64-linux-gnu/10/include/stdatomic.h:40:9: error: ‘_Atomic’ does not name a type
I found How to include C11 headers when compiling C++ with GCC?, but not sure how this helps me.
The problem appears to be in gcc somehow, but not sure how to go about fixing it. I'm using C++ 20 in CLion.
I'm running on Ubuntu and I had tried
sudo apt install libusb
to no avail. On a hunch I tried
sudo apt install libusb-dev
And it worked, so now I don't need to build it.
I need to remember to search for the library name if it isn't obvious.

Cmake doesn't find boost windows

I'm trying to run this code:
https://github.com/snukky/news-translit-nmt
I've installed boost and got the following messages:
The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
C:\Program Files\boost\boost_1_67_0
The following directory should be added to linker library paths:
C:\Program Files\boost\boost_1_67_0\stage\lib
By the comment of #kenba I've added the following environment variables:
Try 1
When I try to run the following cmd:
cmake .. -DCMAKE_BUILD_TYPE=Release
I get:
-- Could NOT find Boost (missing: timer iostreams filesystem system chrono) (found version "1.67.0")
CMake Error at CMakeLists.txt:290 (message):
Cannot find Boost libraries. Terminating.
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Configuring incomplete, errors occurred!
See also "D:/ThesisResources/previous_works/news-translit-nmt-master/tools/marian-dev/build/CMakeFiles/CMakeOutput.log".
Try 2
When I try to give a custom boost by this ref
https://marian-nmt.github.io/docs/#custom-boost:
I run the following cmd:
cmake .. -DBOOST_ROOT="C:\Program Files\boost\boost_1_67_0"
I get the same error.
I've also tried working with Linux WSL (But problems with CUDA installation overthere, their team is working on it), Linux VirtualBox (Not enough resources), and Ubuntu 17.10 I have installed (But Cuda requires Ubuntu 16.04 / 18.04)
What am I missing here? I'm trying any suggestion, stuck on it for a few days. Thanks!
Edit:
I reinstalled Ubuntu 16.04 and the problem was solved. Still don't know how to solve it in windows, but i'll continue use Ubuntu 16.04.
I had this problem earlier while trying to build the Windows version of Marian NMT (the same component that you're having trouble with). I can't remember the exact steps to solve the problem, but the root cause is that the Marian NMT build for Windows does not work with newer versions of Boost, since the source code uses some deprecated calling conventions for timer and chrono libraries (maybe some others as well).
The error message kind of confirms this: it can't find Boost, but on the other hand it says it finds your version 1.67.0. The solution is to use an older version of boost, I've confirmed that it works with 1.60.0.
If you just require a Marian NMT decoder that works in Windows, a project I work on has released a plugin for the Trados Studio translation tool, which contains a compiled marian-decoder executable for Windows: https://object.pouta.csc.fi/fiskmo/TradosStudio/FiskmoTranslationProvider.sdlplugin. You can access the executable by unzipping the sdlplugin file, the StartMtPipe.bat shows how to use the decoder.

'CXXABI_1.3.11' not found`

I can't get a cross compiled build running on my Raspberry Pi 1 B+. The error I keep getting is:
ImportError: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version 'CXXABI_1.3.11'
not found. I tried multiple compilers with different settings but I keep getting the same error. Also changing the LD_LIBRARY_PATH to the location of libstdc++ on my Pi didn't work. Today I got a sort of breakthrough finding out that the make process outputs "will change in GCC 7.1" after an argument. I'm not a hundred percent sure that this is what cause the error, but GCC 7.1 comes with version 1.3.11 of CXXABI, so I suspect it to be the cause. Is there anybody that knows how to stop this from happening? I'm building on a VM with Ubuntu 17.10. I'm building using sh autogen.sh; ./configure --host=arm-linux-gnueabihf; make -j8
Thanks
Edit: Found the solution myself, it was: export CXX=/path/to/toolchain/arm-linux-gnueabihf-g++
Your cross-GCC comes with a version of libstdc++.so which is not compatible with the one installed on your system. You can either run compiled program with modified LD_LIBRARY_PATH (or -Wl,-rpath), pointing to directory with cross-compiler's libstdc++.so, or downgrade your cross-compiler to match your distro.

How to statically compile a Fortran code

I compiled a copy of codes on one PC by Intel Fortran with the Lapack library. And then I ran it on another PC (the same OS without having Lapack installed). It failed.
This can be solved by installing Lapack on the other PC. The same problem occurs when using other libraries. This looks like a dynamical compiling issue (I am not sure). My question is how to get a real executable file that can be run on any machine?
I get a quite clear answer now. The direct answer to the question is (as #Vladimir F mentioned & #Ross) use option "-static" for both gfortran and ifort.
Some possibly occurred problems.
The libs for static compiling and dynamical compiling are different. For instance, we may have installed a lib called "LIBNAME" already. However, a similar lib called "LIBNAME-static" may be needed for the "-static" option version. According to the warning of something like:
/usr/bin/ld: cannot find -lLIBNAME
what we need to installed is libLIBNAME. We can install it (Fedora for instance) by
sudo dnf install libLIBNAME.
And
sudo dnf install libLIBNAME-static
may also needed. Just try them.

Boost "no such file or directory"

I'm trying to set up my Code::Blocks work environment on a new computer and I'm having some problems. It's been a long time since I first did this, and now when I open my major project Boost is causing me problems.
I'm fairly new to C++ still and fixing this type of problem is something I have limited experience with.
When I open my project and try to compile it, I get this error:
fatal error: boost/algorithm/string.hpp: No such file or directory|
At this part of one of my header files:
#include <boost/algorithm/string.hpp>
I placed the Boost v1.51.0 library at C:\boost since that is where I'd had it on my other computer. My project is set to search that directory for additional includes but it doesn't seem to be finding the files?
My project used an older version of Boost previously but I doubt that's an issue.
I'm not sure how difficult it is to debug this problem with this limited information so if there's anything else I can provide please let me know.
I'm using Code::Blocks, and have just set up minGW and Visual C++ 2010.
In Ubuntu use
sudo apt-get install libboost-dev
Ensure that you have installed boost-devel package
In Centos execute as root:
yum install boost-devel
then
root#centos6 /]# find / -name boost
/usr/include/boost
/usr/lib64/boost
[root#centos6 /]#