Because Indy is changing fairly rapidly, and because there are problems with the version of Indy that shipped with RAD Studio 2010, I found that I had to download and compile a new version of Indy. Although that isn't too hard, the documentation is scattered all over, and there is no comprehensive source of information. Searching through all of this, I wasted quite a number of hours. To save others (and save myself when I have to do it again), I wanted to post a set of instructions.

None of the information here is original. I take credit for nothing, but I take responsibility for all of the errors. Please post corrections, for the benefit of all. I greatly appreciate the contributions of the Indy developers and experts.

My setup is RAD Studio 2010, including both Delphi and C++ Builder. I have only passing knowledge of Delphi, as C++ is what I mostly use. However, C++ Builder, by itself, is poorly documented, since Embarcadero includes most of the demos and documentation for Delphi, so I got the combined RAD Studio product. That is fortunate, since it is much easier to compile Indy using the Delphi personality than with C++ Builder. These instructions are for replacing Indy Tiburon version 140 with a new version of Indy Tiburon 140.

The last comprehensive set of instructions I found was for Delphi 2007, and did not include the steps needed to get Indy to work with C++ Builder, although it was posted by Davide Spano in May 2010. It is definitely worth reviewing those instructions at https://forums.embarcadero.com/thread.jspa?threadID=37748&tstart=0 .

As suggested there, you should start by starting Delphi and becoming familiar with your environment. Create a new Delphi project, drop an Indy component on the form, right-click on the component, and select "About Internet Direct (Indy)" to find out what version of Indy you currently have.

As Davide says, be sure that you do not have a Delphi project open when following these instructions. Also, you should start RAD Studio as administrator and probably have User Account Control turned off. Note that Microsoft lies: some UAC settings claim that they will result in your being notified when programs need increased authority. However, some operations will actually be failed (silently) rather than your being notified. Depending on the version of Windows, you may have difficulties and experience failures when writing files to the Program Files folder hierarchy.

You will also want to make sure that you have applied all updates to RAD Studio: run the "Check for Updates" program in the Start menu in the Embarcadero group. I recommend you turn UAC off, and be aware that if the help installation fails, it will not restart, and will need to be done manually. This is a known bug in the installation program.

As Davide suggests, with no Delphi project open, but the Delphi personality of RAD Studio loaded, go to Tools/Options, and look at Environment Options/Delphi Options/Library - Win32. Here you will find the various paths you will need in order to know where Delphi will look for e.g. library files, and where it will, by default, put the compiled files. You will see environment variables used, such as $(BDSCOMMONIR). In the same Tools/Options dialog, look under Environment Options/Environment Variables to see which paths these environment variables refer to.

You will need to go through the Library path, in particular, to make sure that there are not any old Indy files that could get mixed in with your new Indy files. If you have trouble with the compile, or trouble using the compiled files, this is probably your problem, according to the Indy experts. Davide does a great job of explaining this in more detail.

The first step will be getting the current Indy files out of your library path. I recommend renaming folders and moving files to holding folders, carefully named, rather than deleting files. If you delete the wrong files, you may have to reinstall to recover them.

In these instructions, I will name paths relative to my RAD Studio installation in C:\Program Files (x86)\Embarcadero\RAD Studio\7.0 . Thus, I will refer to C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\lib as "lib". When you see [a|b][c|d], that means do the action for ac, ad, bc, and bd.

To move the old Indy files out of the way:
rename lib\Indy10 to lib\Indy10.orig
rename lib\debug\Indy10 to lib\debug\Indy10.orig
move lib\[debug|release]\[IndyCore|IndyProtocols|IndySystem].[bpi|lib] to lib\[debug|release]\Indy10.orig.files

Note that lib\IndySock.dcu is NOT moved

rename source\Indy\Indy10 to source\Indy\Indy10.orig
rename include\Indy10 to include\Indy10.orig

Now, start Delphi, and remove the Indy components:
Component/Install Packages... and find the Indy10 Core Design Time and Indy10 Protocols Design Time packages. Note the location of the .bpl files they refer to (shown below the listbox when you single-click the packages). On my system, they were bin\dclIndyCore140.bpl and bin\dclIndyProtocols140.bpl. Click "Remove" to uninstall both of those packages, and click OK.

