Jeeva
Jeeva

Reputation: 4663

how to compile package using command line

I am very new to Delphi. I try to compile one of the packages in my project using command line and I am getting the following error

dxmdaset.pas Fatal:F1026 File not found: CompatLib_DXE.dcp

I use the following batch files

BuildAll.bat

call rsvars.bat     
set COMPILER=%BDS%\bin\DCC32.EXE
echo Compiler: %COMPILER%
echo.
MD "%CURRENT_DIR%\..\bin"
MD "%CURRENT_DIR%\..\bin\bpl"
MD "%CURRENT_DIR%\..\bin\dcu"
cd %CURRENT_DIR%\..\bin\bpl
del *.bpl /q
del *.dcp /q
del *.drc /q
del *.map /q
cd %CURRENT_DIR%\%VCLFOLDER%\RemObjects SDK
del wo3p_03_DXE.* /s/q

:Build_CompatLib
echo ...Building CompatLib...
echo.
cd %CURRENT_DIR%\%VCLFOLDER%
call BuildCompatLib.bat

:Build_DevExpress_Old
echo ...Building DevExpress...
echo.
cd %CURRENT_DIR%\%VCLFOLDER%
call BuildDevExpress.bat old

BuildCompatLib.bat

@echo off
if "%COMPILER%" == "" goto no_compiler
echo Building ComaptLib Component Library:
set COMPILER_OPTIONS=%2 %3 %4 %5 %6 %7 %8 %9
set COMAPTLIB_ROOT=%CD%\Compatibility
if not "%2" == "" echo You specified these dcc32 options: %COMPILER_OPTIONS%
if     "%2" == "" echo Recreating all DCUs then linking td32 info and writing a detailed 
map file.

if     "%2" == "" set COMPILER_OPTIONS=-q -b -gd -v
echo.
:CompatLib
cd %COMAPTLIB_ROOT%
echo Compiling CompatLib_DXE %COMPILER_OPTIONS%
echo.
     "%COMPILER%" CompatLib_DXE.dpk %COMPILER_OPTIONS%

if ERRORLEVEL 1 goto error
echo.
:end_ComaptLib
echo no errors in building CompatLib packages
echo.
echo.
goto end
:error
echo.
echo ERROR! building CompatLib packages: %~f0
echo.
pause
:end

BuildDevExpress.bat

@echo off
rem Compiler defined in calling batch file
if "%COMPILER%" == "" goto no_compiler
echo Building DevExpress Component Libraries:
set COMPILER_OPTIONS=%2 %3 %4 %5 %6 %7 %8 %9
set DEVEXPRESS_ROOT=%CD%
if not "%2" == "" echo You specified these dcc32 options: %COMPILER_OPTIONS%
if     "%2" == "" echo Recreating all DCUs then linking td32 info and writing a detailed map file.
if     "%2" == "" set COMPILER_OPTIONS=-q -b -gd -v
echo.
:DevExpressCommon
:DevExpressMemData
set PKG_LOCATION=DevExpress\ExpressMemData\Delphi 7\Sources
rem set PKG_LOCATION=DevExpress New\ExpressMemData\Packages
cd %DEVEXPRESS_ROOT%\%PKG_LOCATION%
echo Compiling dxmds_DXE.dpk %COMPILER_OPTIONS%
echo.
     "%COMPILER%" dxmds_DXE.dpk %COMPILER_OPTIONS%
echo Compiling dcldxmds_DXE.dpk %COMPILER_OPTIONS%
echo.
     "%COMPILER%" dcldxmds_DXE.dpk %COMPILER_OPTIONS%
if ERRORLEVEL 1 goto error
cd %DEVEXPRESS_ROOT%
echo.

I got an error while compiling dcldxdms_dxe.dpk. It is actually looking for compatlib_dxe.dcp which was compiled earlier but couldn't find it.

Upvotes: 1

Views: 3047

Answers (2)

Ken White
Ken White

Reputation: 125757

You need to either

  • include the proper command line switches and the paths to the compiler command line, or
  • provide a DCC32.CFG file in your project folder that supplies them.

To find the switches the compiler needs, just run dcc32 with no parameters (or with /? or --help) from the command line:

c:\Users\YourName>dcc32

or see the Delphi help file topic for DCC32.CFG (search the help for that exactly, without the quotes):

You can set up a list of options in a configuration file called DCC32.CFG, which will then be used in addition to the options entered on the command line. Each line in configuration file corresponds to an extra command-line argument inserted before the actual command-line arguments. Thus, by creating a configuration file, you can change the default setting of any command-line option.

The command-line compiler lets you enter the same command-line option several times, ignoring all but the last occurrence. This way, even though you've changed some settings with a configuration file, you can still override them on the command line.

When dcc32 starts, it looks for DCC32.CFG in the current directory. If the file isn't found there, dcc32 looks in the directory where DCC32.EXE resides.

Here's an example DCC32.CFG file, defining some default directories for include, object, and unit files, and changing the default states of the $O and $R compiler directives:

-IC:\DELPHI\INC;C:\DELPHI\SRC

-OC:\DELPHI\ASM
-UC:\DELPHI\UNITS
-$R+

-$O-

Now, if you type:

dcc32 MYSTUFF

the compiler performs as if you had typed the following:

dcc32 -IC:\DELPHI\INC;C:\DELPHI\SRC -OC:\DELPHI\ASM -UC:\DELPHI\UNITS -$R+ -$O- MYSTUFF

Upvotes: 1

ESG
ESG

Reputation: 9435

When compiling from the IDE, Delphi will add both the library path from the project settings as well as Delphi's own library path.

If you compile from the command line, you need to add all of those as arguments to the compiler.

There's also an option to see the line that Delphi sent to the compiler when called from the IDE, but I don't recall when they added that, so it might not be available in Delphi 7.

Upvotes: 0

Related Questions