How to do a command line build using Delphi 7? - delphi

I am trying to build a delphi project from the command line compiler
Example: C:\dcc32 -B C:\BD\Delphi7\work\MyProject.dpr
Aside from the the standard evironment pathing:
$(DELPHI)\Bin;
$(DELPHI)\Lib;
$(DELPHI)\Imports;
$(DELPHI)\Projects\Bpl;
$(DELPHI)\Rave5\Lib;
there is nearly 50 other paths to other libraries, components, etc...
How do i package this all up and point to these to use in the commanline parameters to make my build?
When i run the example above
C:\dcc32 -B C:\BD\Delphi7\work\MyProject.dpr
i get a FATAL: File not found : 'file name here'
thanks

Under Delphi 7 you need to edit you dcc32.cfg file (in you Delphi bin folder). You need to copy the library path from the IDE and put in the dcc32.cfg file. You have to add it 4 times for the different command line parameters, eg:
-u=path
-i=path
-r=path
-o=path
There are 4, I believe. I haven't done this in a few years so I hope that the info is correct. Certainly, the command line compiler does not use the same place to store the paths as the IDE does.

I don't think dcc32.exe is stored under C:\, if it is you're installation of Delphi is really out of order, or you have moved only the dcc32.exe file.
It's advised to use the dcc32.exe from the directory where the Delphi install has stored it. The Delphi directory depends strongly on the Delphi version, but for Delphi versions op to 7, this looked something like this:
C:\Program Files\Borland\Delphi7\bin\dcc32.exe

For later versions of Delphi, this should be changed to:
"C:\Program Files (x86)\Embarcadero\RAD Studio\8.0\bin\DCC32.exe" -h

Related

dxgettext and Windows 10

