Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: Help with compiling in command line



Permlink Replies: 4 - Last Post: Sep 13, 2017 11:26 PM Last Post By: TIK-SOFT IT Threads: [ Previous | Next ]
TIK-SOFT IT

Posts: 6
Registered: 7/22/16
Help with compiling in command line
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 12, 2017 5:05 AM
I'm trying to compile my project in command line:

my command is :
 
"c:\Program Files (x86)\Embarcadero\Studio\18.0\bin\dcc32.exe"  d:\projekt_new\skins\SKComponents.dpk
-Nd:\projekt_new\trunk\dcu
-LEd:\projekt_new\trunk\bpl 
-LNd:\projekt_new\\trunk\dcu 
-$D+ -$L+ -$YD -$C+ -$Q+ -$R+ -$O- -GD -$D+ -$L+ -$YD -$C- -$Q- -$R- -CC -W+ -H+ -$D+ -$L+ -$YD -$O+ -$Q- -$R- -$C+ -$I+ -$H+ -$P+ -$V+ -$B- -$T- -$W- -$J- -$U- -$X+ -$G+ -$M- -$A8 -$Z1 -Q -B 
-DSUPPORTS_WIDESTRING -DSUPPORTS_WIDESTRING -W-UNSAFE_CODE -W-UNSAFE_TYPE -W-UNSAFE_CAST -W+SYMBOL_PLATFORM -W+SYMBOL_LIBRARY -W+SYMBOL_DEPRECATED -W+UNIT_PLATFORM -W+UNIT_LIBRARY -W+UNIT_DEPRECATED  
-U"c:\Program Files (x86)\Embarcadero\Studio\18.0\lib\win32\release" -Ud:\projekt_new\trunk\dcu 
-R"c:\Program Files (x86)\Embarcadero\Studio\18.0\lib\win32\release" -Rd:\projekt_new\trunk\dcu 
-I"c:\Program Files (x86)\Embarcadero\Studio\18.0\lib\win32\release" -Id:\projekt_new\trunk\dcu


I'm running it by creating process
function TWin32ChildProcess.Launch(const CmdLine: string; hInput, hOutput, hError: THandle): THandle;
var
  StartupInfo: TStartupInfo;
  ProcessInfo: TProcessInformation;
  Success:     boolean;
begin
  Result := 0;
  FillChar(StartupInfo, SizeOf(StartupInfo), #0);
  StartupInfo.cb := SizeOf(StartupInfo);
  StartupInfo.dwFlags := STARTF_USESTDHANDLES or STARTF_USESHOWWINDOW;
  StartupInfo.wShowWindow := SW_SHOW;
 
  StartupInfo.hStdInput   := hInput;
  StartupInfo.hStdOutput  := hOutput;
  StartupInfo.hStdError   := hError;
 
  Success := CreateProcess(nil, Pwidechar(CmdLine), nil, nil, True,
    NORMAL_PRIORITY_CLASS, nil, nil, StartupInfo,
    ProcessInfo);
  if not Success then
    Error('CreateProcess:' + SysErrorMessage(GetLastError))
  else begin
    WaitForInputIdle(ProcessInfo.hProcess, INFINITE);
    CloseHandle(ProcessInfo.hThread);
    Result := ProcessInfo.hProcess;
  end
end;


in return i get
Exception class ETaskFailure with message 'SKButton.pas(6) Fatal: F2613 Unit 'Controls' not found.'

Controls is probabyl delphi lib vcl.Controls...

In earlier Dephis this workk fine, but now in Delphi Berlin I have problem

any suggestions will be helpful

Edited by: TIK-SOFT IT on Sep 12, 2017 5:06 AM
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Help with compiling in command line [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 12, 2017 10:26 AM   in response to: TIK-SOFT IT in response to: TIK-SOFT IT
TIK-SOFT IT wrote:

I'm trying to compile my project in command line:

Just an observation, but you are defining SUPPORTS_WIDESTRING twice.

Also, you are passing a LOT of options on the command-line, which has a
finite length:

What is the command line length limit?
https://blogs.msdn.microsoft.com/oldnewthing/20031210-00/?p=41553

You should consider moving the options to a .cfg file that dcc32.exe
can then use. On the other hand, you really should be compiling a
.dproj file instead of a .dpk file directly. Then you can set the
desired project options inside the .dproj file and compile it with
dcc32 or msbuild, depending on your version of Delphi.

I'm running it by creating process

Make sure you are not passing a string literal to CmdLine, since you
are passing it as-is to the 2nd parameter of CreateProcessW(). Passing
read-only memory to the 2nd parameter may cause crashes (this is
documented on MSDN). Best to assign CmdLine to a local variable and
call UniqueString() on it, just to make sure the memory is always
writable:

function TWin32ChildProcess.Launch(const CmdLine: string; hInput,
hOutput, hError: THandle): THandle;
var
  TmpCmdLine: string;
  ...
begin
  TmpCmdLine := CmdLine;
  UniqueString(TmpCmdLine);
  ...
 
  if not CreateProcess(..., PChar(TmpCmdLine), ...) then
  ...
 
end;


in return i get
Exception class ETaskFailure with message 'SKButton.pas(6) Fatal:
F2613 Unit 'Controls' not found.'

Controls is probabyl delphi lib vcl.Controls...

The error means your project is not linking to the VCL library, and the
compiler can't find Controls.dcu or Controls.pas.

--
Remy Lebeau (TeamB)
TIK-SOFT IT

Posts: 6
Registered: 7/22/16
Re: Help with compiling in command line [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 13, 2017 2:58 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Thank You for reply.

I've tried to compile .dproj file and then i get
'SKComponents.dproj(1) Error: E2029 Declaration expected but '<'.

Maybe I sholud compile it by msbuild ...
Which Delphi version compile by msbuild and which ones by dcc32 ?

Edited by: TIK-SOFT IT on Sep 13, 2017 3:35 AM

Edited by: TIK-SOFT IT on Sep 13, 2017 3:36 AM
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Help with compiling in command line [Edit] [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 13, 2017 8:48 AM   in response to: TIK-SOFT IT in response to: TIK-SOFT IT
TIK-SOFT IT wrote:

Which Delphi version compile by msbuild and which ones by dcc32 ?

MSBuild was added to Delphi in D2007.

--
Remy Lebeau (TeamB)
TIK-SOFT IT

Posts: 6
Registered: 7/22/16
Re: Help with compiling in command line [Edit] [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 13, 2017 11:26 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
OK.
Thank You for all your Help.

I used msbuild and it worked
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02