Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Building Cppinsights #56

Closed
preejackie opened this issue Jul 25, 2018 · 16 comments
Closed

Error in Building Cppinsights #56

preejackie opened this issue Jul 25, 2018 · 16 comments

Comments

@preejackie
Copy link

Hi @andreasfertig
I'm having trouble while installing cppinsights in my machine. I have summarised in this StackOverflow post about my problem. I don't know exactly what was the cause of this problem. I still think this was an issue with respect to my system, could you please help me to build cppinsights 👍

I will close this, once I get it properly installed.
Thanks

@andreasfertig
Copy link
Owner

Hello preejackie,

it looks like llvm-config does return something the build system does not expect. Can you confirm that the following file exists:

/home/praveen/llvm-novice/llvm/include/clang/AST/AST.h

It is also suspicious that llvm_config(LLVM_SYSTEM_LIBS)=>; is empty. Usually it looks like this:

llvm_config(LLVM_SYSTEM_LIBS)=>-lz -lrt -ldl -ltinfo -lpthread -lm;

Can you also post the output of

make VERBOSE=1

@preejackie
Copy link
Author

Hi @andreasfertig
AST.h doesn't exist in /home/praveen/llvm-novice/llvm/include/clang/AST/AST.h but instead it is in this directory /home/praveen/llvm-novice/llvm/tools/clang/include/clang/AST.

Building make files command:

cmake ../cppinsights -DCMAKE_CXX_COMPILER=/home/praveen/ninja/bin/clang++ -DCMAKE_PREFIX_PATH=/home/praveen/ninja/bin

-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is Clang 6.0.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: /home/praveen/ninja/bin/clang++
-- Check for working CXX compiler: /home/praveen/ninja/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found LLVM_CONFIG_PATH: /home/praveen/ninja/bin/llvm-config
-- llvm_config(LLVM_CXXFLAGS)=>-isystem/home/praveen/llvm-novice/llvm/include -isystem/home/praveen/ninja/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O3 -fno-exceptions -fno-rtti -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS;
-- llvm_config(LLVM_LDFLAGS)=>-L/home/praveen/ninja/lib;
-- llvm_config(LLVM_LIBS)=>-lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMMIRParser -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoDWARF -lLLVMCoverage -lLLVMTableGen -lLLVMDlltoolDriver -lLLVMOrcJIT -lLLVMTestingSupport -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMSparcAsmPrinter -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiAsmPrinter -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler -lLLVMBPFCodeGen -lLLVMBPFAsmParser -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMBPFAsmPrinter -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMARMUtils -lLLVMAMDGPUDisassembler -lLLVMAMDGPUCodeGen -lLLVMAMDGPUAsmParser -lLLVMAMDGPUDesc -lLLVMAMDGPUInfo -lLLVMAMDGPUAsmPrinter -lLLVMAMDGPUUtils -lLLVMAArch64Disassembler -lLLVMAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMAArch64Utils -lLLVMObjectYAML -lLLVMLibDriver -lLLVMOption -lgtest_main -lgtest -lLLVMWindowsManifest -lLLVMFuzzMutate -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMLineEditor -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMCodeGen -lLLVMTarget -lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMScalarOpts -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle;
-- llvm_config(LLVM_LIBDIR)=>/home/praveen/ninja/lib;
-- llvm_config(LLVM_INCLUDE_DIR)=>/home/praveen/llvm-novice/llvm/include;
-- llvm_config(LLVM_SYSTEM_LIBS)=>;
-- llvm_config(LLVM_PACKAGE_VERSION)=>6.0.0svn;
-- Git repo url: https://github.com/andreasfertig/cppinsights.git
-- Git commit hash: 5ce053d
-- Generating version.h
-- Found clang-tidy: /home/praveen/ninja/bin/clang-tidy
-- Stripping executable
-- Found Doxygen: /usr/local/bin/doxygen (found version "1.8.14") found components: doxygen dot
-- Using CXX: /home/praveen/ninja/bin/clang++
-- Configuring done
-- Generating don
-- Build files have been written to: /home/praveen/cppinsight/build_00

The output of make VERBOSE=1 is