AFTER you have uninstalled the component packages:
move bin\[IndyProtocols|IndyCore|IndySystem]140.bpl and bin\dclIndyCore|dclIndyProtocols]140.bpl to bin\Indy10.orig.files

Note that if you move the dcl files before starting Delphi, you will get the "Can't load package .. dclDataSnapServer140.bpl .. The specified module can't be found." Just answer "Yes" to the question about loading it next time. That problem will be fixed once you have installed the new Indy files into bin. You may also get an error "The program can't start because IndySystem140.bpl is missing from your computer. Try reinstalling the program to fix this problem." Just click OK.

Now, download the new Indy Tiburon zip file from http://indy.fulgan.com/ZIP. You want the IndyTiburon.zip file. Unzip it, and move the Core, System, and Protocols folders from the Lib folder into a new source\Indy\Indy10 folder in your RAD Studio installation.

The Indy files, and where they were located, were:
lib\debug - had IndyCore, System, & Protocols .bpi and .lib files
lib\release - had the same as lib\debug
lib\Indy10 had dci's (& IndyCore, System, and Protocols .dcp, as well as IdAntiFreeze.obj)
lib\debug\Indy10 had the same as lib\Indy10
lib itself just had IndySockTransport.dcu, which does not seem to be part of the Indy distribution, and which I did not touch.

Now, it is time to start making the new projects. As Davide points out, you need to make these in order:
IndySystem140.dpk
IndyCore140.dpk
IndyProtocols140.dpk
dclIndyCore140.dpk
dclIndyProtocols140.dpk

As you open these, you will get a message that "cannot find resource file ... recreated". Click OK

Before you can make your projects, you will have to make a few modifications. There are reportedly some scripts, but they don't seem to be updated, and making the changes manually is pretty easy, so that is what I will describe.

You will want to change the project options with the Project/Options dialog. Change Delphi Compiler/DCP output directory (for the .bpi, .dcp, and .lib files), Delphi Compiler/Package output directory (for the .bpl files), Delphi Compiler/Unit output directory (for the .dcu files), Delphi compiler/Linking/C++ builder .hpp output directory (for the .hpp files), and Delphi compiler/Linking/Linker output (set to Generate all C++ Builder files (including package libs)). The goal will be to get as many as the output files as possible into the right locations.

There are many ways you could do that, but I modified the "Base" build configuration for the release build settings, and the "Debug" build configuration for the debug build settings. In the base build configuration, I set DCP output to lib\release, package output to lib\release, unit output to lib\Indy10, and .hpp output to include\Indy10. In the debug build configuration, I set the dcp output to lib\debug, package output to lib\debug, and the unit output to lib\debug\Indy10. With this setup, I still had to move the .dcp's from lib\debug and lib\release to lib\debug\Indy10 and lib\Indy10 to match the original Indy configuration, and the .bpl's that you want (release or debug) will need to be copied to bin. However, it is useful to leave the generated copies in lib\release and lib\debug.

Each package requires the previous package be created first, and the .bpl must be on the Delphi Compiler/Search Path. The best way to do that may be to edit the release and debug configurations, adding lib\release to the search path of the release configuration, and lib\debug to the search path of the debug configuration. The previously described setup will leave these package output files in those directories, so that Delphi will find them.

Edit 28 July 2010: using the current Indy Tiburon, this is no longer needed Finally, before making the projects, if you want to use SSL with C++ Builder, there are multiple errors in EXTERNALSYM directives in Protocols\IdSSLOpenSSLHeaders.pas, according to Remy. The problems still exist as of July 14, 2010. I documented a workaround in https://forums.embarcadero.com//thread.jspa?threadID=39265 that works for me. You may want to make those changes (preserving a copy of the current file, of course!) before building your project if you want to use SSL with C++ Builder. The problems don't affect Delphi at all.

Note that, if you go back to fix this, you only have to load and rebuild the IndyProtocols140.bpl project, make the changes in Protocols\IdSSLOpenSSLHeaders.pas, and only have to build either the release or debug build, since you are only fixing the .hpp file, not actually compiling anything new.

