Recent

Author Topic: PascalTZ [Solved]  (Read 885 times)

MoCityMM

  • Jr. Member
  • **
  • Posts: 72
PascalTZ [Solved]
« on: February 26, 2020, 04:00:14 pm »
Using:

CentOS 8.1.1911 x64

Getting the following error during install using 'Online Package Manager':

Compile package PascalTZ 2.1.1: Exit code 1, Errors: 1, Warnings: 1
Warning: windres: can't open file `images\pascaltz.png': No such file or directory
pascaltzreg.pas(19,1) Error: Error while compiling resources -> Compile with -vd for more details. Check for duplicates.

MingW64 package(s) are installed (had to enable 'power tools' option on epel to see them).
x86_64-w64-mingw32-windres is installed in 'usr/bin' folder and link is also there 'windres'.

Followed instruction(s) from the following:

https://wiki.freepascal.org/Lazarus_Resources#Linux

Went back and installed the MingW32 package(s) since it was mentioned in the instructions (instructions are out of date? i386-w64-mingw32-windres does not exist).

Produced error message mentioned above.

Edited the 'fpc.cfg', changed reference from ' i386-w64-mingw32-windres' to 'i686-w64-mingw32-windres' (this file exists).

Still same issue.

Downloaded package from 'Online Package Manager', opened it, the file is in PascalTZ/package/images folder.

Is this a bug or a compiler reference missing, etc? Anyone have a fix?

Regards,
-Mo


« Last Edit: February 28, 2020, 03:19:24 am by MoCityMM »

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8373
  • FPC developer.
Re: PascalTZ
« Reply #1 on: February 26, 2020, 04:07:52 pm »
Quote
Warning: windres: can't open file `images\pascaltz.png'

Note the backslash in the path that windres returns. I think the problem is the backslash in that pat, not windres itself.

MoCityMM

  • Jr. Member
  • **
  • Posts: 72
Re: PascalTZ
« Reply #2 on: February 26, 2020, 04:16:57 pm »
marcov,

Thanks for the reply. Yes, the reference '\' is present in the 'pascaltzreg.rc' file.

Are you suggesting modifying the package? I've not done that before (simple process/complicated?).

Regards,
-Mo

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8373
  • FPC developer.
Re: PascalTZ
« Reply #3 on: February 26, 2020, 04:18:52 pm »
.rc is user source. But maybe this case is not very defined. Just try to replace the \ with / in the .rc

MoCityMM

  • Jr. Member
  • **
  • Posts: 72
Re: PascalTZ
« Reply #4 on: February 26, 2020, 04:34:13 pm »
marcov,

Same out come if I understood and followed what you suggested correctly.

Then I attempted the following:

Tried to recreate the package from source and modified the '.rc' file to reference '/' and it compiled, got a different type of error message(dumped directly into code from the 'PascalTZReg.pas' file):

procedure Register;
begin
  RegisterComponents('Misc', [TPascalTZ]);
end;

So at this point I am beyond my skill set to do anymore with it. Shame only had this piece to work on in my code, guess I will look for something different option.   


MoCityMM

  • Jr. Member
  • **
  • Posts: 72
Re: PascalTZ
« Reply #5 on: February 26, 2020, 05:30:34 pm »
Ok... think I got it working. Used the following steps to fix it:

1: Opened 'Online Package Manager'
2: Used 'Local Repo'
3: Modified 'pascaltzreg.rc' file to reference '/'
4: Opened package in IDE under 'Package>Open Package File', and under 'Options' changed the 'Compiler>Paths to 'lib/$(TargetCPU)-$(TargetOS)' from 'lib\$(TargetCPU)-$(TargetOS)'
5: Save
6: Compile
7: Install

Seems to work. Thanks for the lead on the issue marcov.

Regards,
-Mo
 

wp

  • Hero Member
  • *****
  • Posts: 7051
Re: PascalTZ
« Reply #6 on: February 26, 2020, 06:37:15 pm »
I sent a pull request to the author with an idea how to solve the issue without windres (use .res resource instead of .rc).
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

dezlov

  • New Member
  • *
  • Posts: 13