/usr/local/bin/cmake -H/home/praveen/cppinsight/cppinsights -B/home/praveen/cppinsight/build_00 --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/bin/cmake -E cmake_progress_start /home/praveen/cppinsight/build_00/CMakeFiles /home/praveen/cppinsight/build_00/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/praveen/cppinsight/build_00'
make -f CMakeFiles/insights.dir/build.make CMakeFiles/insights.dir/depend
make[2]: Entering directory '/home/praveen/cppinsight/build_00'
cd /home/praveen/cppinsight/build_00 && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /home/praveen/cppinsight/cppinsights /home/praveen/cppinsight/cppinsights /home/praveen/cppinsight/build_00 /home/praveen/cppinsight/build_00 /home/praveen/cppinsight/build_00/CMakeFiles/insights.dir/DependInfo.cmake --color=
Dependee "/home/praveen/cppinsight/build_00/CMakeFiles/insights.dir/DependInfo.cmake" is newer than depender "/home/praveen/cppinsight/build_00/CMakeFiles/insights.dir/depend.internal".
Dependee "/home/praveen/cppinsight/build_00/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/praveen/cppinsight/build_00/CMakeFiles/insights.dir/depend.internal".
Scanning dependencies of target insights
make[2]: Leaving directory '/home/praveen/cppinsight/build_00'
make -f CMakeFiles/insights.dir/build.make CMakeFiles/insights.dir/build
make[2]: Entering directory '/home/praveen/cppinsight/build_00'
[ 7%] Building CXX object CMakeFiles/insights.dir/AutoStmtHandler.cpp.o
/home/praveen/ninja/bin/clang++ -I/home/praveen/cppinsight/build_00/generated -I/home/praveen/llvm-novice/llvm/include -I/home/praveen/cppinsight/cppinsights/. -isystem/home/praveen/llvm-novice/llvm/include -isystem/home/praveen/ninja/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O3 -fno-exceptions -fno-rtti -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=c++1z -Wextra -Wno-unknown-warning-option -Wold-style-cast -Werror -o CMakeFiles/insights.dir/AutoStmtHandler.cpp.o -c /home/praveen/cppinsight/cppinsights/AutoStmtHandler.cpp
In file included from /home/praveen/cppinsight/cppinsights/AutoStmtHandler.cpp:8:
/home/praveen/cppinsight/cppinsights/./AutoStmtHandler.h:11:10: fatal error: 'clang/AST/AST.h' file not found
#include "clang/AST/AST.h"
^~~~~~~~~~~~~~~~~
1 error generated.
CMakeFiles/insights.dir/build.make:62: recipe for target 'CMakeFiles/insights.dir/AutoStmtHandler.cpp.o' failed
make[2]: *** [CMakeFiles/insights.dir/AutoStmtHandler.cpp.o] Error 1
make[2]: Leaving directory '/home/praveen/cppinsight/build_00'
CMakeFiles/Makefile2:131: recipe for target 'CMakeFiles/insights.dir/all' failed
make[1]: *** [CMakeFiles/insights.dir/all] Error 2
make[1]: Leaving directory '/home/praveen/cppinsight/build_00'
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

@andreasfertig
Copy link
Owner

Hi,

/home/praveen/llvm-novice/llvm/tools/clang/include/clang/AST looks like the clang/llvm source path to me. At least in my installation this is the case. But not the clang/llvm install location. Did you do a ninja/make install? It looks to me that you clang/llvm setup is incomplete. That said /home/praveen/llvm-novice/llvm/include; also looks odd. Usually, if you have /home/praveen/ninja/bin/clang++ then the headers are in /home/praveen/ninja/bin/../include/ which is the case for the libs. Please ensure that you clang/llvm installation is correct.

@preejackie
Copy link
Author

Let me install llvm and clang properly once again, and see what happens
Hoping this time it will build.
Thanks

@preejackie
Copy link
Author

Hi @andreasfertig
I have built the recent version of LLVM.

The command I used to build cppinsights is -

cmake -GNinja ../cppinsights -DCMAKE_CXX_COMPILER=/home/praveen/live/install/bin/clang++ -DCMAKE_PREFIX_PATH=/home/praveen/live/install/bin

