Are the g++4.3 and g++4.7 series ABI compatible? - g++

Also if I compile a piece of code with c++11 flag will it be compatible with another code compiled without c++11 flag? Where can I find the compatibility list?

Related

cmake . -B build - Compiling Neural Graphic Primitives

I trying compile NGP but after cmake . -B build I get this lines:
I've installed
Visual Studio 2019
CUDA Toolkit 11.6
CMake 3.22
Python 3.10
Optix 7.6
C:\NGP\instant-ngp>cmake . -B build
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19043.
-- The C compiler identification is MSVC 19.29.30147.0
-- The CXX compiler identification is MSVC 19.29.30147.0
-- The CUDA compiler identification is NVIDIA 11.6.124
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.6/bin/nvcc.exe - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- **Obtained CUDA architectures automatically from installed GPUs**
**CMake Error: The source directory "SOURCES/CMakeFiles/CMakeTmp" does not exist.**
Specify --help for usage, or press the help button on the CMake GUI.
CMake Error at dependencies/tiny-cuda-nn/CMakeLists.txt:107 (try_run):
Failed to configure test project build system.
Call Stack (most recent call first):
dependencies/tiny-cuda-nn/CMakeLists.txt:146 (TCNN_AUTODETECT_CUDA_ARCHITECTURES)
-- Configuring incomplete, errors occurred!
See also "C:/NGP/instant-ngp/build/CMakeFiles/CMakeOutput.log".
I am not coder I just want to try NERF. It ss possible download somewhere compiled NGP or it doesn't work that way?
EDIT: Noticed that OP is using the -S flag implicitly the issue seems to be elsewhere, hence the updated answer:
UPDATED ANSWER
Please bare in mind that with the limited information at my disposal. This is again only a wild guess, based on what I tried.
After re-examining the output of CMake I've noticed that the issue is within one of the dependencies i.e.
CMake Error at dependencies/tiny-cuda-nn/CMakeLists.txt:107 (try_run):
I was not able to completely replicate the problem, however I do believe I know how to debug these issues. My wild guess here is that either:
The individual dependencies were incorrectly pulled or
The CMake files were poorly generated due to some issue and you didn't clean them.
I would recommend trying the following:
Delete the build folder, and run cmake -S. -Bbuild again. And if that fails you can try the second option.
Remove the git repository (folder called instant-ngp) and clone it again using exactly this command:
git clone --recursive https://github.com/nvlabs/instant-ngp
Please note that the --recursive option is very important due to the fact that you need to pull the dependant repositories as well.
Now if all of that fails. You still have one more option and that is to go to the folder dependencies/tiny-cuda-nn/ and generate the CMake files yourself, however I do not recommend that due to the fact that if you have limited experience you may not know what exactly to do.
I've also checked the variables you wanted to set, and you may do that by running this in Powershell
$Env:CMAKE_CUDA_ARCHITECTURES=YOUR_VALUE_HERE (in my case it is 75 because I have a RTX2080). However bare in mind that
You shouldn't need it, because the architecture is discovered for you
You need to delete the build folder in order to clean up the cached CMake files
Hope it helps!

CMake automatically sets CXX upon first execution