Re: PascalTZ
« Reply #7 on: March 07, 2020, 07:41:51 pm »
I sent a pull request to the author with an idea how to solve the issue without windres (use .res resource instead of .rc).

Thanks. It is merged now.

MoCityMM

  • Jr. Member
  • **
  • Posts: 72
Re: PascalTZ [Solved]
« Reply #8 on: March 15, 2020, 04:45:04 pm »
Just a FYI, I don't know when the repository gets updated so this maybe inapplicable to the quote below.
Thanks. It is merged now.

But the following is what I had to do to get it working on another box:

Steps 4 (minus changing Paths '/' was already there) and Steps 6 - 7.

Regards,
-Mo

dezlov

  • New Member
  • *
  • Posts: 13
Re: PascalTZ [Solved]
« Reply #9 on: March 17, 2020, 11:23:27 pm »
Regarding the step 4:
Quote
Opened package in IDE under 'Package>Open Package File', and under 'Options' changed the 'Compiler>Paths to 'lib/$(TargetCPU)-$(TargetOS)' from 'lib\$(TargetCPU)-$(TargetOS)'

I wonder why was this necessary? Doesn't Lazarus and FPC automatically adjust path delimiters to match the current platform?

The package LPK file contains several PathDelim entries, plus OtherUnitFiles and UnitOutputDirectory entries with Windows style path delimiters. Lazarus even prevents using the Linux style path delimiter in OtherUnitFiles entry, automatically replacing it with the Windows style delimiter.

Snippet from the LPK file:

Code: XML  [Select][+][-]
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <CONFIG>
  3.   <Package Version="4">
  4.     <PathDelim Value="\"/>
  5.     <Name Value="PascalTZ"/>
  6.     <Type Value="RunAndDesignTime"/>
  7.     <Author Value="Denis Kozlov"/>
  8.     <CompilerOptions>
  9.       <Version Value="11"/>
  10.       <PathDelim Value="\"/>
  11.       <SearchPaths>
  12.         <OtherUnitFiles Value="..\source"/>
  13.         <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
  14.       </SearchPaths>
  15.     </CompilerOptions>
  16.  

dezlov

  • New Member
  • *
  • Posts: 13
Re: PascalTZ [Solved]
« Reply #10 on: March 18, 2020, 12:41:06 am »
Quote
Opened package in IDE under 'Package>Open Package File', and under 'Options' changed the 'Compiler>Paths to 'lib/$(TargetCPU)-$(TargetOS)' from 'lib\$(TargetCPU)-$(TargetOS)'

Just tried installing the latest PascalTZ into Lazarus 2.0.6 on Linux Mint and it worked just fine, without having to change any paths in 'Compiler>Paths' section of the package.

wp

  • Hero Member
  • *****
  • Posts: 7051
Re: PascalTZ [Solved]
« Reply #11 on: March 18, 2020, 12:59:48 am »
I think the problem is that MoCityMM installs the package from OPM, and this is outdated. I added a note to my pull request recently which you maybe did not see.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

MoCityMM

  • Jr. Member
  • **
  • Posts: 72
Re: PascalTZ [Solved]
« Reply #12 on: March 18, 2020, 03:03:05 pm »
But the following is what I had to do to get it working on another box:

Steps 4 (minus changing Paths '/' was already there) and Steps 6 - 7.

dezlov,

My message indicated that the pathing statement is correct, didn't need to change a thing on that. Thank you for looking into it though.

-Mo

wp,

Thank you for pointing out that the OPM maybe out of date.

-Mo

dezlov

  • New Member
  • *
  • Posts: 13
Re: PascalTZ [Solved]
« Reply #13 on: March 18, 2020, 08:44:41 pm »
Ok, thanks for confirming.

So the only real issue was with inappropriate path delimiters in the RC file, which was resolved by wp's commit:
https://github.com/dezlov/PascalTZ/commit/2029be6cab7ce7a55704369230922253a5911d7f

It's a pity that Lazarus/FPC don't automatically adjust paths in the RC file the same way as with project paths.

Anyhow, I'll push a new version shortly.

 

TinyPortal © 2005-2018