Error with G++ while compiling - g++

I got this error when trying to compile a cpp code
c:\mingw\bin>g++ hello.cpp
g++: fatal error: -fuse-linker-plugin, but liblto_plugin-0.dll not found
compilation terminated
what is going wrong?

you have (or the build-system has) specified the flag -fuse-linker-plugin which requires the dynamic library file liblto_plugin-0.dll to be in your library search path, but the linker cannot find it.
btw, you could have discovered that by carefully reading the error message you got.

Related

clang++ compiles an executable, but clang-check cannot find std header

I have a test cmake C++ app, that I can compile successfully with clang++-10 on Ubuntu 20.04 (with all that CMAKE_USER_MAKE_RULES_OVERRIDE machinery).
The layout of the cmake project is:
./test.cpp
./CMakeLists.txt
./build
I also create the build database json file with CMAKE_EXPORT_COMPILE_COMMANDS inside ./build (this json file is necessary for the clang-check operation AFAIU).
Now, launched from the build dir, the check invocation fails:
clang-check-10 --analyze ../test.cpp
<projDir>/test.cpp:1:10: fatal error: 'iostream' file not found
#include <iostream>
^~~~~~~~~~
1 error generated.
Error while processing <projDir>/test.cpp.
Any ideas how to fix this?
Edit: Have also tried specifying -p=$(pwd) to clang-check, but it still could not find the header.
clang-check is not a compiler. It's used for checking error in AST, and in this case it can't find the system header in your code. Add '--' in the end of line to ignore it.
clang-check-10 --analyze ../test.cpp
For more information: ClangCheck on LLVM

ld: library not found for -lopencv_imgproc error

While building my project, I am getting this error.
ld: library not found for -lopencv_imgproc
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What kind of library it is.? Can somebody explain.
Hello friend there are a lot of reason of linkers error. Some basic reason:
1. You can remove linker error goto Build Setting>Build Active Architecture Only set to No for Target and Project both.
2. Sometimes unnecessary .a files created Target>General. Delete irrelevant .a files.
3. Delete all library paths from Build Setting>Search Paths(o top) which you are not using like AFNetworking then pls delete -lAFNetworking path.
Try this if still you got the error show me the screenshot.
Thanks

GNU Fortran cannot find library file although its physically there

I am trying to link a precompiled BLAS dll to a Fortran example, the linker refuses.
I read:
gfortran can't find library that IS there unfortunately what helped there didn't work for me.
Specifically:
gfortran -o "Test2" ./main.o -l"C:/Users/abc/workspace/Test2/blasdyndbgx64.dll"
c:/Program Files (x86)/mingw32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lC:/Users/abc/workspace/Test2/blasdyndbgx64.dll
collect2.exe: error: ld returned 1 exit status
make: *** [Test2] Error 1
The previous link I provided recommended to use the -l"entire/path/filename.ext", yet it still throws at me that error whatever I try. Obviously the file is there,
dir to the path+filename finds the dll.
I guess that since compilers are not my strong side I am still missing something trivial.

Internal LLVM syntax errors when following Pass tutorial using CMake

I am attempting to follow the tutorial here for developing a "Hello, World" LLVM pass - I am using the guidelines linked by that tutorial here for doing so out of the LLVM source directory. However, when I attempt to follow this tutorial, CMake reports a number of errors internal to LLVM itself.
I have the following directory structure:
HelloWorld/
CMakeLists.txt
HelloWorld/
CMakeLists.txt
HelloWorld.cpp
My HelloWorld.cpp, and the two CMakeLists.txt are copy and pasted directly from the tutorials linked to above.
I run CMake HelloWorld and it successfully generates a CMake configuration. However, when I run make. I get numerous errors reported from within the LLVM codebase itself.
[ 50%] Building CXX object CMakeFiles/LLVMPassName.dir/Vectorize.cpp.o
In file included from /Volumes/andromeda/HelloWorld/HelloWorld.cpp:1:
In file included from /usr/local/Cellar/llvm/3.6.2/include/llvm/Pass.h:377:
In file included from /usr/local/Cellar/llvm/3.6.2/include/llvm/PassSupport.h:27:
In file included from /usr/local/Cellar/llvm/3.6.2/include/llvm/PassRegistry.h:20:
In file included from /usr/local/Cellar/llvm/3.6.2/include/llvm-c/Core.h:18:
In file included from /usr/local/Cellar/llvm/3.6.2/include/llvm-c/Support.h:17:
/usr/local/Cellar/llvm/3.6.2/include/llvm/Support/DataTypes.h:57:3: error: "Must #define
__STDC_LIMIT_MACROS before #including Support/DataTypes.h"
# error "Must #define __STDC_LIMIT_MACROS before #including Support/DataTypes.h"
^
/usr/local/Cellar/llvm/3.6.2/include/llvm/Support/DataTypes.h:61:3: error: "Must #define
__STDC_CONSTANT_MACROS before " "#including Support/DataTypes.h"
# error "Must #define __STDC_CONSTANT_MACROS before " \
The list goes on and on and all of them refer to errors in LLVM header files. This is a clean install of LLVM using Homebrew. To get linking to work, I had to set CPLUS_INCLUDE_PATH to the Homebrew include directory for LLVM.
My first thought was that CMake was attempting to use a different compiler (Clang vs. GCC or vice versa), but setting CMAKE_CXX_COMPILER to point to either my clang or g++ installation did not help.
Does anyone have any ideas for what might be the problem here?
After following the link provided by #oak in the comments, I was able to get rid of the first two Support/DataType errors. However, many of the errors still remain.
In file included from /usr/local/Cellar/llvm/3.6.2/include/llvm/Pass.h:377:
In file included from /usr/local/Cellar/llvm/3.6.2/include/llvm/PassSupport.h:27:
In file included from /usr/local/Cellar/llvm/3.6.2/include/llvm/PassRegistry.h:21:
/usr/local/Cellar/llvm/3.6.2/include/llvm/ADT/DenseMap.h:543:63: error: a space is required
between consecutive right angle brackets (use '> >')
typename BucketT = detail::DenseMapPair<KeyT, ValueT>>
^
/usr/local/Cellar/llvm/3.6.2/include/llvm/ADT/DenseMap.h:694:63: error: a space is required
between consecutive right angle brackets (use '> >')
typename BucketT = detail::DenseMapPair<KeyT, ValueT>>
So, after much research, it turns out that there is an inconsistency with how LLVM and CMake support out-of-source builds. The LLVM binaries are built with -fno-rtti, so CMake will complain about missing symbols unless it is also uses -fno-rtti when compiling the LLVM pass.
I fixed all of my troubles (including those solved by the temporary fix proposed by Oak) by adding SET(CMAKE_CXX_FLAGS "-Wall -fno-rtti") to my CMakeLists.txt file in the innermost directory.
This was inspired by this question also on StackOverflow.

yaml-cpp cmake error, boost files not found

I just downloaded and tried to build yaml-cpp v. 0.5.1, did everything as specified both in the web page and in the install.txt file, but got the following error: CMake Error at /usr/share/cmake/Modules/FindBoost.cmake:1138 (message):Unable to find the requested Boost libraries.
Anyone know how to fix it?