* * *

Author Topic: Abbrevia on Linux Ubunto compile error  (Read 822 times)

josh

  • Sr. Member
  • ****
  • Posts: 437
Abbrevia on Linux Ubunto compile error
« 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 ?
Development Installation Lazarus 1.3, FPC 2.7.1,Windows 7/8 32/64, OSX, *nix

Test Environment Lazarus & FPC Trunk on Windows and OSX (Cocoa Mainly on OSX). Testing also Crosscompile windows to OSX.. 
Any posts made from 2015 will be based on Lazarus Trunk.

fmolina

  • Newbie
  • Posts: 3
Re: Abbrevia on Linux Ubunto compile error
« Reply #1 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?

fmolina

  • Newbie
  • Posts: 3
Re: Abbrevia on Linux Ubunto compile error
« Reply #2 on: October 27, 2017, 09:00:30 pm »
Forgot: Lazarus 1.8RC5 on Mageia linux 6 x64

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5875
Re: Abbrevia on Linux Ubunto compile error
« Reply #3 on: October 27, 2017, 11:03:57 pm »
Sounds like that package is 32-bit only, and was never fully ported from Kylix

fmolina

  • Newbie
  • Posts: 3
Re: Abbrevia on Linux Ubunto compile error
« Reply #4 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

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5875
Re: Abbrevia on Linux Ubunto compile error
« Reply #5 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, so that might be what you want.


Jurassic Pork

  • Hero Member
  • *****
  • Posts: 656
Re: Abbrevia on Linux Ubunto compile error
« Reply #6 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

« Last Edit: December 08, 2017, 01:57:52 am by Jurassic Pork »

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus