Author Topic: Code::Blocks converting Linker options mentioned in a txt file to whole command  (Read 666 times)

Offline srikanthsivasai

  • Multiple posting newcomer
  • *
  • Posts: 12
We are using Code::Blocks 16 version. We are using RVDS 3.1 as compiler and I see that the Linker options are provided in a .txt file for codeblocks in one of our Release.cbp files. Sample below.
<Linker>
               <Add option="--via=NetStack_Data\CB\release\release-NuNet\ObjPathFile.txt" />
               <Add option="--via=NetStack_Data\CB\release\$(PROJECT_NAME)\ObjPathFile.txt" />

The issue is code::blocks is converting the options in this .txt file into a whole command line while compiling using armar.exe and since the cmd prompt does not allow more than 8191 characters to be keyed in, the command is failing.

We have one server where Code::Blocks is running a older version 10. There this issue is not observed and the armar.exe is passing as the file is given as its argument by code::blocks.

Please let me know if anyone has come across this issue and if there has been any known fix. Do let me know if you need any more information regarding the same.

Thank you,
Sri

Offline stahta01

  • Lives here!
  • ****
  • Posts: 5943
    • My Best Post
I would suggest looking at each version of CB build log and trying to see what difference is the cause of your issue.

Edit: It is not clear from your post whether CB or your compiler driver is causing the problem.
compiler driver is often the c++ compiler.

Tim S.
« Last Edit: October 06, 2017, 04:04:46 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1519
if you have a question, always post the full rebuild log and the expected compiler command line. To get the full build log:
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_(general)#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

Offline srikanthsivasai

  • Multiple posting newcomer
  • *
  • Posts: 12
Thanks for the responses. The build log in the working server passes the linker step as below.

armar.exe -r -s ..\output\NetStack-release-NuNet.a --via NetStack_Data\CB\release\release-NuNet\ObjPathFile.txt

Whereas in the non-working server it fails with the below error.

Execution of 'armar.exe -r -s ..\output\NetStack-release-NuNet.a NetStack_Data\CB\release\release-NuNet\macbsp\firmware\common\source\StdLibLib.o ..............' failed.

Here the arguments passed in the objpathfile.txt are getting converted into the whole command.

Both the servers are Windows 2008 R2.
Working server has Code::Blocks 10.05 version.
Non-working server has Code::Blocks 16.01 version.


The full build log files are 3MB size each and hence cannot attach to the post. Please let me know if you need any more information regarding the same.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 5943
    • My Best Post
Looks like advanced compiler options difference in the working Code::Blocks.

The default option on CB 16.01 is
Code: [Select]
cmd /c if exist $static_output del $static_output
$lib_linker -r -s $static_output $link_objects

The working CB has had $link_objects removed and likely $link_options was added in its place.
No Idea, if a CB Developer or an end user did the change.

To see/change the advance compiler options in CB 16.01
Settings -> Compiler
Select the compiler you wish to change or check value
Select tab "Other Settings" to the far right
Click on "Advanced Settings" Button
On Tab, "Commands" Select "Link object files to static Library"
On CB 16.01 you should see
Code: [Select]
cmd /c if exist $static_output del $static_output
$lib_linker -r -s $static_output $link_objects
I would suggest trying to replace it with
Code: [Select]
cmd /c if exist $static_output del $static_output
$lib_linker -r -s $static_output $link_options

NOTE: The above will break the compiler for normal static linking!!!

Tim S.


C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline srikanthsivasai

  • Multiple posting newcomer
  • *
  • Posts: 12
Thanks for the update @stahta01

The working & non-working CB both has the below option only.
$lib_linker -r -s $static_output $link_objects
I have attached the screenshot of the same for reference.

But I went ahead and changed it according to your suggestion in CB16 & started compiling the log. The build now failed with the below error.

