I have a Beaglebone (Rev: A6) and i want to develop C/C++ program in windows 7 using Eclipse and then transfer executable in the board. But i'm having trouble setting up compiler/debugger/toolchain needed for Beaglebone. Searching the internet only gives me how to setup environment in Linux like installing 'arm-linux-gnueabi', setting up the paths to 'includes' etc. I need a step by step instruction to set up the environment in Eclipse in a windows machine. Can anyone help ?
I have tried these steps:
1. I have GNUARM installed on windows.
2. On eclipse IDE i open a C++ project with Corss GCC.
3. From project -> properties -> C/C++ build -> settings i add 'arm-elf-' to every cross compiler command.
4. From the GNUARM installation directory i add few path to '.../include/' in the 'C++ General -> paths and symbos'.
my 'build all' shows something as below:
10:32:20 **** Build of configuration Debug for project h ****
make all
Building file: ../src/hello.cpp
Invoking: Cross G++ Compiler
arm-elf-g++ -I"C:\GNUARM\include\c++\4.1.1" -I"C:\GNUARM\include\c++\4.1.1\arm-elf" - I"C:\GNUARM\include\c++\4.1.1\backward" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP - MF"src/hello.d" -MT"src/hello.d" -o "src/hello.o" "../src/hello.cpp"
Finished building: ../src/hello.cpp
Building target: h
Invoking: Cross G++ Linker
arm-elf-g++ -L"C:\GNUARM\lib\gcc\arm-elf\4.1.1\include" -o "h" ./src/hello.o
Finished building target: h
10:32:23 Build Finished (took 2s.967ms)
It is simple 'Hello world' printing program. From the project explorer 'Debug->src->hello.o -[arm/le]' i copy it and when run on beaglebone with
chmod ugo+x hello.o
./hello.o
-sh: ./hello.o: cannot execute binary file
the above massage is printed. I don't know what i did wrong. Perhaps the ARM environment in eclipse is set up incorrectly.
Isn't hello.o the pre-linked object file (just the compiled content of hello.cpp)? It doesn't contain the startup code or any library functions. The linker adds those to produce the final output.
Don't you want to run the linker ouput file h (which should already be executable)?
i got my answer here. http://www.acmesystems.it/foxg20_eclipse_windows_c. CodeSourcery was the toolchain that i was looking for and this also explains how to setup the corss compiling environment.
Related
I am a student of TU Wien and quite new in programming. I would like to install a GitHub repository (https://github.com/SICKAG/sick_safetyscanners_base) which is basically for Linux, but I asked one the of the contributors and he said it should work on windows too.
According to the README the following steps have to be done to install this the repository:
git clone https://github.com/SICKAG/sick_safetyscanners_base.git
cd sick_safetyscanners_base
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=<path to install folder> ..
make -j8
make install
Here is a list of the softwares and tools I have already installed:
Visual Studio 2022 Community (because of MSVC)
Visual Studio Code
Scoop (to install cmake and make)
Boost 1.80.0
Git
And here are all the commands which are just working fine:
git clone https://github.com/SICKAG/sick_safetyscanners_base.git
cd sick_safetyscanners_base
mkdir build
cd build
cmake -DBoost_USE_STATIC_LIBS=ON .. (-DBoost_USE_STATIC_LIBS=ON, otherwise cmake does not find boost)
The problem is in the command line "make -j8". After this command, I recieve the following message: *** No targets specified and no makefile found. Stop. I have done some research and I found out that make will not work on windows (I use windows 10).
PS C:\Users\ader\sick_safetyscanners_base> mkdir build
Directory: C:\Users\ader\sick_safetyscanners_base
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 09/11/2022 13:04 build
PS C:\Users\ader\sick_safetyscanners_base> cd build
PS C:\Users\ader\sick_safetyscanners_base\build> cmake -DBoost_USE_STATIC_LIBS=ON ..
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19043.
-- The CXX compiler identification is MSVC 19.33.31630.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
-- Found Boost: C:/boost/boost_1_80_0 (found version "1.80.0") found components: system thread chrono atomic
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/ader/sick_safetyscanners_base/build
PS C:\Users\ader\sick_safetyscanners_base\build> make -j
make: *** No targets specified and no makefile found. Stop.
Since Make will not work, I tried the command "msbuild" in the Developer PowerShell for VS 2022, but the repository will still not be installed, because I have the following error message: command line error D8021: invalid numeric argument /Werror.
PS C:\Users\ader\sick_safetyscanners_base\build> msbuild sick_safetyscanners_base.vcxproj
MSBuild version 17.3.1+2badb37d1 for .NET Framework
Build started 09/11/2022 13:07:41.
Project "C:\Users\ader\sick_safetyscanners_base\build\sick_safetyscanners_base.vcxproj" on node 1 (default targets).
Project "C:\Users\ader\sick_safetyscanners_base\build\sick_safetyscanners_base.vcxproj" (1) is building "C:\Users\ader\
sick_safetyscanners_base\build\ZERO_CHECK.vcxproj" (2) on node 1 (default targets).
PrepareForBuild:
Creating directory "x64\Debug\ZERO_CHECK\".
Creating directory "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\".
InitializeBuildStatus:
Creating "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
Checking Build System
FinalizeBuildStatus:
Deleting file "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
Touching "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
Done Building Project "C:\Users\ader\sick_safetyscanners_base\build\ZERO_CHECK.vcxproj" (default targets).
PrepareForBuild:
Creating directory "sick_safetyscanners_base.dir\Debug\".
Creating directory "C:\Users\ader\sick_safetyscanners_base\build\Debug\".
Creating directory "sick_safetyscanners_base.dir\Debug\sick_saf.78B012DA.tlog\".
InitializeBuildStatus:
Creating "sick_safetyscanners_base.dir\Debug\sick_saf.78B012DA.tlog\unsuccessfulbuild" because "AlwaysCreate" was spe
cified.
CustomBuild:
Building Custom Rule C:/Users/ader/sick_safetyscanners_base/CMakeLists.txt
ClCompile:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX64\x64\CL.exe /c /IC:\User
s\ader\sick_safetyscanners_base\include /IC:\boost\boost_1_80_0 /Zi /nologo /Wall /WX- /diagnostics:column /Od /Ob0 /
D _WINDLL /D _MBCS /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D sick_safetyscanners_base_EXPORTS /Gm- /EHsc /R
TC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"sick_safetyscanners_base.dir\Debug\\" /Fd"sick_s
afetyscanners_base.dir\Debug\vc143.pdb" /external:W4 /Gd /TP /errorReport:queue -std=c++11 -Werror C:\Users\ader\sic
k_safetyscanners_base\src\SickSafetyscanners.cpp C:\Users\ader\sick_safetyscanners_base\src\cola2\ApplicationNameVari
ableCommand.cpp C:\Users\ader\sick_safetyscanners_base\src\cola2\ChangeCommSettingsCommand.cpp C:\Users\ader\sick_saf
etyscanners_base\src\cola2\CloseSession.cpp C:\Users\ader\sick_safetyscanners_base\src\cola2\Cola2Session.cpp C:\User
s\ader\sick_safetyscanners_base\src\cola2\Command.cpp C:\Users\ader\sick_safetyscanners_base\src\cola2\ConfigMetadata
VariableCommand.cpp C:\Users\ader\sick_safetyscanners_base\src\cola2\CreateSession.cpp C:\Users\ader\sick_safetyscann
ers_base\src\cola2\DeviceNameVariableCommand.cpp C:\Users\ader\sick_safetyscanners_base\src\cola2\DeviceStatusVariabl
eCommand.cpp C:\Users\ader\sick_safetyscanners_base\src\cola2\FieldGeometryVariableCommand.cpp C:\Users\ader\sick_saf
etyscanners_base\src\cola2\FieldHeaderVariableCommand.cpp C:\Users\ader\sick_safetyscanners_base\src\cola2\FieldSetsV
ariableCommand.cpp C:\Users\ader\sick_safetyscanners_base\src\cola2\FindMeCommand.cpp C:\Users\ader\sick_safetyscanne
rs_base\src\cola2\FirmwareVersionVariableCommand.cpp C:\Users\ader\sick_safetyscanners_base\src\cola2\LatestTelegramV
ariableCommand.cpp C:\Users\ader\sick_safetyscanners_base\src\cola2\MeasurementCurrentConfigVariableCommand.cpp C:\Us
ers\ader\sick_safetyscanners_base\src\cola2\MeasurementPersistentConfigVariableCommand.cpp C:\Users\ader\sick_safetys
canners_base\src\cola2\MethodCommand.cpp C:\Users\ader\sick_safetyscanners_base\src\cola2\MonitoringCaseTableHeaderVa
riableCommand.cpp C:\Users\ader\sick_safetyscanners_base\src\cola2\MonitoringCaseVariableCommand.cpp C:\Users\ader\si
ck_safetyscanners_base\src\cola2\OrderNumberVariableCommand.cpp C:\Users\ader\sick_safetyscanners_base\src\cola2\Proj
ectNameVariableCommand.cpp C:\Users\ader\sick_safetyscanners_base\src\cola2\RequiredUserActionVariableCommand.cpp C:\
Users\ader\sick_safetyscanners_base\src\cola2\SerialNumberVariableCommand.cpp C:\Users\ader\sick_safetyscanners_base\
src\cola2\StatusOverviewVariableCommand.cpp C:\Users\ader\sick_safetyscanners_base\src\cola2\TypeCodeVariableCommand.
cpp C:\Users\ader\sick_safetyscanners_base\src\cola2\UserNameVariableCommand.cpp C:\Users\ader\sick_safetyscanners_ba
se\src\cola2\VariableCommand.cpp C:\Users\ader\sick_safetyscanners_base\src\communication\TCPClient.cpp C:\Users\ader
\sick_safetyscanners_base\src\communication\UDPClient.cpp C:\Users\ader\sick_safetyscanners_base\src\data_processing\
ParseApplicationData.cpp C:\Users\ader\sick_safetyscanners_base\src\data_processing\ParseApplicationNameData.cpp C:\U
sers\ader\sick_safetyscanners_base\src\data_processing\ParseConfigMetadata.cpp C:\Users\ader\sick_safetyscanners_base
\src\data_processing\ParseData.cpp C:\Users\ader\sick_safetyscanners_base\src\data_processing\ParseDataHeader.cpp C:\
Users\ader\sick_safetyscanners_base\src\data_processing\ParseDatagramHeader.cpp C:\Users\ader\sick_safetyscanners_bas
e\src\data_processing\ParseDerivedValues.cpp C:\Users\ader\sick_safetyscanners_base\src\data_processing\ParseDeviceNa
me.cpp C:\Users\ader\sick_safetyscanners_base\src\data_processing\ParseDeviceStatus.cpp C:\Users\ader\sick_safetyscan
ners_base\src\data_processing\ParseFieldGeometryData.cpp C:\Users\ader\sick_safetyscanners_base\src\data_processing\P
arseFieldHeaderData.cpp C:\Users\ader\sick_safetyscanners_base\src\data_processing\ParseFieldSetsData.cpp C:\Users\ad
er\sick_safetyscanners_base\src\data_processing\ParseFirmwareVersion.cpp C:\Users\ader\sick_safetyscanners_base\src\d
ata_processing\ParseGeneralSystemState.cpp C:\Users\ader\sick_safetyscanners_base\src\data_processing\ParseIntrusionD
ata.cpp C:\Users\ader\sick_safetyscanners_base\src\data_processing\ParseMeasurementCurrentConfigData.cpp C:\Users\ade
r\sick_safetyscanners_base\src\data_processing\ParseMeasurementData.cpp C:\Users\ader\sick_safetyscanners_base\src\da
ta_processing\ParseMeasurementPersistentConfigData.cpp C:\Users\ader\sick_safetyscanners_base\src\data_processing\Par
seMonitoringCaseData.cpp C:\Users\ader\sick_safetyscanners_base\src\data_processing\ParseOrderNumber.cpp C:\Users\ade
r\sick_safetyscanners_base\src\data_processing\ParseProjectName.cpp C:\Users\ader\sick_safetyscanners_base\src\data_p
rocessing\ParseRequiredUserAction.cpp C:\Users\ader\sick_safetyscanners_base\src\data_processing\ParseSerialNumber.cp
p C:\Users\ader\sick_safetyscanners_base\src\data_processing\ParseStatusOverview.cpp C:\Users\ader\sick_safetyscanner
s_base\src\data_processing\ParseTCPPacket.cpp C:\Users\ader\sick_safetyscanners_base\src\data_processing\ParseTypeCod
eData.cpp C:\Users\ader\sick_safetyscanners_base\src\data_processing\ParseUserNameData.cpp C:\Users\ader\sick_safetys
canners_base\src\data_processing\TCPPacketMerger.cpp C:\Users\ader\sick_safetyscanners_base\src\data_processing\UDPPa
cketMerger.cpp C:\Users\ader\sick_safetyscanners_base\src\datastructure\ApplicationData.cpp C:\Users\ader\sick_safety
scanners_base\src\datastructure\ApplicationInputs.cpp C:\Users\ader\sick_safetyscanners_base\src\datastructure\Applic
ationName.cpp C:\Users\ader\sick_safetyscanners_base\src\datastructure\ApplicationOutputs.cpp C:\Users\ader\sick_safe
tyscanners_base\src\datastructure\CommSettings.cpp C:\Users\ader\sick_safetyscanners_base\src\datastructure\ConfigDat
a.cpp C:\Users\ader\sick_safetyscanners_base\src\datastructure\ConfigMetadata.cpp C:\Users\ader\sick_safetyscanners_b
ase\src\datastructure\Data.cpp C:\Users\ader\sick_safetyscanners_base\src\datastructure\DatagramHeader.cpp C:\Users\a
der\sick_safetyscanners_base\src\datastructure\DataHeader.cpp C:\Users\ader\sick_safetyscanners_base\src\datastructur
e\DerivedValues.cpp C:\Users\ader\sick_safetyscanners_base\src\datastructure\DeviceName.cpp C:\Users\ader\sick_safety
scanners_base\src\datastructure\DeviceStatus.cpp C:\Users\ader\sick_safetyscanners_base\src\datastructure\FieldData.c
pp C:\Users\ader\sick_safetyscanners_base\src\datastructure\FieldSets.cpp C:\Users\ader\sick_safetyscanners_base\src\
datastructure\FirmwareVersion.cpp C:\Users\ader\sick_safetyscanners_base\src\datastructure\GeneralSystemState.cpp C:\
Users\ader\sick_safetyscanners_base\src\datastructure\IntrusionData.cpp C:\Users\ader\sick_safetyscanners_base\src\da
tastructure\IntrusionDatum.cpp C:\Users\ader\sick_safetyscanners_base\src\datastructure\LatestTelegram.cpp C:\Users\a
der\sick_safetyscanners_base\src\datastructure\MeasurementData.cpp C:\Users\ader\sick_safetyscanners_base\src\datastr
ucture\MonitoringCaseData.cpp C:\Users\ader\sick_safetyscanners_base\src\datastructure\OrderNumber.cpp C:\Users\ader\
sick_safetyscanners_base\src\datastructure\PacketBuffer.cpp C:\Users\ader\sick_safetyscanners_base\src\datastructure\
ParsedPacketBuffer.cpp C:\Users\ader\sick_safetyscanners_base\src\datastructure\ProjectName.cpp C:\Users\ader\sick_sa
fetyscanners_base\src\datastructure\RequiredUserAction.cpp C:\Users\ader\sick_safetyscanners_base\src\datastructure\S
canPoint.cpp C:\Users\ader\sick_safetyscanners_base\src\datastructure\SerialNumber.cpp C:\Users\ader\sick_safetyscann
ers_base\src\datastructure\StatusOverview.cpp C:\Users\ader\sick_safetyscanners_base\src\datastructure\TypeCode.cpp C
:\Users\ader\sick_safetyscanners_base\src\datastructure\UserName.cpp
cl : befehlszeile error D8021: Ungültiges numerisches Argument /Werror. [C:\Users\ader\sick_safetyscanners_base\build\
sick_safetyscanners_base.vcxproj]
Done Building Project "C:\Users\ader\sick_safetyscanners_base\build\sick_safetyscanners_base.vcxproj" (default targets)
-- FAILED.
Build FAILED.
"C:\Users\ader\sick_safetyscanners_base\build\sick_safetyscanners_base.vcxproj" (default target) (1) ->
(ClCompile target) ->
cl : befehlszeile error D8021: Ungültiges numerisches Argument /Werror. [C:\Users\ader\sick_safetyscanners_base\buil
d\sick_safetyscanners_base.vcxproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.43
At this stage, I do not really know, what else should I try to get this lilbrary finally installed. My goal is to call it with #include in my C++ program.
Do you have a solution here on how to get rid of the error message and how to install this library? I think the only thing missing is this step. I would be very grateful for any suggestions.
Thank you in advance!
== UPDATE after the answer of MadScientist ==
Brief history: After installing boost, I got the following message...
The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
C:\boost\boost_1_80_0
The following directory should be added to linker library paths:
C:\boost\boost_1_80_0\stage\lib
... but I don't know exactly where to put these paths. I'm assuming that's exactly why Cmake doesn't find Boost. This problem was solved with -DBoost_USE_STATIC_LIBS=ON.
Now, if I use the command line cmake -DBoost_USE_STATIC_LIBS=ON -G "Unix Makefiles" .., CMake fails to find Boost again.
Here is what I can see on the terminal:
PS C:\Users\ader\sick_safetyscanners_base\build> cmake -G "Unix Makefiles" -DBoost_USE_STATIC_LIBS=ON ..
-- The CXX compiler identification is GNU 12.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/mingw64/bin/c++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Error at C:/Users/ader/scoop/apps/cmake/3.24.3/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Boost (missing: system thread chrono) (found version
"1.80.0")
Call Stack (most recent call first):
C:/Users/ader/scoop/apps/cmake/3.24.3/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
C:/Users/ader/scoop/apps/cmake/3.24.3/share/cmake-3.24/Modules/FindBoost.cmake:2376 (find_package_handle_standard_args)
CMakeLists.txt:11 (find_package)
-- Configuring incomplete, errors occurred!
See also "C:/Users/ader/sick_safetyscanners_base/build/CMakeFiles/CMakeOutput.log".
PS C:\Users\ader\sick_safetyscanners_base\build>
Make absolutely does work on Windows (if you install it). In fact, you can tell it works since you ran it and it worked!!
The problem is that cmake can create project files for lots of different build systems, and the default on Windows is Visual Studio, not make. So when you ran cmake you got a bunch of files that tell Visual Studio how to build your code, but no files that tell make how to build your code.
Delete the directory and unpack it again, then run cmake again and add the -G "Unix Makefiles" option to the command.
However, the option -Werror is an option to the GCC compiler. It won't work if you're trying to run the Visual Studio compiler (even if you use a makefile to build the code, it will still use the Visual Studio compiler to compile it).
My suspicion is that whomever told you that "it should work" to build this code on Windows, was overly optimistic and in fact it will require some porting effort to make this work.
Using -fsanitizer while compiling programs helps in finding location of memory leaks easily. But how to use this with vscode.
I only know that for compiling a program in vscode through terminal we need to type in g++ file_name.cpp -o executable_name.exe and for running .\program_name
Adding -fsanitizer to this command as an argument does not work for me. How to compile your program using fsanitizer on vscode?
Edit: I have been trying to use it as
g++ -std=c++17 -O2 -Wall -fsanitize=address
tempCodeRunnerFile.cpp -o tempcodeRunnerfile.exe
But this keeps giving me some kind of error:
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lasan: No such file or directory
collect2.exe: error: ld returned 1 exit status
This is unrelated to VSCode. The problem is your platform - MinGW traditionally has poor sanitizer support.
Your MSYS2 environment, MINGW64, only supports UBSAN (with stripped-down error reporting, compile with -fsanitize=undefined -fsanitize-undefined-trap-on-error).
There's also CLANG64 environment, which does have ASAN. Install its Clang (pacman -S mingw-w64-clang-x86_64-clang), and compile using clang++ located at C:\msys64\clang64\bin. If you're compiling from MSYS2 terminal, make sure you start the right one: launch it with clang64.exe, or the "MSYS2 Clang x64" shortcut (I don't remember the exact name).
I am trying to build a C project on Eclipse CDT with gcc.
First build worked fine, then I made a change to the source and second build appeared to try and link to a load of files I had not specified, then gets errors complaining it cannot find them. The gcc command it is running is:
gcc "-LC:\\SVN\\FloodAssessmentTool\\branches\\floatlite\\float\\python\\libs" -o float.exe "float\\python\\Lib\\site-packages\\markupsafe\\_speedups.o" "float\\.metadata\\.plugins\\org.eclipse.cdt.make.core\\specs.o" -lpython27
Whereas I am only expecting:
gcc "-LC:\\SVN\\FloodAssessmentTool\\branches\\floatlite\\float\\python\\libs" -o float.exe -lpython27
The only library I have specified to link against in the project settings is python27...
Whats happening?
*** Internal Builder is used for build ****
g++ -O0 -g3 -Wall -c -fmessage-length=0 -osrc\first.o ..\src\first.cpp
Internal Builder: Exec error:Launching failed
Build error occurred, build is stopped
Time consumed: 62 ms.
I am getting the above error in eclipse console when I tried to build my first "hello world" CPP program. Below are the steps I followed.
Installed Eclipse Europa.
Installed MinGW.
Open Eclipse goto window->preferences->c/C++->NEW CDT project wizard-> changed the Tool chain as "MinGW GCC".
When I opened the eclipse workspace manually there is no exe generated for the program.
My PATH variable in the project properties has "C:\MinGW" as value.
I searched much in net and still this "Launch Failed No Binaries" did not go off.
Please help...
"Launch failed No Binaries" means the program is not compiled.So this is the problem
related with MinGW GCC.Check you gave all the environmental variables necessary for the MINGW
correctly.
MoreOver I Suggest CodeBlocks IDE as a replacement.It is much Better than eclipse for c++
The link is CodeBlocks Download Link
I am trying to debug clang using eclipse. I have put a break point in clang/lib/lex/preprocessor.cpp at the preprocessor's constructor.
I have set a "test.c" file as an argument in the debug configurations.
Went to Run-> Debug As-> Local C/C++ Application.
It asked "Choose local application to debug". I chose "clang" and clicked OK.
It started building the code. build completed.
Stopped at main() in the debug window. (No source available for main())
After some step overs, it says "terminated: gdb Debugger (Exited. Exit code=255)"
I am not taken to the clang code (preprocessor code). can someone please tell me how to debug the clang code.? I want to see the code flow in clang. and how clang is constructing the AST.
Clang binary in fact contains two apps: driver and compiler frontend itself. The latter is executed via -cc1 cmdline option. So, just add -v to clang command line to see the actual sequence of tool invocation, grab the frontend cmdline (the one containing -cc1) and use this cmdline for debugging.
Had the same problem - you are missing the -g flag (enable debug info) when you are building your binaries.
When running the cmake run it with the CMAKE_BUILD_TYPE option:
cmake -G "Eclipse <CDT_Version> - Unix Makefiles" -D_ECLIPSE_VERSION=<eclipse_version> -DCMAKE_BUILD_TYPE=Debug <llvm_source_path>
example :
cmake -G "Eclipse CDT4 - Unix Makefiles" -D_ECLIPSE_VERSION=4.4 -DCMAKE_BUILD_TYPE=Debug ../llvm/
hope that this helps.