Delphi: Required package not found
Asked Answered
M

7

15

I'm trying to build 3 packages, A, B and C. A defines some base classes that are used in B and C. I've got all 3 of them in the same project group, all set up to output to the same custom BPL output folder. This folder is in the search path for B and C. But when I go to build B and C, the compiler chokes on the Requires list. "Required package 'A' not found."

How do I tell B and C where to find A so they'll build correctly?

Matronize answered 18/4, 2009 at 19:24 Comment(2)
Validating to see that even superstars like you run into problems like this! (You've helped me many times here). Thanks for the clear question post.Kohinoor
I am having the same problem. The files exist, the folders exit, the paths are set. Delphi says it can't find a package. Either it dislikes the DCP file, the BPL file, or the folder/path configuration. Lovely.Titanomachy
M
14

Either the package can't be found, or the compiler is confused. In the later case, a restart sometimes helps. Then a manual build from all packages in order.

If it really can't be found, check if all package (bpl and dcp) and dcu files are available. You need both.

Maxima answered 18/4, 2009 at 19:41 Comment(4)
That turned out to be the problem. I needed to tell it where to find the DCP file too.Matronize
Struggled with that one once.Maxima
having this problem now with a DCP file that exists but something else is unsettling delphi and it won't read the DCP file, no amount of restart will help, or rebuild.Titanomachy
Why this answer is accepted as an answer?Holophytic
G
9

If this happens when the IDE is trying to load a package: your package output directory (where the *.bpl files go) has to be on your system's PATH environment variable. Packages are statically linked DLLs, Windows has to be able to find them to load them.

If this happens when building the packages: any/all of your DCP output directories (where the *.dcp files go) have to be in the dependent projects' search path so that the compiler can find the compiled packages. You can also leave the DCP output directory of the package project empty - in which case the global DCP output directory set in Tools\Options\Library is used; the dependent projects then don't need to include it in their search path.

Greeley answered 18/4, 2009 at 19:55 Comment(1)
Wow, a BPL folder NOT in your path. The IDE should whine about this.Titanomachy
C
3

It is possible that the name of the required package is incorrectly specified in the 'requires' clause of the package you are trying to compile. Let's take an example:

We have two packages - VirtualTreesR.dpk and VirtualTreesD.dpk. VirtualTreesD requires VirtualTreesR. They both have the '16' suffix, so they both are displayed in the Delphi project manager window as VirtualTreesR16.bpl and VirtualTreesD16.bpl. You may think that these are the names of the packages, but you are wrong. The names of the packages are still VirtualTreesR and VirtualTreesD, not VirtualTreesR16 and VirtualTreesD16.

When VirtualTreesR.dpk is compiled Delphi produces two files (I don't talk about DCUs here) VirtualTreesR*16*.bpl and VirtualTreesR.dcp. See the difference?

Then we attempt to compile VirtualTreesD.dpk and get the error: "[DCC Fatal Error] VirtualTreesD.dpk(35): E2202 Required package 'VirtualTreesR16' not found".

The error happens because the 'requires' clause of the VirtualTreesD.dpk package contains the following lines:


    requires
      designide,
      VirtualTreesR16;

Delphi tries to find VirtualTreesR16.dcp and fails even if the Delphi search path and the PATH environment variable are set correctly because there is no VirtualTreesR16.dcp. Only VirtualTreesR.dcp.

The solution is to fix the 'requires' clause so it will look like the one below:


    requires
      designide,
      VirtualTreesR;

Hope it helps.

P.S. This a quite frustrating issue because this name mismatch is not obvious and its fragments are scattered across different settings. Delphi could be more specific if it specified what file exactly it tried to find (e.g. 'VirtualTreesR.dcp' instead of 'VirtualTreesR').

Calx answered 3/4, 2013 at 8:51 Comment(0)
D
2

I would check to make sure where you are writing the .dcp files for the packages. once you have this, check that the search path of each package has an entry for the .dcp output folder.

Derringer answered 18/4, 2009 at 19:45 Comment(0)
V
1

For me, this error happened when package "A" was built using 32 bit, but package "B" (which requires package "A") was trying to build using 64 bit.

The DCP and BPL files were all there (just in the wrong architecture), so the error message was very confusing.

Vlad answered 26/6, 2023 at 10:7 Comment(0)
A
0

I sometimes receive the "package not found" error when adding required packages via the Delphi Project Manager context menu. (Open a package, right click "Requires", choose "Add Reference..." command)

Instead it's easier to add the required package by editing the package project file manually:

  1. Select the package in the Project Manager. MyPackage.bpl for example.
  2. Ctrl+V to open the project file.
  3. Add the required package to the requires clause.
  4. Ensure the required package *.DCP file is in the package search path.
Adequacy answered 10/11, 2017 at 4:56 Comment(1)
"package search path" - Where is this option in the IDE?Rumpus
H
-1

Official Delphi advice for this case (from related page at DocWiki) is to check existence of folder with related *.dcp file in a Library path option. And obviously fix it.

Holophytic answered 21/12, 2023 at 10:8 Comment(7)
Nashev, a link to a solution is welcome, but please ensure your answer is useful without it: add context around the link so your fellow users will have some idea what it is and why it is there, then quote the most relevant part of the page you are linking to in case the target page is unavailable. Answers that are little more than a link may be deleted.Crosslink
mozway, If you look carefully, my answer have all what you requested. I feel no need any additional text there.Holophytic
I'm not familiar with this topic, but what I read is "the following link contains advice". I have the feeling that if the link should become inaccessible, then one couldn't understand what needs to be done to answer the original question "How do I tell B and C where to find A so they'll build correctly?"Crosslink
I wrote further "to check existence of folder with related *.dcp file in a Library path." It is an essence of that advice, so no need go by the link to understand it.Holophytic
Well, you say what will be in the link, not how to solve the issue without reading the link, which is what should be done here.Crosslink
It is exactly is "how to solve". Check a Library path. And obviously fix it.Holophytic
it is NOT a link-only answer, why you all doesn't see it here?! Essentials parts ARE included and they was included. A have rewrote it. May be now it is clear enough?Holophytic

© 2022 - 2024 — McMap. All rights reserved.