User forums > Using Code::Blocks
Possible flaw in C::B build system
mirai:
--- Quote from: stahta01 on May 15, 2012, 04:26:43 am ---2 out of 3 work for me; without modification using CB SVN 7965 self-built.
--- End quote ---
Yes, this is how it should be, 2 of 3, exactly.
--- Quote from: stahta01 on May 15, 2012, 04:26:43 am ---You might want to post more info; note, naming the projects with different title might also help.
--- End quote ---
These are not actually my projects, the first of them is supplied by the bug reporter, and two consequent are my modifications to the first one. I've made them very quickly and didn't try to make them look any nicer than they were in the first place.
--- Quote from: stahta01 on May 15, 2012, 04:26:43 am ---Got the last one to build after I renamed the file containing the function level2 to level2.cpp
--- End quote ---
And this is exactly what you shouldn't do. The project has to compile without making any changes to it. The GNU toolchain itself is perfectly happy with having two different "level1.o" objects to link when they are in different locations, but of course it won't work if both of them have same name AND location. The C::B build system fails here when it gives the same location of object files to sources with different initial locations. In a big project with 3rd party libraries [located outside project tree] this situation may happen purely accidentally and the project won't be built while it should.
--- Quote from: stahta01 on May 15, 2012, 04:26:43 am ---
--- Code: ----------------- Build: Debug in level2 (compiler: GNU GCC Compiler Dwarf 2)---------------
g++.exe -Wmissing-include-dirs -Wextra -Wall -g -c C:\Users\stahta01\Downloads\relpath_tests\relpath_tests\dummy-2\level1\level2\main.cpp -o obj\Debug\main.o
g++.exe -Wmissing-include-dirs -Wextra -Wall -g -c C:\Users\stahta01\Downloads\relpath_tests\relpath_tests\dummy-2\root.cpp -o obj\Debug\root.o
g++.exe -Wmissing-include-dirs -Wextra -Wall -g -c C:\Users\stahta01\Downloads\relpath_tests\relpath_tests\dummy-2\level1\level1.cpp -o obj\Debug\level1.o
g++.exe -Wmissing-include-dirs -Wextra -Wall -g -c C:\Users\stahta01\Downloads\relpath_tests\relpath_tests\dummy-2\level1\level2\level2.cpp -o obj\Debug\level2.o
g++.exe -o bin\Debug\level2.exe obj\Debug\main.o obj\Debug\root.o obj\Debug\level1.o obj\Debug\level2.o
Output size is 36.34 KB
--- End code ---
Tim S.
--- End quote ---
This log clearly displays the flaw, just don't do that renaming.
Jenna:
I can confirm this issue.
A possible fix might be to always use the common toplevel path as relative path below the object output directory.
It seems we do not do that, but use the path relative to the project-file and just cut off all ".."'s.
Jenna:
Can you (and other devs) please test the attached patch ?
I did not test what happens, if files in a project are on different drives in windows.
MortenMacFly:
--- Quote from: jens on May 15, 2012, 02:50:11 pm ---Can you (and other devs) please test the attached patch ?
--- End quote ---
Tested. All three projects build now. "Go ahead" from my side...
Jenna:
--- Quote from: MortenMacFly on May 17, 2012, 06:37:51 am ---
--- Quote from: jens on May 15, 2012, 02:50:11 pm ---Can you (and other devs) please test the attached patch ?
--- End quote ---
Tested. All three projects build now. "Go ahead" from my side...
--- End quote ---
There have been no objections from others, so I committed it in svn r7986.
Navigation
[0] Message Index
[*] Previous page
Go to full version