Bug 401654 - clang_parseTranslationUnit2 fails when using -march=armv7e-m
Summary: clang_parseTranslationUnit2 fails when using -march=armv7e-m
Status: RESOLVED WORKSFORME
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (Clang-based) (other bugs)
Version First Reported In: 5.3.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-02 14:47 UTC by H L Prasad
Modified: 2023-02-18 03:47 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H L Prasad 2018-12-02 14:47:33 UTC
SUMMARY
Kdevelop 5.3.0 (and possibly 5.2.4) fails to build duchain information for a C/C++ CMake project when option -march=armv7e-m is added in add_definition() in CMakeLists.txt. I have installed necessary ARM gcc compiler, so that the code compiles fine.

STEPS TO REPRODUCE
1. Create a CMake C/C++ project for ARM compilation with necessary overrides for CMAKE_C_COMPILER, etc.
2. Add definition -march=armv7e-m using add_definition()
3. Open/Import this project in KDevelop v5.3.0

OBSERVED RESULT
All code text appears without syntax highlighting, and mostly black text, like in plain text editor (not even like in vim or Kate). Navigation, Outline, etc. do not work.

EXPECTED RESULT
Syntax highlighting should work fine along with other normal features of the CLang support.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon 5.14.4
(available in About System)
KDE Plasma Version: 5.14.4
KDE Frameworks Version: 5.52.0
Qt Version: 5.11.2

ADDITIONAL INFORMATION
The workaround for this is use -mcpu=cortex-m4 or a specific CPU of interest and not to set -march=armv7e-m

When KDevelop is run with KDEV_CLANG_DISPLAY_ARGS=1 environment variable, the command line of clang is shown. When that command is run on terminal, you see an error that 

error: unknown target CPU 'armv7e-m'

thrown by clang.

This is perhaps the root cause of the issue. The workaround suggested above actually works because clang ignores -mcpu=... argument, but gcc does not.

It would be good if someone can look into a way to make march setting work because for all practical reasons C or C++ syntax is not dependent on the architecture.
Comment 1 Justin Zobel 2023-01-19 00:19:02 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 2 Bug Janitor Service 2023-02-03 05:01:44 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 3 Bug Janitor Service 2023-02-18 03:47:41 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!