cmd /c if exist ..\output\NetStack-sim-NuNet.a del ..\output\NetStack-sim-NuNet.a
armar.exe -r -s ..\output\NetStack-sim-NuNet.a
Running target post-build steps
armar.exe -r -s ..\output\NetStack-sim-NuNet.a --via NetStack_Data\CB\sim\sim-NuNet\ObjPathFile.txt
Fatal error: L3904U: Could not open via file 'NetStack_Data\CB\sim\sim-NuNet\ObjPathFile.txt'.
Process terminated with status 1 (4 minute(s), 20 second(s))
1 error(s), 64 warning(s) (4 minute(s), 20 second(s))
../../../build/common/generic_arm.mk:733: recipe for target `generic_arm_compile_execute_compiler_with_post_link_checker' failed
cygmake[1]: *** [generic_arm_compile_execute_compiler_with_post_link_checker] Error 1
cygmake[1]: Leaving directory `/cygdrive/c/data/work/asivakum/p411codebase-sim02/2.0bk/plc_proc/nwmanagement/firmware/NetStack'
Makefile:49: recipe for target `compile' failed
cygmake: *** [compile] Error 2

Offline srikanthsivasai

  • Multiple posting newcomer
  • *
  • Posts: 12
Since the settings mentioned below are same across both the working / non-working server, I had to revert them back to the original as full build is not working with these options. Current settings are mentioned below.
$lib_linker -r -s $static_output $link_objects

Offline srikanthsivasai

  • Multiple posting newcomer
  • *
  • Posts: 12
This is the command that failed in the build again.

Execution of 'armar.exe -r -s ..\output\NetStack-sim-NuNet.a NetStack_Data\CB\sim\sim-NuNet\macbsp\firmware\common\source\StdLibLib.o NetStack_Data\CB\sim\sim-NuNet\nucleus\firmware\common\Nucleus\cipher_suite\ncs_cfg.o NetStack_Data\CB\sim\sim-NuNet\nucleus\firmware\common\Nucleus\cipher_suite\src\ncs_3des.o NetStack_Data\CB\sim\sim-NetStack_Data\CB\sim\sim-NuNet\nwmanagement\firmware\NetStack\source\net\hosts.o NetStack_Data\CB\sim\sim-NuNet\nwmanagement\firmware\NetStack\source\webserv\http_psr.o NetStack_Data\CB\sim\sim-NuNet\nwmanagement\firmware\NetStack\source\webserv\ws_tasks.o' in 'C:\data\work\asivakum\p411codebase\2.0bk\plc_proc\nwmanagement\firmware\NetStack\targets' failed.

Please let me know if you need any more information for further debug / help on the same.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 5943
    • My Best Post
Try building from the command line. The error looks like a bad compiler error to me.

Also, you need to post information about your compiler.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline srikanthsivasai

  • Multiple posting newcomer
  • *
  • Posts: 12
We are using ARM RVDS 3.1 compiler. Please let me know if you need any more information regarding this one.

From command line as well as from GUI, we are receiving the same error.

Attached is the screenshot for the compiler in CB.
« Last Edit: October 09, 2017, 01:37:23 pm by srikanthsivasai »

Offline srikanthsivasai

  • Multiple posting newcomer
  • *
  • Posts: 12
With the same compiler, below is the output of the same command passing in CB 10.

armar.exe -r -s ..\output\NetStack-sim-NuNet.a
      Code  (inc. data)  RO Data    RW Data    ZI Data      Debug   File Name
         0          0          0          0          0     699256   NetStack_Data\CB\sim\sim-NuNet\nucleus\firmware\common\Nucleus\webserv\src\upl_plgn.o
      Code  (inc. data)  RO Data    RW Data    ZI Data      Debug   File Name
       456         84       2565        320        180     702407   NetStack_Data\CB\sim\sim-NuNet\nucleus\firmware\common\Nucleus\webserv\src\web_ssl.o
      Code  (inc. data)  RO Data    RW Data    ZI Data      Debug   File Name
         0          0          0         40          0     160760   NetStack_Data\CB\sim\sim-NuNet\source\net\hosts.o
      Code  (inc. data)  RO Data    RW Data    ZI Data      Debug   File Name
       774        110          0          0          0     703917   NetStack_Data\CB\sim\sim-NuNet\nucleus\firmware\common\Nucleus\webserv\src\wsn.o
      Code  (inc. data)  RO Data    RW Data    ZI Data      Debug   File Name
       324         32          0          0          0     701914   NetStack_Data\CB\sim\sim-NuNet\nucleus\firmware\common\Nucleus\webserv\src\wsf.o
      Code  (inc. data)  RO Data    RW Data    ZI Data      Debug   File Name
      3048        652        435          0          0     716785   NetStack_Data\CB\sim\sim-NuNet\source\webserv\http_psr.o
      Code  (inc. data)  RO Data    RW Data    ZI Data      Debug   File Name
      2964        442          0          4        620     714948   NetStack_Data\CB\sim\sim-NuNet\source\webserv\ws_tasks.o
Output size is 182.94 MB
Running target post-build steps
armar.exe -r -s ..\output\NetStack-sim-NuNet.a --via NetStack_Data\CB\sim\sim-NuNet\ObjPathFile.txt

Offline stahta01

  • Lives here!
  • ****
  • Posts: 5943
    • My Best Post
We are using ARM RVDS 3.1 compiler. Please let me know if you need any more information regarding this one.

From command line as well as from GUI, we are receiving the same error.

Attached is the screenshot for the compiler in CB.

So, the problem is in the compiler or something else on the computer with the problem.

Tim S.
« Last Edit: October 09, 2017, 01:48:12 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline srikanthsivasai

  • Multiple posting newcomer
  • *
  • Posts: 12
Sorry I am very new to CB. Hence asking the same thing again, as I dont see any difference in the servers when comparing other settings.

But the CB output is different for this particular line itself, as in CB10 - its taking the file, but in CB16 - its processing the whole command.

Do you still think this could be a compiler issue?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 5943
    • My Best Post
You said the same error happened when you ran the command on the command line!
Unless you ran a bad command on the command line; I do not know what you did.
Do you?

This means the problem is not in code::blocks.

NOTE: Since, the last image you last posted is NOT from a standard Code::Blocks; you should post your question on the site you got your modified version of code::blocks from.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1519
i still don't see a full rebuild log, but ok

Quote
Execution of 'armar.exe -r -s ..\output\NetStack-sim-NuNet.a NetStack_Data\CB\sim\sim-NuNet\macbsp\firmware\common\source\StdLibLib.o NetStack_Data\CB\sim\sim-NuNet\nucleus\firmware\common\Nucleus\cipher_suite\ncs_cfg.o NetStack_Data\CB\sim\sim-NuNet\nucleus\firmware\common\Nucleus\cipher_suite\src\ncs_3des.o NetStack_Data\CB\sim\sim-NetStack_Data\CB\sim\sim-NuNet\nwmanagement\firmware\NetStack\source\net\hosts.o NetStack_Data\CB\sim\sim-NuNet\nwmanagement\firmware\NetStack\source\webserv\http_psr.o NetStack_Data\CB\sim\sim-NuNet\nwmanagement\firmware\NetStack\source\webserv\ws_tasks.o' in 'C:\data\work\asivakum\p411codebase\2.0bk\plc_proc\nwmanagement\firmware\NetStack\targets' failed.
this shows that the execution ot armar.exe fails... what if you execute this line in a cmd?
Code: [Select]
armar.exe -r -s ..\output\NetStack-sim-NuNet.a NetStack_Data\CB\sim\sim-NuNet\macbsp\firmware\common\source\StdLibLib.o NetStack_Data\CB\sim\sim-NuNet\nucleus\firmware\common\Nucleus\cipher_suite\ncs_cfg.o NetStack_Data\CB\sim\sim-NuNet\nucleus\firmware\common\Nucleus\cipher_suite\src\ncs_3des.o NetStack_Data\CB\sim\sim-NetStack_Data\CB\sim\sim-NuNet\nwmanagement\firmware\NetStack\source\net\hosts.o NetStack_Data\CB\sim\sim-NuNet\nwmanagement\firmware\NetStack\source\webserv\http_psr.o NetStack_Data\CB\sim\sim-NuNet\nwmanagement\firmware\NetStack\source\webserv\ws_tasks.o
Note: you need to have the compiler in your "PATH" variable. You can set your PATH variable on windows by typing
Code: [Select]
set PATH=%PATH%;PATH_TO_YOUR_COMPILERin the cmd

If the execution fails then you have a problem on your pc and this problem has nothing to do with codeblocks. If the execution does not fail you have a problem with codeblocks and you should post a build log... It would be a good idea to obfuscate the paths from the log...

Code: [Select]
But the CB output is different for this particular line itself, as in CB10 - its taking the file, but in CB16 - its processing the whole command. then please post both logs... We do not know what differs if you don't tell us...
CB 10 is probably 6 years old. There where a lot things that changed (but there should not be any change in the build chain unless it was a bug...)...