I am trying to set up debugging with VScode for nvc++ on Ubuntu 20.04
I am using CMake to build my program that is using openmp and have cmake-tools as vscode extensions.
My c++ project is well setup with CMake, GCC, and openMP. After installing HPC SDK and setting up the nvcc and nvc++ compilers, when I switch the tools, the build is failing, complaining about openMP. By default VScode is using nvcc -fopenmp -v -fPIE -std=gnu99 -o outputfile.o. When I compile my code in the terminal window with just a simple addition of -Xcompiler flag such as nvcc -Xcompiler -fopenmp -v -fPIE -std=gnu99 -o outputfile.o it is working. But how do I set that up in vscode?
Below is the exact error I am getting:
/opt/nvidia/hpc_sdk/Linux_x86_64/22.5/compilers/bin/nvcc -fopenmp -v -fPIE -std=gnu99 -o CMakeFiles/cmTC_568be.dir/OpenMPTryFlag.c.o -c /directory/program/build/CMakeFiles/FindOpenMP/OpenMPTryFlag.c
nvcc fatal : Value ‘gnu99’ is not defined for option ‘std’
Any help is would be appreciated!
Related
I am trying to use gdb to debug an hdf5 C++ application that I have written. The h5 package that I am using was installed using conda. The command that I am using is:
h5c++ hdf5.cpp
This generates an executable which I then run with gdb as follows:
gdb a.out
gdb launches alright. But when I add breakpoint using:
b 10
or any line number, it gives a message: No line 10 in file "init.c"
When I press run, it runs the whole program at once (which I don't want) and exits. The h5c++ -show command gives the following output:
x86_64-conda_cos6-linux-gnu-c++ -I/i3c/hpcl/sms821/software/tensorflow/anaconda2/include -D_FORTIFY_SOURCE=2 -O2 -g -fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -I/i3c/hpcl/sms821/software/tensorflow/anaconda2/include -fdebug-prefix-map==/usr/local/src/conda/- -fdebug-prefix-map==/usr/local/src/conda-prefix -L/i3c/hpcl/sms821/software/tensorflow/anaconda2/lib /i3c/hpcl/sms821/software/tensorflow/anaconda2/lib/libhdf5_hl_cpp.a /i3c/hpcl/sms821/software/tensorflow/anaconda2/lib/libhdf5_cpp.a /i3c/hpcl/sms821/software/tensorflow/anaconda2/lib/libhdf5_hl.a /i3c/hpcl/sms821/software/tensorflow/anaconda2/lib/libhdf5.a -L/i3c/hpcl/sms821/software/tensorflow/anaconda2/lib -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-rpath,/i3c/hpcl/sms821/software/tensorflow/anaconda2/lib -L/i3c/hpcl/sms821/software/tensorflow/anaconda2/lib -g -lrt -lpthread -lz -ldl -lm -Wl,-rpath -Wl,/i3c/hpcl/sms821/software/tensorflow/anaconda2/lib
I think this has to do with the compiler the compiler that it is using. I tried replacing x86_64-conda_cos6-linux-gnu-c++ with my native g++ compiler in the h5c++ script but that gives linker error.
Please suggest how should make my h5 application work with gdb. Should I install hdf5 from source since I don't have sudo access? I am working on a Linux machine.
I simply installed hdf5 from the source files. While configuring the installation I turned the --enable-build-mode and --enable-symbol switches. Hdf5 has a dependency on szip which I also installed from source code. My exact configuration was as follows:
./configure --prefix=<hdf5 install directory> --enable-cxx --enable-build-mode=debug --enable-symbols=yes --enable-profiling=yes --with-szlib=<szip install directory>
The above solution worked and I was able to compile my h5 application using h5c++ hdf5.cpp and also use gdb to debug it.
Ubuntu 17.10
GCC Version: 5.4
Bazel Version: 0.9.0
TensorFlow: r1.5
CUDA 8.0 / cuDNN 6 / GTX 1080 Ti
How do I make Bazel use gcc for building TensorFlow from source?
While building, its running into compiler errors like:
error: 'errno' was not declared in this scope
while (nanosleep(&ts, &ts) != 0 && errno == EINTR) {}
Setting --verbose_failures flag, it shows that its not using /usr/bin/gcc-5 or /usr/bin/gcc for compiling
external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc -U_FORTIFY_SOURCE '-D_FORTIFY_SOURCE=1' -fstack-protector -fPIE -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 -DNDEBUG -ffunction-sections -fdata-sections -g0 -DGEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK '-march=native' '-std=c++11' -g0 -MD -MF
Searching online, I found that the path to gcc and CC, CXX variables must be set in tools/cpp/CROSSTOOL. But where exactly is tools/cpp/CROSSTOOL?? How do I force bazel to use gcc-5?
I know next to nothing about cuda and tensorflow, but tensorflow doesn't use the same C++ toolchain that bazel autoconfigures when compiling with cuda, so the CC env variable trick won't work. The file crosstool_wrapper_driver_is_not_gcc is just a shell wrapper that could in theory still call your gcc (or it will be cuda). I'd run bazel with --subcommands to see the complete invocation of the failing action, then reproduce without bazel, and then go from there.
Environment info
Operating System:
macOS 10.12.2 (16C68)
Compiler:
gcc-6
Steps to reproduce
I've installed gcc-6 and modified config.mk as required into
export CC = gcc-6
export CXX = g++-6
But keep having this error:
g++-6 -c -std=c++0x -Wall -Wno-unknown-pragmas -Iinclude -Idmlc-core/include -Irabit/include -O3 -funroll-loops -msse2 -fPIC -fopenmp src/learner.cc -o build/learner.o
FATAL:/opt/local/bin/../libexec/as/x86_64/as: I don't understand 'm' flag!
What have you tried?
Reinstall XCode
Reinstall gcc
Run make clean_all && make -4j
But still went wrong. Any idea?
I had this issue when using macports-installed gnu assembler. You could try forcing the use of as that comes with Xcode, or simply temporarily removing /opt/local/bin from your path.
I solved by uninstalling MacPorts:
sudo port -f uninstall installed
So I recently installed Theano on a python 2.7 environment within Anaconda 3, on windows 10. Theano passed theano.test() at least. I am using example code from deeplearning.net. I heva sucessfully run the first block on the linked page which defines a Theano function. When I go to install pylab via pip install pylab so that I can use skimage for the second block, my installer quits while doing some gcc call for the portion that looks like it says "shared geometry". One thing I noticed right away is the -DEBUG flag is misspelled -DDEBUG. Could this be the cause? Does it have something to do with msvcr90.dll and if so what is that and what do I need to do about it? Also, probably important, I'm using a slightly (6 months or so) outdated TDM-GCC which is 4.9 something. Here is the line in question, as well as a few others that might be interesting:
`copying skimage\_shared\tests\__init__.py -> build\lib.win-amd64-2.7\skimage\_shared\tests
running build_ext
Looking for python27.dll
Cannot build msvcr library: "msvcr90d.dll" not found
customize Mingw32CCompiler
customize Mingw32CCompiler using build_ext
building 'skimage._shared.geometry' extension
compiling C sources
C compiler: gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
creating build\temp.win-amd64-2.7\Release\skimage
creating build\temp.win-amd64-2.7\Release\skimage\_shared
compile options: '-DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x0900 -I"C:\Users\USE DIS\Anaconda3\envs\py27\lib\site-packages\numpy\core\include" -I"C:\Users\USE DIS\Anaconda3\envs\py27\include" -I"C:\Users\USE DIS\Anaconda3\envs\py27\PC" -c'
gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x0900 -I"C:\Users\USE DIS\Anaconda3\envs\py27\lib\site-packages\numpy\core\include" -I"C:\Users\USE DIS\Anaconda3\envs\py27\include" -I"C:\Users\USE DIS\Anaconda3\envs\py27\PC" -c skimage\_shared\geometry.c -o build\temp.win-amd64-2.7\Release\skimage\_shared\geometry.o
Found executable C:\Users\USE DIS\Anaconda3\envs\py27\Scripts\gcc.bat
'C:\Users\USE' is not recognized as an internal or external command,
operable program or batch file.
error: Command "gcc -g -DDEBUG -DMS_WIN64 -O0 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x0900 -I"C:\Users\USE DIS\Anaconda3\envs\py27\lib\site-packages\numpy\core\include" -I"C:\Users\USE DIS\Anaconda3\envs\py27\include" -I"C:\Users\USE DIS\Anaconda3\envs\py27\PC" -c skimage\_shared\geometry.c -o build\temp.win-amd64-2.7\Release\skimage\_shared\geometry.o" failed with exit status 1
----------------------------------------
So this is a followup question to Visual Studio 2015 Update 1, clang error
The error message I'm getting is
clang.exe : error : cannot specify -o when generating multiple output files
Basically, Hans Passant's workaround of disabling precompiled headers did not work for me. I'm still seeing the error. Anybody have any more ideas to work around this?
My VS-generated command line is: -fpic -std=c++1y -fstack-protector -x c++ "Debug\" -Wall -fno-strict-aliasing -ffunction-sections -I "c:\SDKs\VST3 SDK" -I "c:\SDKs\vstsdk2.4" -I "....\JuceLibraryCode" -I "......\JUCE\modules" -g2 -gdwarf-2 -O0 -x c++-header -D "_CRT_SECURE_NO_WARNINGS" -D "WIN32" -D "_WINDOWS" -D "DEBUG" -D "_DEBUG" -D "JUCER_VS2010_78A501D=1" -D "JUCE_APP_VERSION=1.0.0" -D "JUCE_APP_VERSION_HEX=0x10000" -D "_WINDLL" -frtti -fomit-frame-pointer -fdata-sections -fno-ms-compatibility -std=c11 -fexceptions -o "Debug\" -fms-extensions -fno-short-enums
I'm trying to build a C++ JUCE audio plugin in Windows with Clang because I ended up using a good amount of C++14 features when developing it initially on Mac and did not realize that other compilers were a bit more behind in C++ standard support. JUCE applications provide cross platform support by a VS/XCode project file or Makefile generated from the Introjucer/Projucer application. If I set up a new project with the VS2015 Cross-Platform C++ DLL with Clang 3.7 project template, everything compiles fine. But using the JUCE-generated VS project file and then switching the project preferences to use the Clang 3.7 project toolset is where I run into this error.