Has anyone got dxgettext running under Windows 10?
I installed dxgettext from the offical homepage under Windows 10, which worked fine.
But whenever I try to run some of the installed tools (e.g. msgfmt.exe), they don't really run, but call themselves again, generating thousands of processes and making the system crawl.
This is what happens:
I call msgfmt --help
the executable msgfmt hangs, blocking the command window
in the TaskManager I see houndreds of msgfmt.exe processes popping up
I think, I have to replace the gettext tools of the dxgettext package with some newer version but before trying to figure it out I first wanted to ask if someone else experienced similar problems and found a working solution.
My questions:
Has anyone got the tools coming with dxgettext running under Windows 10?
What steps have been necessary to get it to run?
I resolved the problem in the following way:
I downloaded https://github.com/mlocati/gettext-iconv-windows/releases/download/v0.19.8.1-v1.14/gettext0.19.8.1-iconv1.14-static-32.zip from https://mlocati.github.io/articles/gettext-iconv-windows.html
I replaced the following files from the installation directory of dxgettext with files from the zip archive:
msgattrib.exe
msgcat.exe
msgcmp.exe
msgcomm.exe
msgconv.exe
msgen.exe
msgexec.exe
msgfilter.exe
msgfmt.exe
msggrep.exe
msginit.exe
msgmerge.exe
msgunfmt.exe
msguniq.exe
xgettext.exe
Result:
Dxgettext and the tools, I use, seem to work fine. I found no problems with my workflow so far, with one exception:
If I use assemble to embed mo-files into an exe compiled with JvGnugettext.pas, I get the following error:
Pach code “6637DB2E-62E1-4A60-AC19-C23867046A89” was not found in .exe file. Are you sure the .exe file has been compiled with the correct libraries?
This may not be related to the original problem. However, it is resolved by replacing the original assemble.exe with the version from https://sourceforge.net/p/dzlib/code/HEAD/tree/buildtools/trunk/ (see answer by #dummzeuch).
The installer on the official home page is pretty old. Last time I looked it contained several outdated dlls and executables from the original gnugettext project that did not work correctly under recent Windows versions. You could take those from my buildtools repository on OSDN. These work for me. No guarantee that they work for you though.
https://osdn.net/projects/dzlib-tools/scm/svn/tree/head/buildtools/trunk/
I've been having these issues too with dxgettext 1.22, in Windows 10 1607. I changed some DLLs at first but kept having the bash.exe looping and hogging my PC to death.
So what I did was basically install latest Cygwin 32bit and replaced the appropiate DLLs. I kept the ones for gettext. Instructions:
Download and fresh install dxgettext-1.2.2.exe from http://dxgettext.po.dk/download as admin. Restart.
Download Cygwin 32bit from https://cygwin.com/install.html in a different folder from dxgettext (I took the default, c:\cygwin)
Run setup-x86.exe and select "Base" Package (Install). Next, Select Required packages just in case.
Move the following files from dxgettext folder to a backup folder (we'll use some DLL later):
cyg*.dll
bash.exe
Copy from c:\cygwin to the dxgettext folder the following files:
bash.exe (set to run as admin)
cygwin1.dll
cygiconv-2.dll
cygintl-8.dll
cygreadline7.dll
cyggcc_s-1.dll
cygncursesw-10.dll
Recover the file(s) below from the backup folder (See #4) and copy to the dxgettext folder.
cyggettextsrc-0-14-1.dll
cyggettextlib-0-14-1.dll
cygintl-3.dll
Running like this, you might get error 740 (requires elevation). So: Set ggmerge.exe,ggfmt.exe to run as admin
** EDIT** Found online this very interesting link, from a programmer who offers a free backup written in Delphi. The good thing is he adapted the dxgettext tools to run in Windows 10. This helped me a lot.
http://personal-backup.rathlev-home.de/translate.html

DCC32 compiler configuration file and command line parameter precedence

I am trying to build first time my Delphi application through command line using DCC32. I have few doubts regarding the configuration file of my project. There are some search paths I have to add to project when compiling through IDE. When I remove them, the compilation fails.
Now if I compile it through command line is it need to specify configuration file details or the search path parameters?
without any parameters:
dcc32.exe project1.dpr
with some parameters:
dcc32.exe -u%Shared% -ND:\out project1.dpr
I have following doubts:
if the config file details are not mentioned then it will take settings automtically from project.cfg (created by IDE)??
if yes then if i mentioned the -U,-N options in command line then it will override All the settings which are in .cfg ile?
This question sounds foolish but want to know What is use of compiling through command line over IDE?
Please provide some help to resolve my doubts. Any information related to dcc32 compilation options will be appreciated.
1. - If the project config file is not specified in the command line options, will the settings be taken from the project's cfg file generated by IDE ?
Yes.
2. - When I use the -U, -N options in command line will that override all the settings from a project cfg file ?
No. Command line options takes precedence though, but only those options you specify will override the settings from the project's *.cfg file, not the whole configuration
3. Is there a difference between compilation from command line and compilation from IDE ?
No. There is no difference speaking about Delphi 5. From my view, the command line way just brings you the possibility to automate a build process through command line batch without need of opening IDE.
It's been a while, but I believe you are correct in your assumptions about the command-line vs the .cfg file. You can verify this yourself by having one path in the .cfg and specifying a different one on the command line and, say, have an error in the file that the .cfg would reference and see if the compiler hits the error.
Compiling from the command-line is convenient for automated build systems but is otherwise the same as compiling through the IDE.

delphi 2009 compile packages

i truly don't get it.
trying to recompile the qr5 packages, and is impossible with this Delphi.
build the QR5Run_Rad6.bpl, everything is fine.
when i install QR5Design_RAD6.bpl an error message appears
"its not possible to run the program since qr5run_rad.bpl is missing in your computer. try again installing your program to solve this problem."
just did!
clean build compile doesn't work in any order. closed the ide and reopened , still doesn't work.
what else is left?
clean all related dcp and bpl
QR5Design_RAD6.bpl <> qr5run_rad.bpl
And more importantly, the qr5run_rad.bpl needs to be found on the systempath in order for the IDE to find it so it can be used by the design time package.
In other words: you need to build the qr5run_rad.bpl as well as the QR5Design_RAD6.bpl. And you need to make sure that the qr5run_rad.bpl ends up in a folder that is on your system path, not just any old folder where you have the sources and/or dcu's.
In addition to what Marjan wrote:
Windows uses these places when looking for a DLL (or BPL, which is a DLL):
The directory from which the application loaded.
The system directory. Use the GetSystemDirectory function to get the path of this directory.
The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The current directory.
The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key. The App Paths key is not used when computing the DLL search path.
Delphi puts BPL files in a directory like C:\Documents and Settings\All Users\Documents\RAD Studio\8.0\Bpl which it adds to your PATH when Delphi is installed. For Delphi 2009, that Path would probably be C:\Documents and Settings\All Users\Documents\RAD Studio\6.0\Bpl on a Windows XP machine.
--jeroen

Delphi 6 command line compile: NO DCU’s

When using dcc32 against the .dpr file it produces a dll but no dcu’s.
The project level .cfg is using the –N switch to set the path but nothing is in the directory specified. It must see the .cfg as the –E switch is working.
I tried to use brcc32/brc32 against the .dpr file before a call dcc32 but either one gives me the Error projectName.dpr 3 1: Expecting END?
I need the dcu’s from project1 for project2 which when I run the dcc32 against the .dpr it errors stating it can’t find the missing dcu’s from project1 for project2.
What steps, clc/utility need to be run to produce the dcu files?
Running on XP with Delphi 6 installed.
DCC32 v14
BRC32 v5.4
Perhaps it is ignoring the -N switch because it doesn't have one? As far as I know the switch to specify where the dcu's should go is the -N0 switch. (Letter N, digit zero).
dcc32 --help is your friend here. In particular:
-N0<path> = unit .dcu output directory
(Note that D6 does not show this switch. D7 and more recent versions do.)
You do have to make sure that you include all necessary unit dependencies through the -U flag, resource dependencies through the -R flag, and so on. For instance:
dcc32 -B -CC -Q -E.\bin -IC:\home\work\Indy;C:\home\work\dUnit\src -LE.\bin -N0.\build -O"C:\home\work\Indy;C:\home\work\dUnit\src" -U"C:\home\work\Indy;C:\home\work\dUnit\src" -R"C:\Program Files\Borland\Delphi6\source\Indy;C:\Program Files\Borland\Delphi6\lib" SIP.dpr
EDIT: It doesn't help that dcc32 --help does NOT tell you about the -N0 switch. I found this out the hard way, and it was only on the advice of my boss (Guido Gybels) that I managed to get things working.

Delphi 2009 command line compiler using dcc32.cfg?

In Delphi 2009, how can I build a project using command line. I tried using the command line compiler and supplying -a -u -i -r in dcc32.cfg file. But compiler is not recognizing the paths and throwing the error required package xyzPack is not found.
-aWinTypes=Windows;WinProcs=Windows;DbiProcs=BDE;DbiTypes=BDE;DbiErrs=BDE
-u"C:\MyProj\Output\DCP"
-i"C:\MyProj\Output\DCP"
-r"C:\MyProj\Output\DCP"
and on command line i execute the command :
dcc32 "C:\MyProj\MyProject.dpr" -B -E"c:\MyProj\Output\EXE"
What am I doing wrong here?
Thanks & Regards,
Pavan.
Instead of invoking the compiler directly, consider using MSBuild on your .dproj, since that's what the IDE uses. Delphi MSBuild Build Configurations From Command Line might help you with that.
From the related answer (as shown below) ie:
Compiling with Delphi 2009 from a command line under Windows Vista 64-bit
I notice that you should be able to build a single package from the command line this way. I have used batch files (buildall.cmd) to launch dcc32, and have not yet used msbuild.
I have ultimately found both approaches frustrating, and have instead decided to opt for building a little GUI shell (a lite version of Final Builder, if you like) that basically works as a semi-graphical semi-command-line way of automating my builds and filtering the compiler output to produce results. I would be highly interested in anyone else's experiences with "tinder box" (daily or even continuous build) operations with Delphi.
You may end up where I'm heading... just buy Final Builder. :-)

Resources