6

I am trying to resolve a problem with a set of packages that apparently have dependency issues. Occasionally during a Build All, I get this error:

Delphi "E2161 Error: RLINK32: Error opening file ________.drf "

What does it mean / indicate, and what is a "drf" file?

Community
  • 1
  • 1
Jamo
  • 3,238
  • 6
  • 40
  • 66

5 Answers5

4

It looks like this turned out to be the main problem / solution.

Open up all the packages for which you have source code, and specify the compile option: 'Rebuild explicitly' instead of 'Rebuild when needed'.

Steve Mayne
  • 22,285
  • 4
  • 49
  • 49
Jamo
  • 3,238
  • 6
  • 40
  • 66
  • there are some logical reasons for the "rebuild as needed", especially when you do have the source. Imagine working on a multi-project application with packages where you quite often modify a unit in some package. It's nice to have the IDE recompile the package for you instead of you remembering to rebuild it yourself every time. – ciuly Mar 02 '14 at 13:40
4

In addition to the Solving the 'cannot find drf file' problem when compiling packages article, I also came across Delphi bug report #44134, in which a commenter mentions that the problem stems from having your .dpk files in the same directory as your .pas files when that same directory is in the library path and "rebuild as needed" is enabled.

You thus have three options for fixing this problem:

  • Turn off "rebuild as needed". This seems to be the most common solution.
  • Put your package files (*.dpk, *.dproj) into a separate directory and then reinstall the packages. I have done this, with success.
  • Remove the directory containing your .dpk and .pas files from the library path. Note that Delphi will add it back again in certain circumstances, including when you install/reinstall your package.
asciiphil
  • 519
  • 4
  • 17
  • Very helpful / good to know -- thanks for the info. (Sounds like we've been down similar paths). – Jamo Oct 23 '09 at 00:51
  • instead of moving out the project files, since I am already building the dcus and all in a Lib folder, I modified the IDE library path and removed my package path from there. Delphi keeps adding it when you "install" a package. And apparently in some other scenarios as well... – ciuly Mar 02 '14 at 13:27
  • 1
    it's a weird feeling when you bump into a problem once in a year or two, google it up and find that you actually found a solution for it, yourself. What's the cure for bad memory? – ciuly Feb 26 '16 at 14:51
  • WayBack Machine link for "[Solving the 'cannot find drf file' problem when compiling packages](https://web.archive.org/web/20151203053304/http://www.components4programmers.com/articles/solvingthecannotfinddrffileprobl.htm)" – mcdon Jun 10 '16 at 13:37
2

Hmm... never heard of them. I just searched the project that inspired the question you linked to, and there's nothing in there with a "DRF" extension. Checking here doesn't turn up anything Delphi-related. But the fact that it's a linker error, not a compiler error, would lead me to guess that the first two letters stand for "Delphi Resource."

Try a search through your project's directory tree and see if you can find anything with a DRF extension. If so, try opening it with a text editor to see if it's readable, and if not, try a hex editor if you know anything about reading binary file formats. See if you can make any sense of it.

If you don't find any, then Delphi's probably getting it from somewhere in the code it's compiling. Try running a grep search for "DRF" on your directory tree and see if it turns up anything.

Mason Wheeler
  • 82,511
  • 50
  • 270
  • 477
2

From http://www.delphifaq.com/faq/delphi/delphi_ide/f157.shtml :

When you compile with packages, you can specify which packages should be considered for linkage. The package requirements of the project get stored into a temporary Windows resource file with a .DRF extension.

Whatever that file with the many underscores is, the linker is most probably searching it in what it thinks the tempdirectory is (you can confirm this using filemon). The explanation at DelphiFaq, where a misdefined %TEMP% is the culprit, is as likely as any reason.

Paul-Jan
  • 16,746
  • 1
  • 63
  • 95
  • The DelphiFAQ error occurs when writing .drf files. The problem described above is an error opening the file. (And is apparently a known, long-running Delphi bug.) – asciiphil Sep 30 '09 at 20:17
0

Sometimes the problem was file access permissions.

A workaround was run Delphi as Administrator.

yucer
  • 4,431
  • 3
  • 34
  • 42