-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is Clang 7.0.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: /home/praveen/live/install/bin/clang++
-- Check for working CXX compiler: /home/praveen/live/install/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found LLVM_CONFIG_PATH: /home/praveen/live/install/bin/llvm-config
-- llvm_config(LLVM_CXXFLAGS)=>-isystem/home/praveen/live/llvm/include -isystem/home/praveen/live/install/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O3 -fno-exceptions -fno-rtti -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS;
-- llvm_config(LLVM_LDFLAGS)=>-L/home/praveen/live/install/lib;
-- llvm_config(LLVM_LIBS)=>-lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoDWARF -lLLVMFuzzMutate -lLLVMTableGen -lLLVMDlltoolDriver -lLLVMLineEditor -lLLVMOrcJIT -lLLVMCoverage -lLLVMMIRParser -lLLVMTestingSupport -lLLVMObjectYAML -lLLVMLibDriver -lLLVMOption -lgtest_main -lgtest -lLLVMWindowsManifest -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMCodeGen -lLLVMTarget -lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMScalarOpts -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMInstCombine -lLLVMBitWriter -lLLVMAggressiveInstCombine -lLLVMTransformUtils -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle;
-- llvm_config(LLVM_LIBDIR)=>/home/praveen/live/install/lib;
-- llvm_config(LLVM_INCLUDE_DIR)=>/home/praveen/live/llvm/include;
-- llvm_config(LLVM_SYSTEM_LIBS)=>-lz -lrt -ldl -ltinfo -lpthread -lm;
-- llvm_config(LLVM_PACKAGE_VERSION)=>7.0.0svn;
-- Git repo url: https://github.com/andreasfertig/cppinsights.git
-- Git commit hash: 5ce053d
-- Generating version.h
-- Found clang-tidy: /home/praveen/live/install/bin/clang-tidy
-- Stripping executable
-- Found Doxygen: /usr/local/bin/doxygen (found version "1.8.14") found components: doxygen dot
-- Using CXX: /home/praveen/live/install/bin/clang++
-- Configuring don
-- Generating done
-- Build files have been written to: /home/praveen/cppinsight/install

As you can see
llvm_config(LLVM_SYSTEM_LIBS)=>-lz -lrt -ldl -ltinfo -lpthread -lm; is now okay.

But when I'm running ninja, it's still finding the AST.h header file
The output of ninja:
1 error generated.
[6/14] Building CXX object CMakeFiles/insights.dir/CodeGenerator.cpp.o
FAILED: /home/praveen/live/install/bin/clang++ -Igenerated -I/home/praveen/live/llvm/include -I/home/praveen/cppinsight/cppinsights/. -isystem/home/praveen/live/llvm/include -isystem/home/praveen/live/install/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O3 -fno-exceptions -fno-rtti -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=c++1z -Wextra -Wno-unknown-warning-option -Wold-style-cast -Werror -MD -MT CMakeFiles/insights.dir/CodeGenerator.cpp.o -MF CMakeFiles/insights.dir/CodeGenerator.cpp.o.d -o CMakeFiles/insights.dir/CodeGenerator.cpp.o -c /home/praveen/cppinsight/cppinsights/CodeGenerator.cpp
In file included from /home/praveen/cppinsight/cppinsights/CodeGenerator.cpp:8:
/home/praveen/cppinsight/cppinsights/./CodeGenerator.h:11:10: fatal error: 'clang/AST/AST.h' file not found
#include "clang/AST/AST.h"
^~~~~~~~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.

@preejackie
Copy link
Author

The instructions I used to build LLVM is

cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_PARALLEL_LINK_JOBS=1
-DLLVM_ENABLE_LLD=1 -DLLVM_TARGETS_TO_BUILD="X86" ../llvm

@preejackie
Copy link
Author

Please check whether there is a mistake in CMakeLists.txt. FYI the AST.h is available in the directory
/home/praveen/live/llvm/tools/clang/include/clang/AST.
I placed my clang source files in the directory /home/praveen/live/llvm/tools.
I think that llvm-build is good.

@andreasfertig
Copy link
Owner

Hello preejackie,

unfortunately as far as I can tell, this build is better but still incomplete.

Your LLVM cmake command, if that is the entire command, then your still missing the ninja/make install. As you can read here: https://llvm.org/docs/GettingStarted.html

-DCMAKE_INSTALL_PREFIX=directory — Specify for directory the full pathname of where you want the LLVM tools and libraries to be installed (default /usr/local).

the default installation path would be /usr/local. While you pointing insights to your llvm-source directory.
Doing it correctly requires a ninja/make install and then your cmake-command roughly looks like this:

´´´
cmake -GNinja ../cppinsights -DCMAKE_CXX_COMPILER=/usr/local/bin/clang++ -DCMAKE_PREFIX_PATH=/usr/local/bin

@preejackie
Copy link
Author

Hi, Thank you.
I did make install, and now llvm is in directory /usr/local. When I run ninja to build cppinsights I'm now getting a different error.

Command: ninja

