Hi,
what are the switches (does exists some?) to prevent from the following problem:
This is the Project File, which builds a static lib from 3rd party sources:
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
...
<Target title="Release">
<Option output="librtw.a" prefix_auto="0" extension_auto="0" />
<Option object_output="build\release" />
<Option type="2" />
...
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_dbl.c"><Option compilerVar="CC" /></Unit>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_sgl.c"><Option compilerVar="CC" /></Unit>
...
On build I get the error request dialog:
Can't build object output directory \\build\debug\C\Programme\MATLAB\R2007a\rtw\c\libsrc
The object should go into build\debug directory and not on the full path of the source!
Thanks,
Olaf
Thanks for your answer. The build dir (where the project file is) is on d:\
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Test" />
<Option pch_mode="2" />
<Option compiler="tricoregcc" />
<Build>
<Target title="default">
<Option output="default\libTest.a" prefix_auto="0" extension_auto="0" />
<Option working_dir="" />
<Option object_output="default" />
<Option type="2" />
<Option compiler="tricoregcc" />
<Option createDefFile="1" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="-g" />
<Add option="-O2" />
<Add option="-fno-common" />
<Add option="-fno-short-enums" />
<Add option="-mcpu=tc1766" />
<Add directory="src" />
<Add directory="h" />
</Compiler>
<Linker>
<Add option="-Wl,--Map,map.txt" />
<Add option="-mcpu=tc1766" />
</Linker>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_dbl.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_sgl.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrc_dbl.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrc_sgl.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrr_dbl.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrr_sgl.c">
<Option compilerVar="CC" />
</Unit>
<Extensions>
<code_completion />
</Extensions>
</Project>
</CodeBlocks_project_file>
The begin of the build log:
-------------- Build: default in Test ---------------
tricore-gcc.exe -Wall -g -O2 -fno-common -fno-short-enums -mcpu=tc1766 -g -Isrc -Ih -c C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_sgl.c -o default\C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_sgl.o
Thanks,
Olaf
Hi,
I'm using svn release 4417 for now. Anyway, it builds the object files inside the source directory!
tricore-gcc.exe -mcpu=tc1775 -O2 -fno-short-enums -fno-common -W -Wall -g -DERT=1 -DMODEL=phycore1775_led -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DADD_MDL_NAME_TO_GLOBALS=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DMULTITASKING=0 -DTID01EQ=0 -g -IC:\Programme\MATLAB\R2007a\rtw\c\libsrc -I"D:\Dokumente und Einstellungen\olpetzol\Eigene Dateien\MATLAB\phycore1775_led_tricore_ert" -c C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_sgl.c -o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_sgl.o
...
I would expect the object files located relative to the project directory as the project settings suggest:
(http://img154.imageshack.us/img154/6466/rtwprjph3.th.png) (http://img154.imageshack.us/my.php?image=rtwprjph3.png)
And now: the real confusing:
...
tricore-ar.exe -rs build\debug\librtw.a C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_sgl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrc_dbl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrc_sgl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrr_dbl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrr_sgl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_dbl.o
-------------- Build: Release in rtwlib ---------------
tricore-ar.exe -rs librtw.a C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_sgl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrc_dbl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrc_sgl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrr_dbl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrr_sgl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_dbl.o
The lib builds/created twice, in the project's defined directory and the current (c::b project's) directory!
Did I missunderstand something or is the bug not fixed correctly (maybe another one)?
Thanks
Olaf
If the source directory is in different drive, the relative path creation fails and it uses the full path instead. This is currently hard-coded. But this can be changed.
I would expect make/Makefile behavior!
It's not created twice. Rather both of your targets are being built at the same time.
The effect is, that two libs are created! One in build\debug\librtw.a and one inside the work directory; since the depency is related to librtw.a in the work/project directory, the release target (from virtual "all") will not be created!
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="rtwlib" />
<Option pch_mode="2" />
<Option compiler="tricoregcc" />
<Build>
<Target title="Debug">
<Option output="build\release\librtw.a" prefix_auto="0" extension_auto="0" />
<Option object_output="build\debug" />
<Option type="2" />
<Option compiler="tricoregcc" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="build\release\librtw.a" prefix_auto="0" extension_auto="0" />
<Option object_output="build\release" />
<Option type="2" />
<Option compiler="tricoregcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="Debug;Release;" />
</VirtualTargets>
<Compiler>
<Add option="-mcpu=tc1775" />
<Add option="-O2" />
<Add option="-fno-short-enums" />
<Add option="-fno-common" />
<Add option="-W" />
<Add option="-Wall" />
<Add option="-g" />
<Add option="-DERT=1" />
<Add option="-DMODEL=phycore1775_led" />
<Add option="-DNUMST=1" />
<Add option="-DNCSTATES=0" />
<Add option="-DHAVESTDIO" />
<Add option="-DADD_MDL_NAME_TO_GLOBALS=1" />
<Add option="-DONESTEPFCN=1" />
<Add option="-DTERMFCN=1" />
<Add option="-DMAT_FILE=0" />
<Add option="-DMULTI_INSTANCE_CODE=0" />
<Add option="-DINTEGER_CODE=0" />
<Add option="-DMT=0" />
<Add option="-DMULTITASKING=0" />
<Add option="-DTID01EQ=0" />
<Add directory="." />
<Add directory="C:\Programme\MATLAB\R2007a\rtw\c\libsrc" />
</Compiler>
<Linker>
<Add option="-Wl,--Map,map.txt" />
<Add option="-mcpu=tc1775" />
</Linker>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_dbl.c"><Option compilerVar="CC" /></Unit>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_sgl.c"><Option compilerVar="CC" /></Unit>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrc_dbl.c"><Option compilerVar="CC" /></Unit>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrc_sgl.c"><Option compilerVar="CC" /></Unit>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrr_dbl.c"><Option compilerVar="CC" /></Unit>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrr_sgl.c"><Option compilerVar="CC" /></Unit>
<Extensions>
<code_completion />
</Extensions>
</Project>
</CodeBlocks_project_file>
Regards,
Olaf
The workspace:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_workspace_file>
<Workspace title="phycore1775_led">
<Project filename="phycore1775_led.cbp" active="1" >
<Depends filename="RTW_lib.cbp" />
</Project>
<Project filename="RTW_lib.cbp" />
</Workspace>
</CodeBlocks_workspace_file>
The project self:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="phycore1775_led" />
<Option pch_mode="2" />
<Option compiler="tricoregcc" />
<Option virtualFolders="RTW\;" />
<Build>
<Target title="Debug">
<Option output="binaries\phycore1775_led_dbg.elf" prefix_auto="0" extension_auto="0" />
<Option object_output="build\debug" />
<Option type="1" />
<Option compiler="tricoregcc" />
<Compiler>
<Add option="-g" />
</Compiler>
<Linker>
<Add library="build\debug\librtw.a" />
</Linker>
</Target>
<Target title="Release">
<Option output="binaries\phycore1775_led.elf" prefix_auto="0" extension_auto="0" />
<Option object_output="build\release" />
<Option type="1" />
<Option compiler="tricoregcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
<Add library="build\release\librtw.a" />
</Linker>
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="Debug;Release;" />
</VirtualTargets>
<Compiler>
<Add option="-mcpu=tc1775" />
<Add option="-O2" />
<Add option="-fno-short-enums" />
<Add option="-fno-common" />
<Add option="-W" />
<Add option="-Wall" />
<Add option="-g" />
<!--
XXX This is the same as defines.txt; move to function
-->
<Add option="-DERT=1" />
<Add option="-DMODEL=phycore1775_led" />
<Add option="-DNUMST=1" />
<Add option="-DNCSTATES=0" />
<Add option="-DHAVESTDIO" />
<Add option="-DADD_MDL_NAME_TO_GLOBALS=1" />
<Add option="-DONESTEPFCN=1" />
<Add option="-DTERMFCN=1" />
<Add option="-DMAT_FILE=0" />
<Add option="-DMULTI_INSTANCE_CODE=0" />
<Add option="-DINTEGER_CODE=0" />
<Add option="-DMT=0" />
<Add option="-DMULTITASKING=0" />
<Add option="-DTID01EQ=0" />
<!--
where to find RTW's libsrc and rtwtypes.h
-->
<Add directory="." />
</Compiler>
<Linker>
<Add option="-Wl,--Map,map.txt" />
<Add option="-mcpu=tc1775" />
</Linker>
<!-- Sources -->
<Unit filename="tcboard_main.c"><Option compilerVar="CC" /></Unit>
<Unit filename="rtwtypes.h" />
<Unit filename="phycore1775_led.c"><Option compilerVar="CC" /></Unit>
<Unit filename="phycore1775_led.h" />
<Unit filename="phycore1775_led_data.c"><Option compilerVar="CC" /></Unit>
<Unit filename="phycore1775_led_private.h" />
<Unit filename="phycore1775_led_types.h" />
<!-- RTW specific stuff -->
<Unit filename="phycore1775_led.rtw"><Option virtualFolder="RTW\" /></Unit>
<Unit filename="rtw_proj.tmw"><Option virtualFolder="RTW\" /></Unit>
<!-- Other generated stuff -->
<Unit filename="defines.txt" />
<Extensions>
<code_completion />
<envvars />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
The library depend on:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="rtwlib" />
<Option pch_mode="2" />
<Option compiler="tricoregcc" />
<Build>
<Target title="Debug">
<Option output="build\debug\librtw.a" prefix_auto="0" extension_auto="0" />
<Option object_output="build\debug" />
<Option type="2" />
<Option compiler="tricoregcc" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="build\release\librtw.a" prefix_auto="0" extension_auto="0" />
<Option object_output="build\release" />
<Option type="2" />
<Option compiler="tricoregcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<VirtualTargets>
<Add alias="All" targets="Debug;Release;" />
</VirtualTargets>
<Compiler>
<Add option="-mcpu=tc1775" />
<Add option="-O2" />
<Add option="-fno-short-enums" />
<Add option="-fno-common" />
<Add option="-W" />
<Add option="-Wall" />
<Add option="-g" />
<!--
XXX This is the same as defines.txt; move to function
-->
<Add option="-DERT=1" />
<Add option="-DMODEL=phycore1775_led" />
<Add option="-DNUMST=1" />
<Add option="-DNCSTATES=0" />
<Add option="-DHAVESTDIO" />
<Add option="-DADD_MDL_NAME_TO_GLOBALS=1" />
<Add option="-DONESTEPFCN=1" />
<Add option="-DTERMFCN=1" />
<Add option="-DMAT_FILE=0" />
<Add option="-DMULTI_INSTANCE_CODE=0" />
<Add option="-DINTEGER_CODE=0" />
<Add option="-DMT=0" />
<Add option="-DMULTITASKING=0" />
<Add option="-DTID01EQ=0" />
<!--
where to find RTW's libsrc and rtwtypes.h
-->
<Add directory="." />
<Add directory="C:\Programme\MATLAB\R2007a\rtw\c\libsrc" />
</Compiler>
<Linker>
<Add option="-Wl,--Map,map.txt" />
<Add option="-mcpu=tc1775" />
</Linker>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_dbl.c"><Option compilerVar="CC" /></Unit>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_sgl.c"><Option compilerVar="CC" /></Unit>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrc_dbl.c"><Option compilerVar="CC" /></Unit>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrc_sgl.c"><Option compilerVar="CC" /></Unit>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrr_dbl.c"><Option compilerVar="CC" /></Unit>
<Unit filename="C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrr_sgl.c"><Option compilerVar="CC" /></Unit>
<Extensions>
<code_completion />
<envvars />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>
The build log:
-------------- Build: Debug in rtwlib ---------------
tricore-gcc.exe -mcpu=tc1775 -O2 -fno-short-enums -fno-common -W -Wall -g -DERT=1 -DMODEL=phycore1775_led -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DADD_MDL_NAME_TO_GLOBALS=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DMULTITASKING=0 -DTID01EQ=0 -g -I. -IC:\Programme\MATLAB\R2007a\rtw\c\libsrc -c C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_sgl.c -o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_sgl.o
...
tricore-ar.exe -rs build\debug\librtw.a C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_sgl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrc_dbl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrc_sgl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrr_dbl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrr_sgl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_dbl.o
-------------- Build: Release in rtwlib ---------------
tricore-ar.exe -rs build\release\librtw.a C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_sgl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrc_dbl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrc_sgl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrr_dbl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubrr_sgl.o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_dbl.o
-------------- Build: Debug in phycore1775_led ---------------
tricore-gcc.exe -mcpu=tc1775 -O2 -fno-short-enums -fno-common -W -Wall -g -DERT=1 -DMODEL=phycore1775_led -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DADD_MDL_NAME_TO_GLOBALS=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DMULTITASKING=0 -DTID01EQ=0 -g -I. -c phycore1775_led_data.c -o build\debug\phycore1775_led_data.o
tricore-gcc.exe -mcpu=tc1775 -O2 -fno-short-enums -fno-common -W -Wall -g -DERT=1 -DMODEL=phycore1775_led -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DADD_MDL_NAME_TO_GLOBALS=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DMULTITASKING=0 -DTID01EQ=0 -g -I. -c tcboard_main.c -o build\debug\tcboard_main.o
tricore-gcc.exe -mcpu=tc1775 -O2 -fno-short-enums -fno-common -W -Wall -g -DERT=1 -DMODEL=phycore1775_led -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DADD_MDL_NAME_TO_GLOBALS=1 -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DMULTITASKING=0 -DTID01EQ=0 -g -I. -c phycore1775_led.c -o build\debug\phycore1775_led.o
tricore-g++.exe -o binaries\phycore1775_led_dbg.elf build\debug\phycore1775_led_data.o build\debug\tcboard_main.o build\debug\phycore1775_led.o -Wl,--Map,map.txt -mcpu=tc1775 build\debug\librtw.a
...
a) The objects of the library are not inside the given object_output object dir (target depend)
b) Therefore the release target lib is build on debug build objects
The Problem is related to gcc's outfile option -o C:\Programme\MATLAB\R2007a\rtw\c\libsrc\rt_backsubcc_sgl.o which should be
-o build\debug\rt_backsubcc_sgl.o as the binary output object directory tag promised - regardless if the source point to windows drive c:\ and/or the build is on drive d:\
The same with the ar command line.
It seems the path from source files are not stripped correctly for object files.
Regards,
Olaf