I have a C++ project where I do not want to specify a "default" compiler, since it needs to be compiled with many different compilers in different contexts. (In unit testing and end-to-end testing, I do test it with a few different compilers.)
I tried to implement this in CMake by requiring that the user set the environment variable CXX before the initial CMake configuration (executing cmake). (I also have it drop a file to store the value to ensure that any subsequent invocation of make has the same value of CXX set, but that's irrelevant to the rest of the question.)
However, this doesn't actually work. Here is a minimal example and the execution output.
CMake configuration file:
project(test)
if(DEFINED ENV{CXX})
message("\$CXX = ${CXX}")
else()
message(SEND_ERROR "\$CXX must be defined by the user to compile this project.")
endif()
add_executable(test)
First execution of cmake:
-- The C compiler identification is GNU 4.3.4
-- The CXX compiler identification is GNU 4.3.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
$CXX =
-- Configuring done
CMake Error at CMakeLists.txt:9 (add_executable):
No SOURCES given to target: test
-- Build files have been written to: /hnfs/torcfs03n06a/vol/ret_users_sasquire/inactive/bugs/cmake
Second invocation of cmake in the same directory (with no cleanup):
CMake Error at CMakeLists.txt:6 (message):
$CXX must be defined to compile this project.
-- Configuring incomplete, errors occurred!
So the test whether CXX is defined is clearly working the second time, but not the first time.
Two questions:
How should I be implementing this?
I think that it is a somewhat reasonable behavior for cmake to set CXX internally if it wasn't set by the user, and I suspect that's what's happening in the first case. But why are the first and second runs different?
Some comments on item 1:
There are some obvious things, like introducing my own environment variable that is used to determine the compiler that cmake won't set on its own. But ideally I would just be able to get CMake to forego defining CXX, for example. Or perhaps there is functionality along the lines of GNU make's origin function, which can distinguish between variables set in the environment and variables set by default or in the makefile.
If the answer is basically "don't do that" (i.e. don't make the user define the compiler), then I am not going to consider it a constructive answer.
Comments on item 2:
To me, this looks like a bug in CMake, where it sets CXX while detecting the C++ compiler, and then it does not unset that variable afterwards. But is there a different way to look at this? Or is there documentation regarding this?
Just check CXX environment variable before project() call:
if(DEFINED ENV{CXX})
message("\$CXX = ${CXX}")
else()
message(SEND_ERROR "\$CXX must be defined by the user to compile this project.")
endif()
project(test)
CXX variable is used by CMake when detecting C++ compiler, and exactly project() call triggers that detection. So, why do you check the variable after the project() call if bad things have already happened?
As for setting the CXX environment variable internally by CMake, I would suggest to not care about that.
Anywhere, setting this variable for other purposes (not for compiler detection) would contradict with CMake usage of that variable.
For finding out which C++ compiler is used after the project() call, it is simpler to read CMAKE_CXX_COMPILER CMake variable.

Error during cmake build : CXX compiler must support Cilk

I am trying to install cilk++ according to this website and am at the steps in section "Cilk Plus Runtime". When I go to build, I get the following output:
$ cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_INSTALL_PREFIX=./install ..
CMake Error at CMakeLists.txt:132 (message):
CXX compiler must support Cilk.
-- Configuring incomplete, errors occurred!
See also "/Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/cilkrts-0.1.2/build/CMakeFiles/CMakeOutput.log".
See also "/Users/anthonymcknight/Documents/cubing/bfs/lab4/cilk/cilkrts-0.1.2/build/CMakeFiles/CMakeError.log".
I thought clang and clang++ (which I checked with --version are indeed installed) would be sufficient. Do I need to update clang and clang++? There are no troubleshooting steps on the instructions website, so I'm not sure what I need to do to finally get cilk++ up and running on my laptop.
Thanks in advance,
Anthony
Expanding on my comment:
When you configure this Cilk Plus Runtime with CMake, CMake first verifies the compiler by attempting to compile a simple test program (see here). If the compilation fails, CMake prints the error you see:
CMake Error at CMakeLists.txt:132 (message):
CXX compiler must support Cilk.
On the Intel Cilk Plus runtime Github page (cilkrts), it has some compiler requirements listed for those trying to build this library:
You need the CMake tool and a C/C++ compiler that supports the Cilk language extensions. The requirements for each operating systems are:
Common: CMake 3.4.3 or later Make tools such as make
Linux: Tapir/LLVM compiler, or GCC* 4.9.2 or later (depracated), or Cilk-enabled branch of Clang*/LLVM* (http://cilkplus.github.io), or Intel(R) C++ Compiler v12.1 or later (depracated)
OS X: Tapir/LLVM compiler, or Cilk-enabled branch of Clang*/LLVM* (http://cilkplus.github.io), or Intel C++ Compiler v12.1 or later (depracated)
Since you are using Clang as your compiler, be sure it is a Cilk-enabled branch of Clang, as specified in the requirements. Or, you can try to use the Tapir/LLVM compiler.

Cmake for Intel OpenVino project complains about feature_defs and missing OpenVino extensions directory

I tried to compile this OpenVino sample project: https://github.com/intel-iot-devkit/intruder-detector
When I do the cmake, I don't know why it is asking for feature_def, I don't understand what that means.
I'm also troubled at how /opt/intel//computer_vision_sdk_2018.4.420/deployment_tools/inference_engine/samples/extension is said to be a non-existent directory. It indeed does not exist. i tried reinstalling OpenVino several times, and that did not solve the problem. Please help, any advice will be appreciated. Thanks in advance.
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:11 (include):
include could not find load file:
feature_defs
CMake Error at CMakeLists.txt:13 (add_subdirectory):
add_subdirectory given source
"/opt/intel//computer_vision_sdk_2018.4.420/deployment_tools/inference_engine/samples/extension"
which is not an existing directory.
-- Configuring incomplete, errors occurred!
See also "/home/user/intruder- detector/application/build/CMakeFiles/CMakeOutput.log".
This seems like quite a complete problem as the repo isn't maintained properly. I do not have a full, direct solution to your problem but hopefully this will guide you in the right direction (if you don't want to wait for the owners to do the changes).
This fairly recent git issue asked for fixes for essentially the same exact problem you have, except on another project in that repo. That being said, it seems it has been fixed there.
Sadly, the fix commits are a massive reupload of the whole project with new, updated files; the CMakeLists included. The new CMakeLists.txt (found here) of that project is your best bet at fixing the issue yourself, by comparing it to yours and figuring out the changes here and there. However, since the whole thing was modified, it's possible that the dependencies and such aren't too similar but hopefully not missing.
That being said, I think that's a good starting point and you should also post an issue on that git so that the owner can do something about it asap.

cmake: oglplus can't find context initialization library (glfw)

I try to build oglplus (C++ wrapper for OpenGL) with cmake (on OS X 10.9 with Xcode 5 / Clang 5.0.0).
But to do so, there is a context initialization library neccesary (i.e. GLUT, GLFW, GLFW3, GL3W, QT4, SDL, wxWidgets). However I tried to compile and install GLFW and GLFW3 multiple times already: But the cmake file from oglplus still won't use them.
The cmake output says:
cmake -G Xcode
-- The C compiler identification is Clang 5.0.0
-- The CXX compiler identification is Clang 5.0.0
-- Check for working C compiler using: Xcode
-- Check for working C compiler using: Xcode -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Xcode
-- Check for working CXX compiler using: Xcode -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
-- Found GLEW: /usr/local/include /Library/Frameworks/GLEW.framework
-- Could NOT find GL3W
-- Could NOT compile or link with GLFW
-- Could NOT compile or link with GLFW3
-- Could NOT find GLUT (missing: GLUT_INCLUDE_DIR)
-- GLUT header file not found
-- Could NOT find wxWidgets (missing: wxWidgets_FOUND)
-- Could NOT find Qt4 (missing: QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR QT_QTCORE_INCLUDE_DIR QT_QTCORE_LIBRARY QT_QTGUI_INCLUDE_DIR QT_QTGUI_LIBRARY QT_QTOPENGL_INCLUDE_DIR QT_QTOPENGL_LIBRARY QT_UIC_EXECUTABLE)
-- Could NOT find SDL
-- GLM header files not found
-- Found PNG: /usr/local/include /usr/local/lib/libpng.dylib
-- Detecting support for c++11 feature 'SCOPED_ENUMS': TRUE
-- Detecting support for c++11 feature 'VARIADIC_MACROS': TRUE
-- Detecting support for c++11 feature 'VARIADIC_TEMPLATES': TRUE
-- Detecting support for c++11 feature 'UNIFIED_INITIALIZATION_SYNTAX': TRUE
-- Detecting support for c++11 feature 'INITIALIZER_LISTS': TRUE
-- Detecting support for c++11 feature 'DEFAULTED_FUNCTIONS': TRUE
-- Detecting support for c++11 feature 'DELETED_FUNCTIONS': TRUE
-- Detecting support for c++11 feature 'EXPLICIT_CONVERSION_OPERATORS': TRUE
-- Detecting support for c++11 feature 'FUNCTION_TEMPLATE_DEFAULT_ARGS': TRUE
-- Detecting support for c++11 feature 'UNICODE_LITERALS': TRUE
-- Detecting support for c++11 feature 'USER_DEFINED_LITERALS': TRUE
-- Detecting support for c++11 feature 'CONSTEXPR': TRUE
-- Detecting support for c++11 feature 'NOEXCEPT': TRUE
-- Detecting support for c++11 feature 'LAMBDAS': TRUE
-- Detecting support for c++11 feature 'NULLPTR': TRUE
-- Detecting support for c++11 feature 'CHRONO': TRUE
-- Detecting support for c++11 feature 'THREADS': TRUE
-- Could NOT find Boost
CMake Error at CMakeLists.txt:122 (message):
No OpenGL context initialization library found!
So it seems it can find GLFW/GLFW3, because for some reason it says Could NOT compile or link with * instead of Could NOT find *. I'm not really familiar with cmake scripts, so I don't know how to examine the reason here.
Any ideas what the problem could be here?
I've had a similar problem, it seems that GLFW is found and a test program is compiled to check that it works. Simply put, with the MSVC toolchain the test fails.
The simplest fix is to remove/rename the test program (oglplus/config/ext_lib/test_glfw.cpp and/or test_glfw3.cpp)
Have you read the documentation on GitHub? Direct extract:
CMake-based build configuration
The CMake script defines and uses several variables to modify the
build configuration, which can be specified on the command-line when
invoking cmake (with the -D option. see cmake manual for details):
HEADER_SEARCH_PATHS: (semicolon-separated) list of paths to additional directories to search when looking for 3rd-party headers like GL/glew.h, GL3/gl3.h, GL/glcorearb.h, etc.
LIBRARY_SEARCH_PATHS: (semicolon-separated) list of paths to additional directories to search when looking for 3rd-party binary libraries like GL, GLEW, GL3W, GLFW, SDL, GLUT, png, etc.
Furthermore, OGLplus is, in fact, a header-only library, so you could simply skip building examples/demos and tests so that no linkage with 3rd party libraries is required at all. You could even copy the headers to the location you want and just use it without running CMake (last time I used it, this approach worked fine, it might have changed, so check it at your own risk).
I know this is an old question, but I also had problems with it.
Just make sure that you specify the include- and lib-folders for glfw, glfw3 or whatever you want to use in cmake.