Command line build and static link

delphi package - automated exception handling
Post Reply
vigiers
Posts: 2
Joined: Mon May 23, 2016 12:01 pm

Command line build and static link

Post by vigiers »

Hi,

I am working on a C++ solution built using MSBuild in command line, but I didn't manage to make madexcept work.

I made some experiments with an empty project and here are the results I found:

Environment:
  • IDE : RAD Studio 10 Seattle
  • Mad Except version: 4.0.14
  • Project: C++ VCL Form Application
Configs:
  • Debug - Link with Dynamic RTL Enabled - Link with Runtime Packages Enabled - Build in IDE => Mad Except Activated
  • Debug - Link with Dynamic RTL Enabled - Link with Runtime Packages Enabled - Build in Command Line => Mad Except Activated
  • Debug - Link with Dynamic RTL Disabled - Link with Runtime Packages Disabled - Build in IDE => Mad Except Activated
  • Debug - Link with Dynamic RTL Disabled - Link with Runtime Packages Disabled - Build in Command Line => Mad Except Not Activated
Sadly, what I need is the last configuration.

The project is just the default one, with an exception added in the default form. No options changed except the link mode. The command lines used are the following ones:

Code: Select all

MSBuild.exe Project2.cbproj /target:Build /p:Config=Debug

Code: Select all

madExceptPatch.exe <Project Dir>\Win32\Debug\Project2.exe <Project Dir>\Project2.mes
And I get:

Code: Select all

Binary patched.
Due to incomplete debug information madExcept may not work correctly.
This is probably a consequence of BCB bug QC# 104255.
Workaround: Copy "rtl/vcl.lib" from the BCB "debug" folder to "release".
map file appended 
I couldn't find any solution in the previous threads. If you have any ideas it would be appreciated.

Thanks
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Command line build and static link

Post by madshi »

Do you have TD32 debug information enabled? There is likely to be some difference between compiler or linker options, if compiling in the IDE works, but fails when compiling via command line. It's hard for me to "guess" what the issue is. E.g. compile both ways, then check if there are TD32 debug infos available for both. If so, compare the TD32 debug info size. Is it identical?
vigiers
Posts: 2
Joined: Mon May 23, 2016 12:01 pm

Re: Command line build and static link

Post by vigiers »

I checked the .tds files and indeed, the one with command line was smaller.

I had compared the compiler + linker commands generated inside and outside RAD Studio but I missed one difference in linker: the library path outside RAD Studio didn't include debug libs: "c:\program files (x86)\embarcadero\studio\17.0\lib\Win32\debug", just the release ones. Adding this path in "Project Options" > "Library Path" solves the issue: build with command line generates a complete .tds and madExceptPatch.exe doesn't complain anymore.

I don't really understand why this path is not automatically included, knowing that MSBuild is perfectly getting the "debug" option. But I have a workaround :)

Thanks for your help!
Post Reply