Error :
[6/14] Building CXX object CMakeFiles/insights.dir/CompilerGeneratedHandler.cpp.o
FAILED: /usr/local/bin/clang++ -Igenerated -I/home/praveen/cppinsight/cppinsights/home/praveen/live/llvm/tools/clang/include/clang -I/home/praveen/cppinsight/cppinsights/. -isystem/usr/local/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O3 -fno-exceptions -fno-rtti -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=c++1z -Wextra -Wno-unknown-warning-option -Wold-style-cast -Werror -MD -MT CMakeFiles/insights.dir/CompilerGeneratedHandler.cpp.o -MF CMakeFiles/insights.dir/CompilerGeneratedHandler.cpp.o.d -o CMakeFiles/insights.dir/CompilerGeneratedHandler.cpp.o -c /home/praveen/cppinsight/cppinsights/CompilerGeneratedHandler.cpp
In file included from /home/praveen/cppinsight/cppinsights/CompilerGeneratedHandler.cpp:8:
In file included from /home/praveen/cppinsight/cppinsights/./CompilerGeneratedHandler.h:11:
In file included from /usr/local/include/clang/AST/AST.h:18:
In file included from /usr/local/include/clang/AST/ASTContext.h:18:
In file included from /usr/local/include/clang/AST/ASTTypeTraits.h:20:
In file included from /usr/local/include/clang/AST/Decl.h:17:
In file included from /usr/local/include/clang/AST/APValue.h:17:
In file included from /usr/local/include/clang/Basic/LLVM.h:22:
In file included from /usr/local/include/llvm/Support/Casting.h:18:
/usr/local/include/llvm/Support/Compiler.h:524:30: error: no member named 'align_val_t' in namespace 'std'
std::align_val_t(Alignment)
~~~~~^
/usr/local/include/llvm/Support/Compiler.h:544:26: error: no member named 'align_val_t' in namespace 'std'
std::align_val_t(Alignment)
~~~~~^

@andreasfertig
Copy link
Owner

Hello,

this seems to be again an issue with your build system. As far as I can tell you require libstdc++-7-dev when using a recent clang. I just update travis to use this libstdc++ version and it works.

@preejackie
Copy link
Author

I also agree that my build system is incorrectly pointing to gcc 5.4.0 for libstdc++. I will try to update my gcc version. Thanks for replying

@preejackie
Copy link
Author

Finally, I somehow got managed to get build correct. It is working but when I include header files in .cpp files it gives fatal error as file not found. How I can pass the path to my header files as command line arguments?

@andreasfertig
Copy link
Owner

andreasfertig commented Aug 2, 2018

Hello preejackie,

if I understand your question correct, then it is the same way as for every other clang tool as well:

insights <YOUR_CPP_FILE> -- -I <PATH_TO_YOUR_INCLUDE_FILES>

@preejackie
Copy link
Author

Hi @andreasfertig
In short,
I have different versions of gcc like 5.4.0, 6, 7.3, 8.1.0 installed in my systems. But by default the system uses gcc-5.4.0 installation for clang++. In clang++ command line option , we can tell clang to find different versions of gcc installed using "--gcc-toolchain" option. I tried " insights file.cpp -- -std=c++17 -extra-arg=--gcc-toolchain=/path/to/gcc-8.1/toolchain", but clang shows warning - "unused argument during compilation.

When I tried to use insights, with this command : insights file.cpp -- -std=c++17 -stdlib=libc++ it stills throws an error : not found stddef.h, I assume this bug has been fixed in much earlier version of clang.

Clang++ --version :
clang version 7.0.0,

Is there any work around for this ? Or a complete re-build of cppinsights will help ?
clang - bug in ubuntu

As far, without including any headers in .cpp file, insights is working and I can able to see clang generated code.

@andreasfertig
Copy link
Owner

Hi preejackie,

well that's due to your system. And at this point it has nothing to do with insights any more.

However, here is what I know. --gcc-toolchain seems to be a build option while building clang, but not later. Additionally -stdlib=libc++ seems pointless to me, as insights does not link against any standard library. All it needs are the headers which are not communicated with this option.

Anyhow, you might have a look at the insights documentation https://github.com/andreasfertig/cppinsights#usage

The script can be used together with C++ Insights:
insights <YOUR_CPP_FILE> -- -std=c++17 ./scripts/getinclude.py

This script returns the include path for a compiler. By default it uses g++.

Hope this helps.

@andreasfertig
Copy link
Owner

Hello preejackie,

I believe in the meantime you managed building C++ Insights.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants