Lazarus

Programming => Packages and Libraries => Topic started by: Josh on July 05, 2017, 07:36:51 pm

Title: Abbrevia on Linux Ubunto compile error
Post by: Josh on July 05, 2017, 07:36:51 pm
Hi
Thought i would start playing with Ubuntu
When I try to install Abbrevia I get error
AbCharSet.pas(271,21) error Identifier not found "nl_langinfo"
(271,33) identifier not found "_nl_ctype_codeset_name"

Anyone else had this error, and know a fix ?
Title: Re: Abbrevia on Linux Ubunto compile error
Post by: fmolina on October 27, 2017, 08:58:57 pm
Hi all,

The same happens in a fresh install of Lazarus 1.8RC5:
Quote
AbCharset.pas(271,21) Error: Identifier not found "nl_langinfo"
AbCharset.pas(271,33) Error: Identifier not found "_NL_CTYPE_CODESET_NAME"
Any hint?
Title: Re: Abbrevia on Linux Ubunto compile error
Post by: fmolina on October 27, 2017, 09:00:30 pm
Forgot: Lazarus 1.8RC5 on Mageia linux 6 x64
Title: Re: Abbrevia on Linux Ubunto compile error
Post by: marcov on October 27, 2017, 11:03:57 pm
Sounds like that package is 32-bit only, and was never fully ported from Kylix
Title: Re: Abbrevia on Linux Ubunto compile error
Post by: fmolina on November 03, 2017, 07:31:39 pm
The package compiles OK in windows, even with 64 bits lazarus/fpc. It does not compile in linux, neither 32 nor 64 bits
Title: Re: Abbrevia on Linux Ubunto compile error
Post by: marcov on November 03, 2017, 07:44:03 pm
The package compiles OK in windows, even with 64 bits lazarus/fpc. It does not compile in linux, neither 32 nor 64 bits

My point was that the old Kylix compiler used those identifiers a lot, to manually figure out locale issues. Free Pascal is much more circumspect with such raw system imports since it has to work on multiple *nix OSes.

This is partially abstracted for Lazarus in units clocale and cwstring, and clocale defines at least nl_langinfo. Cwstring uses codeset internally, so that means that the information is maybe available somewhere in a portable way. (cwstrin is an unix specific "engine"/manager for unicode related stuff).

I quickly searched, and it seems to be used to fill defaultsystemcodepage (https://www.freepascal.org/docs-html/rtl/system/defaultsystemcodepage.html), so that might be what you want.

Title: Re: Abbrevia on Linux Ubunto compile error
Post by: Jurassic Pork on December 08, 2017, 01:51:43 am
hello,
in AbCharSet.pas i have replaced the code in error with this :
Code: Pascal  [Select][+][-]
  1.   {$IFDEF LINUX}
  2.    if DefaultSystemCodePage = CP_UTF8 then Result := True;
  3.   {$ENDIF}
package Abbrevia successfully compiled and installed on Lubuntu 16.04  64 bits  (Lazarus 1.8RC3).

Example of use :
with this code :
Code: Pascal  [Select][+][-]
  1. implementation
  2. uses AbZipper,AbZipTyp,AbUtils;
  3. {$R *.lfm}
  4. { TForm1 }
  5. procedure TForm1.Button1Click(Sender: TObject);
  6. var
  7.   Zip : TAbZipper;
  8.   x: Integer;
  9. begin
  10.    Zip := TAbZipper.Create(Application);
  11.    Zip.ArchiveType := atZip;
  12.    Zip.FileName := '/tmp/testAbbrevia.zip';
  13.    Zip.AddFiles('/home/jurassic/tmp/*',1);
  14.    Zip.ZipfileComment := 'Abbrevia test';
  15.    Zip.CompressionMethodToUse := smBestMethod;
  16.    zip.DeflationOption := doMaximum;
  17.    zip.Save;
  18.    Memo1.Clear;
  19.    Memo1.Lines.Append('Number of Files : ' + InttoStr(zip.Count));
  20.    Memo1.Lines.Append('-----------------------------------------');
  21.    For x:= 0 to zip.count - 1 do
  22.    begin
  23.    Memo1.Lines.Append('File : ' + zip.Items[x].FileName);
  24.    Memo1.Lines.Append('Uncompressed Size : ' +
  25.                       InttoStr(zip.Items[x].UncompressedSize));
  26.    Memo1.Lines.Append('Compression Ratio : ' +
  27.                       FloattoStr(zip.Items[x].CompressionRatio));
  28.    Memo1.Lines.Append('Compressed Size : ' +
  29.                       InttoStr(zip.Items[x].CompressedSize));
  30.    Memo1.Lines.Append('CRC32 : ' + Inttohex(zip.Items[x].CRC32,8));
  31.    memo1.Lines.Append('======================================');
  32.    end;
  33.    zip.CloseArchive;
  34. end;

i get what you can see in the attachment.

Friendly, J.P

Title: Re: Abbrevia on Linux Ubunto compile error
Post by: fmolina on December 27, 2017, 03:52:02 pm
Hi J.P.,

Your fix worked OK for me, thanks!

Best
TinyPortal © 2005-2018