The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,994 other followers

Delphi Continuous Integration: When you get E2202 “Required package ‘rtl’ not found” or F1027 “Unit not found: ‘System.pas'”

Posted by jpluimers on 2016/11/08

If when setting up Continuous Integration (CI) with Delphi and you get errors like E2202 "Required package 'rtl' not found" or F1027 "Unit not found: 'System.pas'", then something is wrong with your library path on the CI server.

Before going into the details of why, the quick solution is to set either of these environment variables in your build script

  • Delphi 2007, 2010: Win32LibraryPath
  • Delphi XE and up: DelphiLibraryPath

Now back to the details of why these might not be set, most information is from my Delphi build automation workshop.

Delphi uses msbuild for building and uses a set of targets files that gather information about the projects and environment. Over time the targets files for Delphi historically are named CodeGear.*.Targets and perform the Delphi (and C++ Builder) specific parts of the build process and information collecting.

The Library Path is a user setting that – besides being stored in the user registry – is also stored in EnvOptions.proj file saved by the IDE on exiting and loaded by theCodeGear.*.Targets. Circumstances under which the EnvOptions.dproj cannot be found are centered around the user under which the build automation where:

  1. it has never started the IDE
  2. it cannot start the IDE

The second can occur for instance when the user has no interactive login privileges which – for server installations – is fairly common.

The first makes you think it is wise to use a build user that can login. But it also means that if you use a regular user for it, he or she can ruin the build process by starting Delphi, modifying the Library Path and exiting Delphi.

So it is a much better idea to either:

  • Specify the Library Path in your build process (depending on the Delphi version, set the Win32LibraryPath or DelphiLibraryPath variable)
  • Use Delphi XE2 or up: these version can do without these variables (and generates a reasonable default in the CodeGear.*.Targets)




One Response to “Delphi Continuous Integration: When you get E2202 “Required package ‘rtl’ not found” or F1027 “Unit not found: ‘System.pas'””

  1. EMB said


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: