Bug 369025

Summary: Relative paths in error output not recognized correctly when building in subdirectories
Product: [Applications] kdevelop Reporter: Frank Fischer <frank-fischer>
Component: BuildSystem: Custom BuildSystemsAssignee: kdevelop-bugs-null
Status: REPORTED ---    
Severity: normal CC: frank-fischer
Priority: NOR    
Version: 5.8.220403   
Target Milestone: ---   
Platform: Debian stable   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: example project
version 2 of example project

Description Frank Fischer 2016-09-19 06:26:37 UTC
Created attachment 101173 [details]
example project

I have a project with a custom qmake based build (I can't use qmake build but need the custom build system for some reason not important here). The build is done in a separate build directory and has a subproject (see attached example).

The project layout is as follows:

/home/fifr/test/test_project/test_project.pro
/home/fifr/test/test_project/sub_project/sub_project.pro
/home/fifr/test/test_project/sub_project/hello.c

The build directory is

/home/fifr/test/test_project_build

The only custom build option is "compile" with calling "qmake ../test_project".

If there is some bug in hello.c, the compile output looks as follows

/home/fifr/test/test_project_build> make 
cd sub_project/ && ( test -e Makefile || /usr/lib/qt/bin/qmake /home/fifr/test/test_project/sub_project/sub_project.pro -o Makefile ) && /usr/bin/make -f Makefile 
make[1]: Verzeichnis „/home/fifr/test/test_project_build/sub_project“ wird betreten
gcc -c -pipe -O2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I../../test_project/sub_project -I. -isystem /usr/include/qt -isystem /usr/include/qt/QtGui -isystem /usr/include/qt/QtCore -I. -I/usr/lib/qt/mkspecs/linux-g++ -o hello.o ../../test_project/sub_project/hello.c
../../test_project/sub_project/hello.c: In Funktion »main«:
../../test_project/sub_project/hello.c:4:5: Fehler: »i« nicht deklariert (erste Benutzung in dieser Funktion)
     i=0;
     ^
../../test_project/sub_project/hello.c:4:5: Anmerkung: jeder nicht deklarierte Bezeichner wird nur einmal für jede Funktion, in der er vorkommt, gemeldet

The problemt is that clicking on the error message "../../test_project/sub_project/hello.c:4:5: ..." opens the file "/home/fifr/test_project/sub_project/hello.c" (note the missing "test/" in the path). It seems as if the path to file "hello.c" is taken relative to the build directory "test_project_build" instead to its subdirectory "test_project_build/sub_project", which would be correct (but this is only a rough guess).
Comment 1 Frank Fischer 2016-09-19 06:30:48 UTC
Sorry, made a mistake in the description of the the build configuration. It consists of the following settings

build path: /home/fifr/test/test_project_build
configuration: qmake ../test_project/test_project.pro
compile: make
Comment 2 Justin Zobel 2022-10-24 00:46:41 UTC
Thank you for reporting this bug 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 3 Frank Fischer 2022-10-24 07:41:06 UTC
I've just tested the issue again, and I can still reproduce it.

Note that you have to create the build-directory first (in my case /home/fifr/test/test_project_build) as Kdevelop does not create it for you if it does not exist.

I've attached an archive of the example project I used. Note that it may contain some absolute path in the kdev4 project files, maybe they should be adapted to your local machine in order to reproduce the problem.
Comment 4 Frank Fischer 2022-10-24 07:41:41 UTC
Created attachment 153161 [details]
version 2 of example project