Then, to make, for example, the debug version of IndySystem140.bpl, load IndySystem140.dpk, make the changes above, be sure you have the Debug configuration activated in the Project Manager by right clicking on it, then right click on IndySystem140.bpl, and select "Build". Look in the output window for "Build Succeeded". Do the same thing for the other .bpl's in the sequence a above, both debug and release configurations. When you are done with each .bpl, click File/Close All, and select "Yes" to save changes to project. There is a "build" option in the context menu directly on each of the build configurations, but I got compile errors when trying to use it. Activating each build and then building it worked better for me.

Then, to match my pre-existing configuration, I moved the five .dcp files from lib\debug to lib\debug\Indy10 and five from lib\release to lib\Indy10

I also copied the five .bpl files from lib\release to bin, in preparation for the component install.

Then, I made sure that all project files were closed, and went to Component/Install Packages ... I clicked "Add", and found the dclIndyCore140.bpl and dclIndyProtocols.bpl in the bin folder and added them to the components. Then, I was able to make a new Delphi application and drop an Indy component on the form, and compile and run the application.

I then started the C++ Builder personality, and made a new application, dropped an Indy component on the form, and compiled and ran the application to test it.

To make the IdAntiFreeze.obj file, you will need to do that separately. You will only need that .obj if you use the TIdAntiFreeze component. Info on compiling IdAntiFreeze.obj:

Building IdAntiFreeze.obj: This requires that we actually build IdDummyUnit.pas from the Protocols folder, but which uses IdAntiFreeze.pas in the Core folder and IdAntiFreezeBase.pas and other files in the System folder.

I did not figure out how to get Delphi itself to compile that, so I used the command line to compile this in the Protocols folder in the Lib folder of IndyTiburon:

dcc32 -JPHNE -U..\System;..\Core IdDummyUnit.pas

(this will make .hpp and .obj files, as well as the IdDummyUnit.dcu file, in the same directories as the original .pas files. Thus, look for IdAntiFreeze.obj in the Core directory after you execute this command - make sure User Account Control is off!) You will then want to copy IdAntiFreeze.obj into lib\Indy10

You can also try using options to place the files where you want them: -NH for hpp directory, -NO for obj, so, from source\Indy\Indy10\Protocols :
dcc32 -JPHNE -U..\System;..\Core -NH..\..\..\..\include\Indy10 -NO..\..\..\..\lib\Indy10 IdDummyUnit.pas

Once you are done with compiling Indy, you will want to save your new .dproj files, which have to project options you have made (these will be in your source folders). Then, when you want to compile a new version of Indy, you won't have to enter all of the directories by hand again!

One other thing I would consider, since there will now be more Indy***140.bpl files around, is turning off the option to build with runtime packages, at least for IndyCore140.bpl, IndySystem140.bpl, and IndyProtocols140.bpl. This will put these packages directly in your executable files, eliminating the risk that your executables will try to run against the wrong versions of the bpl's. You can do this in the project options, under Packages. You can remove those three packages from the list of "Build with runtime packages".

Some additional resources:

Use Indy Tiburon as the current version of Indy (although both Indy10 and IndyTiburon are being updated on indy.fulgan.com)
https://forums.codegear.com/thread.jspa?threadID=3792
http://atozedsoftware.newsgroups.archived.at/indy.general/200909/0909026481.html


Most current version of OpenSSL to use with Indy:
http://indy.fulgan.com/SSL/


Current version of IndyTiburon:
http://indy.fulgan.com/ZIP/


How to Install Indy 10.5.7 in Delphi 2007
https://forums.embarcadero.com/thread.jspa?threadID=37748&tstart=0


Thanks again to the Indy team and all of the others, especially Davide, who have written on this. Please post your comments and corrections.

Edited by: James Nachbar on Jul 28, 2010 9:58 PM to note that there is no longer any need to edit Protocols\IdSSLOpenSSLHeaders.pal

 

最后修改:2010 年 08 月 16 日
卧槽,全是白嫖客,服务器不要钱吗?