[fpc-pascal] Linux library access violation

2006-10-29 Thread Chris

I get an "Access violation" when I call a function from a C library.

Not sure if I can explain well enough, so I will just post the code:

The C library:
#include 
#include 

int testreturn(const char *thename, char *rcity, char *rstate)
{

memcpy (rcity,"Boston",7);
memcpy (rstate,"Massachusetts",14);

return strlen(thename);
}

The C library is compiled and named libTester.so

The code I call to the function from is:

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
 Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, 
StdCtrls,

 Buttons, StrUtils;

type

 { TForm1 }

 TForm1 = class(TForm)
   Button1: TButton;
   Edit1: TEdit;
   Edit2: TEdit;
   Edit3: TEdit;
   procedure Button1Click(Sender: TObject);
 private
   { private declarations }
 public
   { public declarations }
 end;

var
 Form1: TForm1;
 function testreturn(thename:pchar;rcity:pchar;rstate:pchar):integer; 
stdcall; external 'libTester';


implementation

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
var
   rlines : array[0..1] of string;
   retint : integer;
   ganame : string;
begin
 ganame := Trim(Edit1.Text);
 rlines[0] := StringOfChar('0', 80);
 rlines[1] := StringOfChar('0', 80);
 retint := testreturn(pchar(ganame), pchar(rlines[0]), pchar(rlines[1]));
 Edit2.Text := AnsiLeftStr(rlines[0], pos(Chr(0), rlines[0]) - 1);
 Edit3.Text := AnsiLeftStr(rlines[1], pos(Chr(0), rlines[1]) - 1);
 Form1.Caption := 'Name Length: ' + inttostr(retint);
end;

initialization
 {$I unit1.lrs}

end.

It works well but, I get a message box that pops up that says "Access 
violation" press OK to continue and risk possible data corruption or 
Cancel to exit.


I click OK and its fine. It returns everything correctly. That message 
box is a pain though. I tried:

try
 retint := testreturn(pchar(ganame), pchar(rlines[0]), pchar(rlines[1]));
except
//do something
end;

But the program just quits.

Any help?

Thanks


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Linux library access violation

2006-10-30 Thread Chris

>L505 wrote:
>First thing to check is it declared CDECL or STDCALL in the C library?
>I think the default C declaration mode is CDECL if it is not defined 
explicitely.


I knew it was gonna be the obvious. I changed:
function testreturn(thename:pchar;rcity:pchar;rstate:pchar):integer; 
stdcall; external 'libTester';

to
function testreturn(thename:pchar;rcity:pchar;rstate:pchar):integer; 
cdecl; external 'libTester';


and all is good.

Thank you very much ;)

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] MySQL50 unit in freepascal

2008-04-22 Thread Chris
Hi,

I am a newbie in freepascal but I have used turbo pascal and Delphi
extensively for the last 7 years or so; I want to write an application for
my linux box to do some crude form of replication of mysql databases. I am
just trying to figure out how to use the mysql50 unit, but cannot find heads
or tails of how to do it; it seems all version have different connecting
methods etc etc etc

Does anyone have a simple (very simple) and basic way of connecting to a
mysql database, reading a record and writing a record into a table? That's
all I need to get started; or if there is some documentation somewhere on
how to use the unit id be grateful.

J

PO Box 627 00502 Karen, 
Nairobi, Kenya.
Mobile: +254 722 996532


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


RE: [fpc-pascal] MySQL50 unit in freepascal

2008-04-22 Thread Chris
Thanks,

Where can I get these classes?

PO Box 627 00502 Karen, 
Nairobi, Kenya.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Michael Van
Canneyt
Sent: 22 April 2008 1:52 p
To: FPC-Pascal users discussions
Subject: Re: [fpc-pascal] MySQL50 unit in freepascal



On Tue, 22 Apr 2008, Chris wrote:

> Hi,
> 
> I am a newbie in freepascal but I have used turbo pascal and Delphi
> extensively for the last 7 years or so; I want to write an application for
> my linux box to do some crude form of replication of mysql databases. I am
> just trying to figure out how to use the mysql50 unit, but cannot find
heads
> or tails of how to do it; it seems all version have different connecting
> methods etc etc etc
> 
> Does anyone have a simple (very simple) and basic way of connecting to a
> mysql database, reading a record and writing a record into a table? That's
> all I need to get started; or if there is some documentation somewhere on
> how to use the unit id be grateful.

The easiest is to use the TMySQLConnection class and TSQLQuery.
It takes care of most of the details, and uses standard mechanisms
to read/write data.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


RE: [fpc-pascal] MySQL50 unit in freepascal

2008-04-22 Thread Chris
Also please note that I am writing a daemon that will be cron'd so I wont be
using lazarus. Let me see what I can come up with. Thanks all.

PO Box 627 00502 Karen, 
Nairobi, Kenya.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Chris
Kirkpatrick
Sent: 22 April 2008 3:24 p
To: FPC-Pascal users discussions
Subject: Re: [fpc-pascal] MySQL50 unit in freepascal

You may find some useful information in the Lazarus Wiki. See the 
following pages and browse for others:

http://wiki.lazarus.freepascal.org/Lazarus_Database_Tutorial
http://wiki.lazarus.freepascal.org/MySQLDatabases
http://wiki.lazarus.freepascal.org/Databases
http://wiki.lazarus.freepascal.org/Lazarus_DB_Faq

Regards - Chris

Michael Van Canneyt wrote:
> On Tue, 22 Apr 2008, Chris wrote:
>
>   
>> Thanks,
>>
>> Where can I get these classes?
>> 
>
> Directories
>
>  packages/fcl-db/src/sqldb
>
> and below.
>
> Michael.
>
>   
>> PO Box 627 00502 Karen, 
>> Nairobi, Kenya.
>>
>> -Original Message-
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of Michael Van
>> Canneyt
>> Sent: 22 April 2008 1:52 p
>> To: FPC-Pascal users discussions
>> Subject: Re: [fpc-pascal] MySQL50 unit in freepascal
>>
>>
>>
>> On Tue, 22 Apr 2008, Chris wrote:
>>
>> 
>>> Hi,
>>>
>>> I am a newbie in freepascal but I have used turbo pascal and Delphi
>>> extensively for the last 7 years or so; I want to write an application
for
>>> my linux box to do some crude form of replication of mysql databases. I
am
>>> just trying to figure out how to use the mysql50 unit, but cannot find
>>>   
>> heads
>> 
>>> or tails of how to do it; it seems all version have different connecting
>>> methods etc etc etc
>>>
>>> Does anyone have a simple (very simple) and basic way of connecting to a
>>> mysql database, reading a record and writing a record into a table?
That's
>>> all I need to get started; or if there is some documentation somewhere
on
>>> how to use the unit id be grateful.
>>>   
>> The easiest is to use the TMySQLConnection class and TSQLQuery.
>> It takes care of most of the details, and uses standard mechanisms
>> to read/write data.
>>
>> Michael.
>> ___
>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
>>
>> ___
>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
>> 
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>   
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


RE: [fpc-pascal] Farewell

2008-05-05 Thread Chris
Why don't you "just code in pascal" any more? I hope you haven't moved to
another language. Farewell!

PO Box 627 00502 Karen, 
Nairobi, Kenya.
Mobile: +254 722 996532
Fixed: +254 20 2050859
[EMAIL PROTECTED] 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Matt Emson
Sent: 02 May 2008 11:16 a
To: FPC-Pascal users discussions
Subject: [fpc-pascal] Farewell

After almost 10 years of being on this list (FPC was at about 0.9x when 
I joined), it occurs to me that I just don't code in Pascal any more and 
don't foresee doing so again. I do read messages, but more from a 
nostalgic point of view. So, I'm going to leave the list.  This will be 
a two stage operation. Step 1, this list address will become SPAM in 
Thunderbird. Stage 2, when I get a chance to I will unsubscribe. At any 
rate, I'll no longer post or respond to  messages from today onwards.

It's been a fun Journey. FPC is a fine compiler. I wish you all good 
luck, and bid you farewell!

M
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] assigning a local function to a var

2008-07-09 Thread Chris Cheney
> I'd like to store an address of a local function in a variable, and
> call that local function, but I don't know how to define a variable of
> type "local function". Here's the error I'm stuck on, with sample
> code: 

"One can assign the following values to a procedural type variable:
1. Nil, for both normal procedure pointers and method pointers.
2. A variable reference of a procedural type, i.e. another variable of 
the same type.
3. A global procedure or function address, with matching function or 
procedure header and calling
convention.
4. A method address."

[reference manual
ftp://ftp.freepascal.org/pub/fpc/docs-pdf/ref.pdf
page 38]

Note "A GLOBAL procedure or function ... "

This is for a reason - think what would happen if you were able to a 
local procedure to a global variable!

FWIW the same is true of Delphi.

HTH
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Compiler error

2009-01-25 Thread Chris Kirkpatrick
I have recently been getting the following error when tring to compile 
fpc using the standard sequence:

svn update fpc
make clean
make all
I tried deleting my complete fpc repository and checking out again; same 
thing happened.

Currently using SVN r12590.
Is this a known problem, should I report it as a bug, or am I doing 
something wrong?

Chris

... last few lines of compilation:

/home/kirkpatc/FreePascal/fpc/trunk/compiler/ppc386 -XX -CX -Ur -Xs -O2 
-n -S2h -Fu/home/kirkpatc
/FreePascal/fpc/trunk/rtl/units/i386-linux 
-Fu/home/kirkpatc/FreePascal/fpc/trunk/packages/fcl-ba
se/units/i386-linux 
-Fu/home/kirkpatc/FreePascal/fpc/trunk/packages/iconvenc -FE. 
-FUunits/i386-l
inux -Fl/usr/lib/gcc/i486-linux-gnu/4.3.2 -Flinclude 
-Fl/etc/ld.so.conf.d/*.conf -Fl/usr/lib/jvm/

java-6-sun-1.6.0.00/jre/lib/i386/jli -di386 -dRELEASE src/sax_xml.pp
/home/kirkpatc/FreePascal/fpc/trunk/compiler/ppc386 -XX -CX -Ur -Xs -O2 
-n -S2h -Fu/home/kirkpatc
/FreePascal/fpc/trunk/rtl/units/i386-linux 
-Fu/home/kirkpatc/FreePascal/fpc/trunk/packages/fcl-ba
se/units/i386-linux 
-Fu/home/kirkpatc/FreePascal/fpc/trunk/packages/iconvenc -FE. 
-FUunits/i386-l
inux -Fl/usr/lib/gcc/i486-linux-gnu/4.3.2 -Flinclude 
-Fl/etc/ld.so.conf.d/*.conf -Fl/usr/lib/jvm/

java-6-sun-1.6.0.00/jre/lib/i386/jli -di386 -dRELEASE src/xmliconv.pas
Fatal: Can't find unit iconvenc used by xmliconv
Fatal: Compilation aborted
make[4]: *** [xmliconv.ppu] Error 1
make[4]: Leaving directory 
`/home/kirkpatc/FreePascal/fpc/trunk/packages/fcl-xml'

make[3]: *** [fpc_smart] Error 2
make[3]: Leaving directory 
`/home/kirkpatc/FreePascal/fpc/trunk/packages/fcl-xml'

make[2]: *** [fcl-xml_smart] Error 2
make[2]: Leaving directory `/home/kirkpatc/FreePascal/fpc/trunk/packages'
make[1]: *** [packages_smart] Error 2
make[1]: Leaving directory `/home/kirkpatc/FreePascal/fpc/trunk'
make: *** [build-stamp.i386-linux] Error 2

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Compiler error

2009-01-25 Thread Chris Kirkpatrick



Jonas Maebe wrote:


On 25 Jan 2009, at 11:43, Chris Kirkpatrick wrote:

I have recently been getting the following error when tring to 
compile fpc using the standard sequence:

svn update fpc
make clean
make all
I tried deleting my complete fpc repository and checking out again; 
same thing happened.

Currently using SVN r12590.
Is this a known problem, should I report it as a bug, or am I doing 
something wrong?


It was a known problem after r12587. I've fixed it now.


Jonas


Thanks - fine now
Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Problems with Lazarus documentatin using FPDoc and LazDE

2007-10-17 Thread Chris Kirkpatrick
I am trying to create documentation for Lazarus lcl, by providing XML
files suitable for  input to FPDoc

I have looked at some of the HTML output of Controls and Forms (following
the changes to links made by Vincent Snijders), and find that they are not
pointing to the page I expected.

For example, a link from 'Controls.TCustomControl.Canvas' to
'Graphics.TCanvas' causes the Index page of 'Graphics' to be loaded,
rather than the description of TCanvas. On the other hand, the hyperlink
from the type-specification 'TCanvas' in the property definition points
correctly to the page where TCanvas is described

I believe that links to any identifier within the LCL need only contain
the name of the identifier, without the path to the unit where they are
defined; it is only when the link points to something in the RTL or FCL
that we should have to specify a more extended path (such as
#rtl.sysutils.  etc).

I may of course be wrong, and the FPDoc manual suggests that the Unit
name must be inserted, but this seems to produce the undesired effect I
mentioned above - ie the hyperink takes us to the Index page for the
Unit. I would welcome any advice about how best to achieve the links
that I desire.

Vincent reports that when I omit the Unit prefix from the link, he gets
reports from FPDoc such as:

> Warning: Target ID of  is unknown: "TFormStyle"
> Warning: Target ID of  is unknown: "TMainMenu"
> Warning: Target ID of  is unknown: "TCustomControl"
> Warning: Target ID of  is unknown: "TWinControl"
> Warning: Target ID of  is unknown: "TControl"


Regards - Chris

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Help getting started with FPC

2007-11-30 Thread Chris Kirkpatrick

I suggest you look at the FPC/Lazarus Wiki
http://wiki.freepascal.org/
for ideas to get you started.

It may be easier to start programmng using either the FPC IDE which 
comes with the FPC package, or the Lazarus IDE which can be used either 
to produce Windowed GUI applications or simple Pascal console-mode programs.


The FPC manuals at
http://www.freepascal.org/docs.html
contain a lot of information to get you going

You will find the FreePascal/Lazarus community very supportive, eg in 
this mailing list. I have very rarely seen the comment 'RTFM', though 
people very often offer links to suitable places to get information.


Hope this helps
Regards - Chris


Edward Kearns wrote:
I am new to FPC, and can't get started. I have used Think Pascal, and 
I seem to have quite a hurdle here. Someone else told me that I need 
to start XCode first. I did that, then I chose a template (FPC Carbon 
Application 2.2.0). Then I didn't know how to enter code, so I opened 
start.pas, entered some code, tried to do "build and run," "compile," 
and none of these ran my simple code. what am I missing?


Ed
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Notice: Possible copyright infringements in FPC code base

2008-01-05 Thread Chris Kirkpatrick



Michael Van Canneyt wrote:

Hello,


So this is one area where you, our users, can make a big difference and help us
in preventing this from happening in the future, as well as with notifying us as
soon as possible when it does happen (or when you know it happened in the past).
Most importantly: please ensure that you *never* submit patches based on code 
copyrighted by third parties.


For the FPC Team,

Michael.


  
On browsing through the code of 
$FPCdir/packages/fcl-db/src/dbase/dbf.pas I came across the following 
(line 20-22)


// If you got a compilation error here or asking for dsgnintf.pas, then 
just add

// this file in your project:
// dsgnintf.pas in 'C: \Program 
Files\Borland\Delphi5\Source\Toolsapi\dsgnintf.pas'


Should this be removed? Does it infringe copyright? Is it even useful?
Regards - Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: FCL-DB/SQLDB docs started

2008-01-23 Thread Chris Kirkpatrick

Hi John, Joost and Adrian -

As you might know, I have been trying to get the documentation for parts 
of the Lazarus Component Library (LCL) into shape, mainly by putting 
information into the .XML files associated with each Unit, to enable 
generation of .HTML files using FPDoc. Quite a few elements in the LCL 
are now documented to the stage that useful information appears as 
on-line hints when using the Lazarus IDE.


I have started trying to describe some of the Data-Aware components (see 
the DataAccess and Data Control tabs in the Component Palette) but am 
having to delve deeply into the SQLDb and Db files in the FCL in order 
to get information to describe the use of these components. So I should 
very much like to collaborate with you guys in improving the 
documentation of sqldb and fc-db, as well as the stuff in the LCL. I 
agree we should try to use the FPDoc approach as suggested by Joost.


I have been given commit access to the /docs/xml/lcl/ directory in the 
lazarus SVN tree. At present the SQLDb and fcl-db documentation files 
would not appear in that pathway, and we would need to find some way of 
sharing our work on the files - perhaps we need to find a branch of SVN 
to which some or all of us gain access.


I am copying this communication to the lazarus developers list, as they 
are the guys with write-access to the appropriate SVN repositories, and 
may be able to offer suggestions on how best to proceed. I am also 
copying it to the main lazarus mailing list, in the hope that more 
volunteers may emerge!


Please keep in touch and keep the impetus going.

Regards - Chris

John wrote:

Adrian Maier wrote:
Are there any people still interested in making it possible to have 
some real

docs for sqldb and fcl-db ?

If so, let's organize ourselves and see what needs to be done .  I am 
very
interested in the subject but I can't do it myself alone :   if I 
knew enough

about sqldb I wouldn't be so unhappy about the lack of documentation .

  

Hi Adrian,

I am also.

cheers,
John Sunderland
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: FCL-DB/SQLDB docs started

2008-01-23 Thread Chris Kirkpatrick
Yes please, an empty skeleton would be a very useful start. I can send 
you patches when I have made changes to the XMLs.

Regards - Chris

Joost van der Sluis wrote:

As fcl-db and sqldb are parts of fpc, the documenatation should be in
the fpc-docs-repository. I have full write access there so at first I
can commit any changes. I have an (almost empty) framework ready. I you
want I can commit that, so you guys have something to start with.

Joost.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

  

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: FCL-DB/SQLDB docs started

2008-01-25 Thread Chris Kirkpatrick
As far as I can see, there are no files relevant to fc-db or SQLDb in 
this repository. Have you committed your skeleton XMLs yet? If so, in 
which subdirectory?

Regards - Chris

Joost van der Sluis wrote:

As fcl-db and sqldb are parts of fpc, the documenatation should be in
the fpc-docs-repository. I have full write access there so at first I
can commit any changes. I have an (almost empty) framework ready. I you
want I can commit that, so you guys have something to start with.
  

What's  the URL of the fpc-docs-repository ?



http://svn.freepascal.org/svn/fpcdocs

Joost.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

  

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: FCL-DB/SQLDB docs started

2008-02-04 Thread Chris Kirkpatrick

Hi Joost -
Would you have time to do the same for SQLDb? Otherwise, should I do a 
MakeSkel and send you a zipped file to commit?
I have already started work on Db, but the two units depend heavily upon 
each other.

Regards - Chris

Joost van der Sluis wrote:

Op vrijdag 25-01-2008 om 23:59 uur [tijdzone +], schreef Chris
Kirkpatrick:
  
As far as I can see, there are no files relevant to fc-db or SQLDb in 
this repository. Have you committed your skeleton XMLs yet? If so, in 
which subdirectory?



I just did, revision 373, in the root you can find db.xml.

Joost

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

  

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: FCL-DB/SQLDB docs started

2008-02-04 Thread Chris Kirkpatrick
OK - speaking a bit loosely! When trying to untangle database stuff, I 
need to refer to both Units.

Sorry - Chris

Michael Van Canneyt wrote:

On Mon, 4 Feb 2008, Chris Kirkpatrick wrote:

  

Hi Joost -
Would you have time to do the same for SQLDb? Otherwise, should I do a
MakeSkel and send you a zipped file to commit?
I have already started work on Db, but the two units depend heavily upon each
other.



Strange that you say this. DB does not depend on any of the SQLDB units ?

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


 

  

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] MySQL50 unit in freepascal

2008-04-22 Thread Chris Kirkpatrick
You may find some useful information in the Lazarus Wiki. See the 
following pages and browse for others:


http://wiki.lazarus.freepascal.org/Lazarus_Database_Tutorial
http://wiki.lazarus.freepascal.org/MySQLDatabases
http://wiki.lazarus.freepascal.org/Databases
http://wiki.lazarus.freepascal.org/Lazarus_DB_Faq

Regards - Chris

Michael Van Canneyt wrote:

On Tue, 22 Apr 2008, Chris wrote:

  

Thanks,

Where can I get these classes?



Directories

 packages/fcl-db/src/sqldb

and below.

Michael.

  
PO Box 627 00502 Karen, 
Nairobi, Kenya.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Michael Van
Canneyt
Sent: 22 April 2008 1:52 p
To: FPC-Pascal users discussions
Subject: Re: [fpc-pascal] MySQL50 unit in freepascal



On Tue, 22 Apr 2008, Chris wrote:



Hi,

I am a newbie in freepascal but I have used turbo pascal and Delphi
extensively for the last 7 years or so; I want to write an application for
my linux box to do some crude form of replication of mysql databases. I am
just trying to figure out how to use the mysql50 unit, but cannot find
  

heads


or tails of how to do it; it seems all version have different connecting
methods etc etc etc

Does anyone have a simple (very simple) and basic way of connecting to a
mysql database, reading a record and writing a record into a table? That's
all I need to get started; or if there is some documentation somewhere on
how to use the unit id be grateful.
  

The easiest is to use the TMySQLConnection class and TSQLQuery.
It takes care of most of the details, and uses standard mechanisms
to read/write data.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

  

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] XML from a site

2015-07-16 Thread Chris Moody

Hi all,

Currently working on an app which needs to be able to read an XML from a 
website. Looking at the page at http://wiki.freepascal.org/XML_Tutorial 
it appears there is no way to get XML directly from a URL.


Do I need to pull the page down via :


function GetWebPageContent(const Url: string): String;
var fs: TStringList; HTTP: THTTPSend;
begin
   fs := TStringList.Create;
   HTTP := THTTPSend.Create;
   try
  HTTP.HTTPMethod('GET', Url);
  fs.LoadFromStream(Http.Document);
  Result := fs.Text;
   finally
  fs.Free;
  http.Free;
   end;
end;

Or is there a way to pass an URL to ReadXMLFile?

Thanks in advance!

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] another xml question

2015-07-24 Thread Chris Moody

Hi all,

For the app I'm writing, it will have 3 elements in the XML document it 
reads. The first 2 will only have one child element. The third one will 
be from 1 to whatever.


I'm also designing the app that will create the XML file for the app to 
read also, so a couple of questions:


Would it be easiest to introduce a fourth element to the XML that says 
how many children the 3rd element has? Or is there an easy way already 
to get this and just run a for next loop to read each child?


Thanks in advance!

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] another xml question

2015-08-06 Thread Chris Moody

Hi Marc,

Thanks for the feedback. One more question and I think I'm done for now 
and able to finish the program I'm writing:


If FindNode does not locate a node with the given name, what does it 
return?


Thanks,

Chris

On 07/24/2015 01:34 PM, Marc Santhoff wrote:

On Fr, 2015-07-24 at 11:57 -0700, Chris Moody wrote:


Would it be easiest to introduce a fourth element to the XML that says
how many children the 3rd element has? Or is there an easy way already
to get this and just run a for next loop to read each child?

Maybe sth. like this would do:


1>/child>
2>/child>
3>/child>


or similar. Besides making the count an attribute of the root node of
counted elements you could simply use a standard pascal loop:

n: XMLNode;

{ this is only pseude code ... }
while (xmldoc.hasMoreChilds()) do begin
n := getChild();
... process n ...
end:

For real code http://wiki.freepascal.org/XML_Tutorial mwill help.

HTH,
Marc



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Read JSON from file

2015-08-06 Thread Chris Moody

Hi all,

For my current project, I download a file from a server that contains 
JSON code. I'm not sure how to read it into something that GetJSON is 
able to handle.


My first thought was using TStrings, however not sure how to convert a 
TString into TStream.


Any assistance would be much appreciated.

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Read JSON from file

2015-08-07 Thread Chris Moody

On 08/06/2015 07:01 PM, leledumbo wrote:

I download a file from a server that contains JSON code. I'm not sure how

to read it into something that GetJSON is able to handle.

Can't you figure out from the function interface:
http://www.freepascal.org/docs-html/fcl/fpjson/getjson.html


Dentist.pas(56,18) Error: Incompatible type for arg no. 1: Got 
"TStringList", expected "TStream"


This is what I get when I use:

function ReadJSON (jsonfile, node:string) : string;
var
   json: tStringlist;
   J: TJSONData;
begin
  json:=TStringList.Create;
  json.loadfromfile(jsonfile);
  J:=GetJSON(json);// Error is here.
  ReadJSON := J.FindPath(node).AsString;
end;

Does this mean my Lazarus / FPC is out of date? Or I'm using the wrong 
library or something?


Chris

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Read JSON from file

2015-08-07 Thread Chris Moody



On 08/07/2015 12:46 AM, Michael Van Canneyt wrote:



On Fri, 7 Aug 2015, Chris Moody wrote:


On 08/06/2015 07:01 PM, leledumbo wrote:
I download a file from a server that contains JSON code. I'm not 
sure how

to read it into something that GetJSON is able to handle.

Can't you figure out from the function interface:
http://www.freepascal.org/docs-html/fcl/fpjson/getjson.html


Dentist.pas(56,18) Error: Incompatible type for arg no. 1: Got 
"TStringList", expected "TStream"


This is what I get when I use:

function ReadJSON (jsonfile, node:string) : string;
var
  json: tStringlist;
  J: TJSONData;
begin
 json:=TStringList.Create;
 json.loadfromfile(jsonfile);
 J:=GetJSON(json);// Error is here.
 ReadJSON := J.FindPath(node).AsString;
end;

Does this mean my Lazarus / FPC is out of date? Or I'm using the 
wrong library or something?


GetJSON doesn't allow a Tstrings argument. Where did you get that from ?

Please check the sample code I sent.

Michael.


I do apologize, I was looking at a web page and found I didn't read it 
well enough. Thanks for your code suggestion, I will see about making it 
work for me.


Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Copy TJSonArray to Array

2015-08-12 Thread Chris Moody

Hi all,

First off thanks to all who have provided help over the past few weeks, 
I just have one last thing I'm trying to unravel (that I know of 
currently) and this project should be done.


The JSON feed I'm reading will have 2 arrays in it, would it be best to 
copy these to a normal array and then process the data? Or best to step 
through the TJSONArray?


I'm not sure how to copy a TJSONArray to an Array, I tried: A:= 
E.Value.AsArray; but that of course did not work.


Any suggestions are as normal greatly appreciated,

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Copy TJSonArray to Array

2015-08-12 Thread Chris Moody



On 08/12/2015 12:36 AM, Michael Van Canneyt wrote:



On Wed, 12 Aug 2015, Chris Moody wrote:


Hi all,

First off thanks to all who have provided help over the past few 
weeks, I just have one last thing I'm trying to unravel (that I know 
of currently) and this project should be done.


The JSON feed I'm reading will have 2 arrays in it, would it be best 
to copy these to a normal array and then process the data? Or best to 
step through the TJSONArray?


if there is going to be a lot of processing, you might be better off 
copying the data.

The JSON structure does incur some processing overhead.



I'm not sure how to copy a TJSONArray to an Array, I tried: A:= 
E.Value.AsArray; but that of course did not work.


A regular loop is simplest:

Var
  MyArray : TMyArray;
  MyJSONArray : TJSONArray;
  i : Integer;

begin
  MyJSONArray:=// Get the array...
  SetLength(MyArray,MyJSONArray.Count);
  For I:=0 to MyJSONArray.Count-1 do
MyArray[i]:=MyJSONArray.Integers[i];
  // Now work with myarray
end.

Use the correct property for whatever type the array contains.

Michael.
___


Hi Michael,

Thanks or the feedback. Just to make sure I'm understanding this, here 
is some more information, part of the JSON feed I'm working with will 
look like this:


"add":["URL1","URL2","URL3"]

My intention was to be able to get the keys under "add" and turn it into 
an array.


So if I'm understanding this correctly, I have to do something like the 
following:


var
J:TJSONData;
A1:TJSONArray;
A2:Array of String;
E : TJSONEnum;

begin
// Put JSONData into J
for E in J do
  if E.Key = 'add' then
  //Somehow copy add from J to A1
 // Use your code to copy A1 into A2
end;


Is this the right way of looking at it?

I have checked what is available online and not finding a lot as far as 
how to work with JSON, hopefully this will improve. Once I finish this 
software, I'd be more than happy to help in donating time for making new 
Wiki pages as far as this subject is concerned.


Thanks again,

Chris


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] EAccessViolation

2015-08-13 Thread Chris Moody

Hi all,

I have this procedure in my program:

procedure DisplayNode (var node:astring);
var c, i:integer;
begin
  i:=SizeOf(node);
  if (i=0) then begin
writeln ('node was empty / non existant');
exit;
  end;
  for c:=0 to i do
  writeln (node[c]);// line 85
end;

astring is an Array of String

The code compiles fine, however when I run it I get:

An unhandled exception occurred at $00400B3A :
EAccessViolation : Access violation
  $00400B3A line 85 of Dentist.pas
  $00400C8C line 95 of Dentist.pas

Line 85 is the writeln above, line 95 is where I call this procedure 
from the main code.


How do I track down what is going on?

If your familiar with PHP, my purpose of this procedure is to basically 
emulate the following code:



Thanks in advance,

Chris

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Cross compile from x86 to Pi

2015-08-15 Thread Chris Moody

Hi all,

I think my project is almost done, wanted to see how fast it ran under 
the Pi which its destined to be on. After spending a long time trying to 
get it to compile there I decided I'd see if cross compiling may be any 
faster.


Is there a better guide on how to do this than: 
http://wiki.freepascal.org/fpcup#Linux_ARM_cross_compiler ? specifically 
as far as this sentence is concerned:


 * Linux/Unix build or install the relevant crossbinutils (Linux, unix)

Thanks in advance!

Chris


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Cross compile from x86 to Pi

2015-08-15 Thread Chris Moody



On 08/15/2015 06:40 PM, Karoly Balogh (Charlie/SGR) wrote:

Hi,

On Sat, 15 Aug 2015, Chris Moody wrote:


Is there a better guide on how to do this than:
http://wiki.freepascal.org/fpcup#Linux_ARM_cross_compiler ? specifically as far 
as this
sentence is concerned:

  *  Linux/Unix build or install the relevant crossbinutils (Linux, unix)

With Ubuntu/Debian:
- apt-get install binutils-arm-linux-gnueabihf

The various binutils executables will be available then as
arm-linux-gnueabihf-*, so you need to use parameter
-XParm-linux-gnueabihf- when invoking the compiler.

If you're using a different Linux distribution, look up a similar package
in your distribution, most bigger distros provide cross-binutils packages
these days for ARM.

You can also build cross-binutils from source, but that's not FPC specific
at all. Among many others, this GCC cross-howto explains how to build a
cross binutils (see chapter 1):

http://preshing.com/20141119/how-to-build-a-gcc-cross-compiler/

But on the RPi, instead of TARGET=aarch64-linux one has to use
TARGET=arm-linux-gnueabihf, if I'm correct.

Charlie

Thanks for that Charlie, I now have that installed. Do I have to do the 
compile with fpc? or can I do it via Lazarus?

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Cross compile from x86 to Pi

2015-08-15 Thread Chris Moody



On 08/15/2015 07:40 PM, Karoly Balogh (Charlie/SGR) wrote:

Hi,

On Sat, 15 Aug 2015, Chris Moody wrote:


Is there a better guide on how to do this than:
http://wiki.freepascal.org/fpcup#Linux_ARM_cross_compiler ? specifically
as far as this
sentence is concerned:

   *  Linux/Unix build or install the relevant crossbinutils (Linux, unix)

With Ubuntu/Debian:
- apt-get install binutils-arm-linux-gnueabihf

**snip**

Thanks for that Charlie, I now have that installed. Do I have to do the
compile with fpc? or can I do it via Lazarus?

I'm pretty sure it's possible with Lazarus, but I can't give exact
instructions, because I rarely use Lazarus, I prefer using the compiler
itself directly from the command line.

However, this page has some pointers:
http://wiki.lazarus.freepascal.org/Setup_Cross_Compile_For_ARM#Make_your_first_arm-linux_project_in_Lazarus

Charlie
___

Looks like I need to recompile FPC (or make a special compile of it) to 
be able to compile to ARM.


That URL you gave me says how to compile it, but not sure about if I 
need to have some special cross compile code for the 
CROSSBINDIR=/home/user/lazarus/fpc/binutils/ portion of it, or do I just 
point it to where Linux installed the items installed with apt-get 
install binutils-arm-linux-gnueabihf ?


Thanks once again!

Chris


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Cross compile from x86 to Pi

2015-08-16 Thread Chris Moody



On 08/15/2015 11:37 PM, Martin Schreiber wrote:

On Sunday 16 August 2015 02:33:24 Chris Moody wrote:

Hi all,

I think my project is almost done, wanted to see how fast it ran under
the Pi which its destined to be on. After spending a long time trying to
get it to compile there I decided I'd see if cross compiling may be any
faster.


I use MSEide in order to cross compile and do remote debugging from Linux x86
to Raspberry Pi. With that setup it is possible to work on the X86 PC like
locally on the Pi - solely faster.
Linux x86 -> arm cross environments with cross FPC, cross binutils and cross
gdb are here:
http://sourceforge.net/projects/mseide-msegui/files/fpcrossarm/

MSEide has a project template for cross-Pi development, please read
MSEide+MSEgui README.TXT.
For GUI on the Pi I use MSEgui which is extremely fast. Also MSEide runs
amazingly fast on Pi, the problem is long FPC compilation times.

FPC fixes_3_0 needs current git master MSEide+MSEgui from here:
https://gitlab.com/mseide-msegui/mseide-msegui

Please ask questions on the mailinglist:
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Mail archive:
http://www.mail-archive.com/mseide-msegui-talk@lists.sourceforge.net/
NNTP gateway:
nntp://news.gmane.org/gmane.comp.ide.mseide.user

Martin
___

Thanks for that Martin, my app is actually just console based (I used 
Lazarus because I didn't want to use the text based IDE), would you 
still recommend this route?


Thanks,

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Cross compile from x86 to Pi

2015-08-17 Thread Chris Moody



On 08/17/2015 05:15 AM, Karoly Balogh (Charlie/SGR) wrote:

Hi,

On Mon, 17 Aug 2015, Michael Schnell wrote:


Cross compiling with fpc is not for that faint of heard. (Been there some
years ago)

Well, I do it 8 hours a day for a living, actually... :) I think it's
really easy these days, if you know some basics about the build system
(most of which is available from the Wiki), and how the some of the
dependencies work (binutils, mainly). Basically you can have a working
crosscompiler setup with a *single* make command in about two minutes, to
almost any system which you have binutils installed for. I wouldn't call
that hard.

And it's especially super-easy these days, when you can test most of your
cross-setup outputs on a Linux/x86 box, thanks to the user-space emulation
of a good binfmts/QEMU setup (again, available out-of-box with some
packages on Ubuntu/Debian). You don't even have to copy over to an ARM
(etc.) box...

Of course, wiring it into an IDE is a different question, that I don't
know (and don't use)...

Charlie
___


Hi again Charlie,

Do you use the MSEide software to do the cross compiling? or do you just 
call fpc with the right parameters?


Mind sharing your setup?

Thanks,

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Cross compile from x86 to Pi

2015-08-17 Thread Chris Moody



On 08/15/2015 08:46 PM, Chris Moody wrote:



On 08/15/2015 07:40 PM, Karoly Balogh (Charlie/SGR) wrote:

Hi,

On Sat, 15 Aug 2015, Chris Moody wrote:


Is there a better guide on how to do this than:
http://wiki.freepascal.org/fpcup#Linux_ARM_cross_compiler  ? specifically
as far as this
sentence is concerned:

   *  Linux/Unix build or install the relevant crossbinutils (Linux, unix)

With Ubuntu/Debian:
- apt-get install binutils-arm-linux-gnueabihf

**snip**

Thanks for that Charlie, I now have that installed. Do I have to do the
compile with fpc? or can I do it via Lazarus?

I'm pretty sure it's possible with Lazarus, but I can't give exact
instructions, because I rarely use Lazarus, I prefer using the compiler
itself directly from the command line.

However, this page has some pointers:
http://wiki.lazarus.freepascal.org/Setup_Cross_Compile_For_ARM#Make_your_first_arm-linux_project_in_Lazarus

Charlie
___

Looks like I need to recompile FPC (or make a special compile of it) 
to be able to compile to ARM.


That URL you gave me says how to compile it, but not sure about if I 
need to have some special cross compile code for the 
CROSSBINDIR=/home/user/lazarus/fpc/binutils/ portion of it, or do I 
just point it to where Linux installed the items installed with 
apt-get install binutils-arm-linux-gnueabihf ?


Thanks once again!

Chris


So I tried to compile a special version of FPC for arm, I installed: 
binutils-2.25


And I got as far as this:

/home/chris/Documents/fp/fpcbuild-2.6.4/binutils/bin/as  -o 
/home/chris/Documents/fp/fpcbuild-2.6.4/fpcsrc/rtl/units/arm-linux/prt0.o arm/prt0.as

arm/prt0.as: Assembler messages:
arm/prt0.as:46: Error: unrecognized symbol type ""
arm/prt0.as:49: Error: expecting operand after ','; got nothing
arm/prt0.as:50: Error: no such instruction: `ldmia sp!,{a2}'
arm/prt0.as:53: Error: no such instruction: `ldr 
ip,=operatingsystem_parameter_argc'
arm/prt0.as:54: Error: no such instruction: `ldr 
a3,=operatingsystem_parameter_argv'

arm/prt0.as:55: Error: invalid char '[' beginning operand 2 `[ip]'
arm/prt0.as:58: Error: too many memory references for `add'
arm/prt0.as:59: Error: too many memory references for `add'
arm/prt0.as:60: Error: no such instruction: `ldr 
ip,=operatingsystem_parameter_envp'

arm/prt0.as:62: Error: invalid char '[' beginning operand 2 `[a3]'
arm/prt0.as:63: Error: invalid char '[' beginning operand 2 `[ip]'
arm/prt0.as:66: Error: no such instruction: `ldr ip,=__stkptr'
arm/prt0.as:67: Error: invalid char '[' beginning operand 2 `[ip]'
arm/prt0.as:69: Error: too many memory references for `sub'
arm/prt0.as:72: Error: no such instruction: `bl PASCALMAIN'
arm/prt0.as:75: Error: unrecognized symbol type ""
arm/prt0.as:78: Error: no such instruction: `swi 0x91'
arm/prt0.as:79: Error: no such instruction: `b _haltproc'
arm/prt0.as:82: Error: unrecognized symbol type ""
arm/prt0.as:84: Error: no such instruction: `ldr r0,=operatingsystem_result'
arm/prt0.as:85: Error: no such instruction: `ldrb r0,[r0]'
arm/prt0.as:86: Error: expecting operand after ','; got nothing
arm/prt0.as:87: Error: no such instruction: `swi 0x0'
arm/prt0.as:88: Error: no such instruction: `b _haltproc_eabi'
make[6]: *** [prt0.o] Error 1
make[6]: Leaving directory 
`/home/chris/Documents/fp/fpcbuild-2.6.4/fpcsrc/rtl/linux'

make[5]: *** [linux_all] Error 2
make[5]: Leaving directory 
`/home/chris/Documents/fp/fpcbuild-2.6.4/fpcsrc/rtl'

make[4]: *** [rtl] Error 2
make[4]: Leaving directory 
`/home/chris/Documents/fp/fpcbuild-2.6.4/fpcsrc/compiler'

make[3]: *** [cycle] Error 2
make[3]: Leaving directory 
`/home/chris/Documents/fp/fpcbuild-2.6.4/fpcsrc/compiler'

make[2]: *** [compiler_cycle] Error 2
make[2]: Leaving directory `/home/chris/Documents/fp/fpcbuild-2.6.4/fpcsrc'
make[1]: *** [build-stamp.arm-linux] Error 2
make[1]: Leaving directory `/home/chris/Documents/fp/fpcbuild-2.6.4/fpcsrc'
make: *** [fpcsrc/build-stamp.arm-linux] Error 2

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Cross compile from x86 to Pi

2015-08-18 Thread Chris Moody



On 08/18/2015 01:24 AM, Michael Ring wrote:

This is how I build fpc trunk cross compiler:

  echo "Building fpchf-linux from trunk"
  SUBARCH=armv7
  CROSSOPT="-dREVINC -dFPC_ARMHF -CX -CpARMV7A -CfVFPV3_D16 -OpARMV7A 
-O2 -OoFASTMATH -XX -Xs"
  //CROSSOPT="-dREVINC -dFPC_ARMHF -CX -CpARMV6 -CfVFPV2 -OpARMV6 -O2 
-OoFASTMATH -XX -Xs"

  OPT="-dFPC_ARMHF"
  make clean buildbase  CROSSINSTALL=1 OS_TARGET=linux CPU_TARGET=arm  
OPT="$OPT" OVERRIDEVERSIONCHECK=1 CROSSOPT="$CROSSOPT" 
BINUTILSPREFIX=arm-linux-gnueabihf- || exit 1
  sudo make installbase CROSSINSTALL=1 OS_TARGET=linux CPU_TARGET=arm  
OPT="$OPT" OVERRIDEVERSIONCHECK=1 CROSSOPT="$CROSSOPT" 
BINUTILSPREFIX=arm-linux-gnueabihf- || exit 1
  sudo mv /usr/local/lib/fpc/3.1.1/ppcrossarm 
/usr/local/lib/fpc/3.1.1/ppcrossarmhf


Please note that the rtl is fine for Raspberry Pi 2 (the new quad core 
board) as this is a version that uses armv7 commandset.


For old Raspberry Pi you need to use the commented out CROSSOPT, this 
will create rtl that is suitable for old raspberries.


You should not try to use fpc 2.6.4 as this compiler does not support 
armhf. Most likely the 3.0 pre-release will compile the same way, but 
I never tried.


You need to have cross-binutils installed as you need 
arm-linux-gnueabihf-* tools to be able to successfully compile.


Michael


Hi Michael,

Just to make sure, I run the script on the desktop right? just to make 
sure its not to be ran on the Pi.


Thanks again!

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Different idea

2015-08-18 Thread Chris Moody

Having issues getting cross compiling to work, so here's another idea:

What files would I need to move from Lazarus on my computer to the Pi, 
so it will be able to find all of the libraries? Or perhaps even better, 
how can I get the command Lazarus sends to FPC from my computer so I can 
issue it on the Pi?


Thanks,

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Different idea

2015-08-18 Thread Chris Moody

On 08/18/2015 02:29 PM, Graeme Geldenhuys wrote:

On 2015-08-18 21:03, Chris Moody wrote:

Or perhaps even better,
how can I get the command Lazarus sends to FPC from my computer so I can
issue it on the Pi?


"Project -> Project Options -> Show Options"

'Show Options' is a button at the bottom of the dialog.

Regards,
   - Graeme -




thanks, so I see the following:

 -MObjFPC -Scghi -Cg -O1 -g -gl -l -vewnhibq -Filib/x86_64-linux 
-Fusynapse 
-Fu/usr/share/lazarus/1.4.2/components/lazutils/lib/x86_64-linux 
-Fu/usr/share/lazarus/1.4.2/packager/units/x86_64-linux -Fu. 
-FUlib/x86_64-linux


So I would just need to change x86_64-linux to something like arm-linux?

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Different idea

2015-08-18 Thread Chris Moody



On 08/18/2015 02:34 PM, Chris Moody wrote:

On 08/18/2015 02:29 PM, Graeme Geldenhuys wrote:

On 2015-08-18 21:03, Chris Moody wrote:

Or perhaps even better,
how can I get the command Lazarus sends to FPC from my computer so I 
can

issue it on the Pi?


"Project -> Project Options -> Show Options"

'Show Options' is a button at the bottom of the dialog.

Regards,
   - Graeme -




thanks, so I see the following:

 -MObjFPC -Scghi -Cg -O1 -g -gl -l -vewnhibq -Filib/x86_64-linux 
-Fusynapse 
-Fu/usr/share/lazarus/1.4.2/components/lazutils/lib/x86_64-linux 
-Fu/usr/share/lazarus/1.4.2/packager/units/x86_64-linux -Fu. 
-FUlib/x86_64-linux


So I would just need to change x86_64-linux to something like arm-linux?

Chris
___


I'm back, with more questions, I tried to compile Lazarus on the Pi and 
it got to this point:


make bigide
make -C packager/registration
make[1]: Entering directory '/home/pi/lazarus/packager/registration'
/bin/rm -f ../units/arm-linux/fcllaz.ppu
/usr/bin/ppcarm -MObjFPC -Scghi -O1 -g -gl -l -vewnhibq -Fu. 
-Fu/usr/lib/fpc/2.6.4/units/arm-linux/rtl -FE. -FU../units/arm-linux 
-darm fcllaz.pas

Hint: (11030) Start of reading config file /home/pi/.fpc.cfg
Hint: (11031) End of reading config file /home/pi/.fpc.cfg
Free Pascal Compiler version 2.6.4 [2014/03/21] for arm
Copyright (c) 1993-2014 by Florian Klaempfl and others
(1002) Target OS: Linux for ARMEL
(3104) Compiling fcllaz.pas
(3104) Compiling registerfcl.pas
/home/pi/lazarus/packager/registration/registerfcl.pas(45,22) Fatal: 
(10022) Can't find unit process used by RegisterFCL

Fatal: (1018) Compilation aborted
Makefile:2299: recipe for target 'fcllaz.ppu' failed
make[1]: *** [fcllaz.ppu] Error 1
make[1]: Leaving directory '/home/pi/lazarus/packager/registration'
Makefile:3050: recipe for target 'registration' failed
make: *** [registration] Error 2

Any suggestions on how to fix this? Or does anyone have a current 
version of Lazarus compiled for the Pi? Or can I compile and install 
just the units of Lazarus without full installing of it?


Thanks once again,

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Different idea

2015-08-19 Thread Chris Moody



On 08/19/2015 12:38 AM, Graeme Geldenhuys wrote:

On 2015-08-19 05:11, Chris Moody wrote:

I tried to compile Lazarus on the Pi and
it got to this point:

Personally, I think Lazarus is a bit "heavy" for the RPi and would opt
for something lighter and faster. The RPi is not a very fast system and
will little memory. Lazarus likes both CPU and memory.

I haven't following all your posts... Do you have a working FPC
installed? Can you compile and link some basic console applications?
After that I would suggest trying to compile and link fpGUI and one of
its demos. That will at least confirm Xlib and Xft libraries are in
place for GUI apps. If this can't link, then you are missing basic X11
development packages for the RPi. See the fpGUI INSTALL.txt file for
details of what you need to install (normally only 2 packages).

Suggestions for lighter development environments. My first choice would
be MSEide. I believe it can now finally run on the RPi - I haven't tried
personally. It is much faster and memory efficient than Lazarus. You
could also try Maximus - a sample IDE included with fpGUI - I know that
works fine on the RPi. Others have used Geany with good success too.

Regards,
   - Graeme -


Hi Graeme,

I don't actually need Lazarus, I don't think. I just need to be able to 
compile a console app which I wrote in Lazarus on my desktop. I'll have 
to look to see where all of the compiled units are stored on the Pi, as 
they are not same location as they are on my desktop.


Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Cross compile from x86 to Pi

2015-08-19 Thread Chris Moody



On 08/19/2015 12:57 AM, Jonas Maebe wrote:
/home/chris/Documents/fp/fpcbuild-2.6.4/binutils/bin/as --version 
Somehow this was for x86 linux, not sure how that happened. Will have to 
look again.


Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Issue with Linking

2015-08-19 Thread Chris Moody

Hi all,

So I reset up my Pi and I was able to get the current version of FPC to 
get as far as the linking stage, at which point it shows this:


/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/home/pi/fpc-2.6.4/lib/fpc/2.6.4/units/arm-linux/rtl/cprt0.o: In 
function `_haltproc_eabi':

(.text+0x88): undefined reference to `_fini'
/home/pi/fpc-2.6.4/lib/fpc/2.6.4/units/arm-linux/rtl/cprt0.o: In 
function `_haltproc_eabi':

(.text+0x90): undefined reference to `_init'
Dentist.pas(106) Error: Error while linking
Dentist.pas(106) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /home/pi/fpc-2.6.4/bin/ppcarm returned an error exitcode (normal 
if you did not specify a source file to be compiled)


I'm not sure how to fix this. If anyone can assist, it would be greatly 
appreciated.


Thanks once again,

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Issue with Linking

2015-08-19 Thread Chris Moody



On 08/19/2015 01:08 PM, Karoly Balogh (Charlie/SGR) wrote:

Hi,

On Wed, 19 Aug 2015, Chris Moody wrote:


I'm not sure how to fix this. If anyone can assist, it would be greatly
appreciated.

You link against the libc (because of the nature of the source you're
compiling) but C development files are not installed on your system.

You should probably:
apt-get install libc-dev

at least, but I usually just install the Debian/Raspbian/Ubuntu
"build-essential" package, which installs a ton of other libs and useful
development tools. (Warning: this might take some space, so only do this
if you have a large-enough storage device on your RPi.)

Charlie
___


Hi Charlie, thanks for the quick reply.

It seems I have both already:

pi@raspberrypi ~ $ sudo apt-get install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@raspberrypi ~ $ sudo apt-get install libc-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libc6-dev' instead of 'libc-dev'
libc6-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Any other ideas?

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Issue with Linking

2015-08-19 Thread Chris Moody



On 08/19/2015 01:12 PM, Jonas Maebe wrote:

On 19/08/15 22:02, Chris Moody wrote:

So I reset up my Pi and I was able to get the current version of FPC to
get as far as the linking stage, at which point it shows this:

/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/home/pi/fpc-2.6.4/lib/fpc/2.6.4/units/arm-linux/rtl/cprt0.o: In
function `_haltproc_eabi':
(.text+0x88): undefined reference to `_fini'
/home/pi/fpc-2.6.4/lib/fpc/2.6.4/units/arm-linux/rtl/cprt0.o: In
function `_haltproc_eabi':
(.text+0x90): undefined reference to `_init'
Dentist.pas(106) Error: Error while linking
Dentist.pas(106) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /home/pi/fpc-2.6.4/bin/ppcarm returned an error exitcode (normal
if you did not specify a source file to be compiled)

I'm not sure how to fix this. If anyone can assist, it would be greatly
appreciated.

As mentioned several times before, the standard FPC 2.6.4 does not
support the Linux distributions for the Raspberry Pi. You get the linker
error because FPC has been compiled for ARM EABI (aka "armel") and is
looking for the symbols in the ARM EABI startup code (which is probably
not installed on your system), while the Raspberry Pi uses ARM EABIHF.

The solution is to use the FPC 2.6.4 from the package repository of your
Raspberry Pi Linux distribution, or to compile FPC 3.x instead of FPC
2.6.4 (with OPT=-dFPC_ARMHF while building FPC).


Jonas


Okay I will try to get the 2.6.4, as I'm not sure how to compile the 3.x 
if I can't compile on the Pi.



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Issue with Linking

2015-08-19 Thread Chris Moody



On 08/19/2015 03:41 PM, Graeme Geldenhuys wrote:

On 2015-08-19 21:12, Jonas Maebe wrote:

while the Raspberry Pi uses ARM EABIHF.

Doesn't that apply only for the newer Raspberry Pi 2 models? I have
Raspberry Pi 1 model B revision 2, and I believe mine uses ARM EABI.

Regards,
   - Graeme -

How do I verify what mine uses? I've found the directions at 
http://michellcomputing.co.uk/blog/2014/05/freepascal-2-7-1-on-raspberry-pi/ 
can't seem to be followed as Thaddy seems to not renewed his domain name.


This makes it unable to get the seed compiler, unless someone else knows 
of another location? I was unable to find another one.


Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Windows IOT Core

2015-08-19 Thread Chris Moody


On 08/19/2015 02:14 AM, Michael Schnell wrote:

Did anybody try to compile fpc programs for this variant of Windows 10.

It is available for ARM (eg it's said to run on the RasPI) and on 
Intel (e.g. for the "MinnowBoard Max") .


Seemingly M$ suggest to do non-native software (Java or C#) (-> 
https://dev.windows.com/en-us) But IO don't see why native fpc 
programs should not be runable.


(Is there already a Windows 10 / ARM RTL ?)

-Michael
___


I was beginning to wonder if this might be an easier task than getting 
FP for Linux to cross compile.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Issue with Linking

2015-08-19 Thread Chris Moody



On 08/19/2015 03:56 PM, Chris Moody wrote:



On 08/19/2015 03:41 PM, Graeme Geldenhuys wrote:

On 2015-08-19 21:12, Jonas Maebe wrote:

while the Raspberry Pi uses ARM EABIHF.

Doesn't that apply only for the newer Raspberry Pi 2 models? I have
Raspberry Pi 1 model B revision 2, and I believe mine uses ARM EABI.

Regards,
   - Graeme -

How do I verify what mine uses? I've found the directions at 
http://michellcomputing.co.uk/blog/2014/05/freepascal-2-7-1-on-raspberry-pi/ 
can't seem to be followed as Thaddy seems to not renewed his domain name.


This makes it unable to get the seed compiler, unless someone else 
knows of another location? I was unable to find another one.


Chris


I also was unable to compile version 3.0 on the Pi:

Writing Resource String Table file: fpmkunit.rsj
Assembling fpmkunit
25119 lines compiled, 9.7 sec
30 warning(s) issued
9 note(s) issued
make[4]: Leaving directory 
'/home/pi/dentist/release_3_0_0_rc1/fpcsrc/packages/fpmkunit'
/home/pi/dentist/release_3_0_0_rc1/fpcsrc/compiler/ppcarm fpmake.pp 
-Fu/home/pi/dentist/release_3_0_0_rc1/fpcsrc/packages/fpmkunit/units_bs/arm-linux 
-Fu/home/pi/dentist/release_3_0_0_rc1/fpcsrc/rtl/units/arm-linux

Free Pascal Compiler version 3.0.0rc1 [2015/08/19] for arm
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Linux for ARMEL
Compiling fpmake.pp
fpmake.pp(16,3) Note: Local variable "T" is assigned but never used
Assembling fpmake
Linking fpmake
fpmake.pp(49) Warning: "crti.o" not found, this will probably cause a 
linking failure
fpmake.pp(49) Warning: "crtbegin.o" not found, this will probably cause 
a linking failure
fpmake.pp(49) Warning: "crtend.o" not found, this will probably cause a 
linking failure
fpmake.pp(49) Warning: "crtn.o" not found, this will probably cause a 
linking failure

/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/home/pi/dentist/release_3_0_0_rc1/fpcsrc/rtl/units/arm-linux/cprt0.o: 
In function `_haltproc_eabi':

(.text+0x88): undefined reference to `_fini'
/home/pi/dentist/release_3_0_0_rc1/fpcsrc/rtl/units/arm-linux/cprt0.o: 
In function `_haltproc_eabi':

(.text+0x90): undefined reference to `_init'
fpmake.pp(49) Error: Error while linking
fpmake.pp(49) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Makefile:1659: recipe for target 'fpmake' failed
make[3]: *** [fpmake] Error 1
make[3]: Leaving directory 
'/home/pi/dentist/release_3_0_0_rc1/fpcsrc/packages'

Makefile:2616: recipe for target 'packages_smart' failed
make[2]: *** [packages_smart] Error 2
make[2]: Leaving directory '/home/pi/dentist/release_3_0_0_rc1/fpcsrc'
Makefile:2812: recipe for target 'build-stamp.arm-linux' failed
make[1]: *** [build-stamp.arm-linux] Error 2
make[1]: Leaving directory '/home/pi/dentist/release_3_0_0_rc1/fpcsrc'
Makefile:2186: recipe for target 'fpcsrc/build-stamp.arm-linux' failed
make: *** [fpcsrc/build-stamp.arm-linux] Error 2

This was compiled with FPC 2.6.4, if this helps any.

Thanks,

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Issue with Linking

2015-08-20 Thread Chris Moody



On 08/20/2015 04:53 AM, Graeme Geldenhuys wrote:

Hi Chris,

I thought you might try the following pre-built FPC ARM compiler created
by Paul Breneman - packaged as "EasyfpGUI". He packages everything you
need to get started into a single 5.7MB zip archive. It even includes
fpGUI and some demo programs (serial debug terminal, fpGUI's visual
forms designer, fpGUI alpha  IDE).

Visit this URL:

   http://www.turbocontrol.com/easyfpgui.htm

...then scroll down to the "ARM systems" section. The first few links
are for Linux/ARM systems. All instructions are shown there too.


Regards,
   - Graeme -


Hi Graeme,

Thanks for that. Do you happen to know if you can build console based 
apps with it also? I have a deadline fast approaching, and at this point 
seriously considering re-writing the code in a language I know is 
supported on the Pi.


I had first chosen FreePascal, because Turbo Pascal was the language I 
fell in love with first, when I was learning to program. However for the 
issues I've been having I'm really having to re-think if its been worth it.


Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Issue with Linking

2015-08-20 Thread Chris Moody



On 08/19/2015 10:52 PM, Martin Schreiber wrote:

On Thursday 20 August 2015 00:56:46 Chris Moody wrote:

How do I verify what mine uses? I've found the directions at
http://michellcomputing.co.uk/blog/2014/05/freepascal-2-7-1-on-raspberry-pi
/ can't seem to be followed as Thaddy seems to not renewed his domain name.

This makes it unable to get the seed compiler, unless someone else knows
of another location? I was unable to find another one.


http://sourceforge.net/projects/mseide-msegui/files/fpcarm/


I downloaded the file from this URL and had it overwrite my installed 
FPC 2.64 files and I still got :


/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/home/pi/fpc-2.6.4/lib/fpc/2.6.4/units/arm-linux/rtl/cprt0.o: In 
function `_haltproc_eabi':

(.text+0x88): undefined reference to `_fini'
/home/pi/fpc-2.6.4/lib/fpc/2.6.4/units/arm-linux/rtl/cprt0.o: In 
function `_haltproc_eabi':

(.text+0x90): undefined reference to `_init'
Dentist.pas(106) Error: Error while linking
Dentist.pas(106) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcarm returned an error exitcode

I did notice the file I downloaded did not include a new version of ld, 
so not sure if I did the correct thing or not.


Chris

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Issue with Linking

2015-08-20 Thread Chris Moody



On 08/20/2015 06:56 AM, Jonas Maebe wrote:

On 20/08/15 15:46, Chris Moody wrote:

Thanks for that. Do you happen to know if you can build console based
apps with it also? I have a deadline fast approaching, and at this point
seriously considering re-writing the code in a language I know is
supported on the Pi.

I still don't understand why you don't simply install FPC 2.6.4 using
the package manager of the Linux distribution on your Raspberry Pi. You
can't get more supported than that.


Jonas
___


Hi Jonas,

I've done that. Still can't compile code due to ld:

Assembling dentist
Linking Dentist
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/home/pi/fpc-2.6.4/lib/fpc/2.6.4/units/arm-linux/rtl/cprt0.o: In 
function `_haltproc_eabi':

(.text+0x88): undefined reference to `_fini'
/home/pi/fpc-2.6.4/lib/fpc/2.6.4/units/arm-linux/rtl/cprt0.o: In 
function `_haltproc_eabi':

(.text+0x90): undefined reference to `_init'
Dentist.pas(106) Error: Error while linking
Dentist.pas(106) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcarm returned an error exitcode

That is the result of: fpc Dentist.pas -Fusource/lib 
-Fu/usr/lib/fpc/2.6.4/units/arm-linux


So I'm not sure where to go from here.

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Issue with Linking

2015-08-20 Thread Chris Moody



On 08/20/2015 07:11 AM, Jonas Maebe wrote:

On 20/08/15 16:03, Chris Moody wrote:

Assembling dentist
Linking Dentist
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/home/pi/fpc-2.6.4/lib/fpc/2.6.4/units/arm-linux/rtl/cprt0.o: In
function `_haltproc_eabi':
(.text+0x88): undefined reference to `_fini'
/home/pi/fpc-2.6.4/lib/fpc/2.6.4/units/arm-linux/rtl/cprt0.o: In
function `_haltproc_eabi':
(.text+0x90): undefined reference to `_init'
Dentist.pas(106) Error: Error while linking
Dentist.pas(106) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcarm returned an error exitcode

Does the compiler also say "Target OS: Linux for ARMHF"?


That is the result of: fpc Dentist.pas -Fusource/lib
-Fu/usr/lib/fpc/2.6.4/units/arm-linux

If you need -Fu/usr/lib/fpc/2.6.4/units/arm-linux, that means the
configuration file (/etc/fpc.cfg) has not been generated properly. It
should have been generated when you installed fpc.

Secondly, do you have a file called /usr/lib/arm-linux-gnueabihf/crti.o
? That is the file containing the _init and _fini symbols. FPC for ARMHF
will automatically search /usr/lib/arm-linux-gnueabihf/ for that file if
libc is linked and add it to the linker script.

If you don't have that file, install the libc6-dev package (sudo apt-get
install libc6-dev). I would expect the fpc package to depend on that though.


Jonas



I see that the target is:

Target OS: Linux for ARMEL

I do have /usr/lib/arm-linux-gnueabihf/crti.o

I don't need to specify -Fu/usr/lib/fpc/2.6.4/units/arm-linux

is the target os the issue?

Chris

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Issue with Linking

2015-08-20 Thread Chris Moody



On 08/20/2015 07:37 AM, Martin Schreiber wrote:

On Thursday 20 August 2015 16:03:11 Chris Moody wrote:

I've done that. Still can't compile code due to ld:

Assembling dentist
Linking Dentist
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/home/pi/fpc-2.6.4/lib/fpc/2.6.4/units/arm-linux/rtl/cprt0.o: In
function `_haltproc_eabi':
(.text+0x88): undefined reference to `_fini'
/home/pi/fpc-2.6.4/lib/fpc/2.6.4/units/arm-linux/rtl/cprt0.o: In
function `_haltproc_eabi':
(.text+0x90): undefined reference to `_init'
Dentist.pas(106) Error: Error while linking
Dentist.pas(106) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcarm returned an error exitcode


I saw that linker error too. A workaround was to add "xlib" to "uses". This
needs an installed xlib-devel package, I don't remember the exact name.

Martin


I'm hoping this is not the solution for me, as this is a console only 
app. I would assume by the name xlib would make it more for XWindows?


Chris

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Issue with Linking

2015-08-20 Thread Chris Moody



On 08/20/2015 07:02 AM, Graeme Geldenhuys wrote:

On 2015-08-20 14:46, Chris Moody wrote:

Thanks for that. Do you happen to know if you can build console based
apps with it also?

Yes definitely. I just tried with the latest archive from Paul. I could
compile and link console apps and fpGUI's demo IDE (gui app).

Regards,
   - Graeme -


I think my issue could be that its compiling either for the wrong chip 
set, or something, as this also failed in the ld stage.


Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Issue with Linking

2015-08-20 Thread Chris Moody



On 08/20/2015 09:52 AM, Jonas Maebe wrote:

On 20/08/15 18:25, Graeme Geldenhuys wrote:

On 2015-08-20 16:01, Jonas Maebe wrote:

Yes, it is. Are you certain that this is with the system-installed
compiler

My working FPC 2.6.0 and 2.6.2 also says "Linux for ARMEL".

Incidentally, if I do 'sudo apt-get install ' I see apt
output like "Get:   armel "
It can be any package like 'git', 'mc' etc.  My Raspbian is from 2012 -
no idea how to find out the exact version number.

Ok, in that case it seems that there are in fact non-hard float versions
of Raspbian. Your compiler may work because you also installed the ARMEL
version of libc6-dev.

That's another thing:
* Chris may also to solve his problem by installing the ARMEL version of
libc6-dev (package name: libc6-dev-armel )
* however, if he then compiles his program and gives the compiled binary
to a customer, it may not work if they are using an ARM hard-float
installation (unless they also install the libc6-dev-armel package). Of
course, if compiles it for hard float and the customer has a softfp
system, it will also cause problems.

So maybe it would be useful to first determine whether the customer has
an armel or armhf system.


Jonas

To further add to the confusion, I found my Raspberry did not have 
locate installed, so I asked apt-get to get a copy and it obtained:


Unpacking locate (from .../locate_4.4.2-4_armhf.deb) ...

I did locate https://blogs.oracle.com/jtc/entry/is_it_armhf_or_armel and 
going by Jim's blog I'm running an armhf system.


So I don't know what I have :(.

Chris


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Issue with Linking

2015-08-20 Thread Chris Moody



On 08/20/2015 08:01 AM, Jonas Maebe wrote:

On 20/08/15 16:19, Chris Moody wrote:

I see that the target is:

Target OS: Linux for ARMEL

I do have /usr/lib/arm-linux-gnueabihf/crti.o

I don't need to specify -Fu/usr/lib/fpc/2.6.4/units/arm-linux

is the target os the issue?

Yes, it is. Are you certain that this is with the system-installed
compiler, and not with one of the ones that you tried to install or
compile yourself? What does "which fpc" and "which ppcarm" show?

Which version of Raspbian do you have? From what I can see in
http://archive.raspbian.org/raspbian/dists/stable/main/source/Sources.xz
, the fpc package definitely is the Debian one with the hardfloat
patches (2.6.4+dfsg-4+rpi1). Of course, they might still have compiled
it for softfp, but that would seem weird.


Jonas

PS: your linker is fine and unrelated.
___



The current FPC is from apt-get

pi@raspberrypi ~ $ which fpc
/usr/bin/fpc
pi@raspberrypi ~ $ which ppcarm
/usr/bin/ppcarm

https://www.raspberrypi.org/downloads/raspbian/ << this is the version 
of Rasbian I just installed a couple of days of ago.


Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Issue with Linking

2015-08-20 Thread Chris Moody



On 08/20/2015 02:38 PM, Jonas Maebe wrote:

Chris Moody wrote:

The current FPC is from apt-get

pi@raspberrypi ~ $ which fpc
/usr/bin/fpc
pi@raspberrypi ~ $ which ppcarm
/usr/bin/ppcarm


Ok, now please remove and reinstall that compiler (apt-get remove fpc; 
apt-get install fpc) to ensure it has not been overwritten by any of 
your experiments.


Next, if you execute
  /usr/bin/ppcarm -l nonexistingfile.pp

what is the complete compiler output?


Jonas


pi@raspberrypi ~ $ /usr/bin/ppcarm -l nonexistingfile.pp
Free Pascal Compiler version 2.6.4 [2014/03/21] for arm
Copyright (c) 1993-2014 by Florian Klaempfl and others
Target OS: Linux for ARMEL
Compiling nonexistingfile.pp
Fatal: Can't open file "nonexistingfile.pp"
Fatal: Compilation aborted

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Issue with Linking

2015-08-20 Thread Chris Moody



On 08/20/2015 03:16 PM, Jonas Maebe wrote:

Chris Moody wrote:

To further add to the confusion, I found my Raspberry did not have
locate installed, so I asked apt-get to get a copy and it obtained:

Unpacking locate (from .../locate_4.4.2-4_armhf.deb) ...

I did locate https://blogs.oracle.com/jtc/entry/is_it_armhf_or_armel and
going by Jim's blog I'm running an armhf system.

So I don't know what I have :(.


That indeed suggests you have an armhf system. I really don't get why 
it's installing an ARMEL compiler. Please file a bug with Raspbian 
about that.


You can bootstrap an armhf 3.0 compiler on an armel system, but it's a 
bit tricky:

1) install the armel compiler (you already did that
2) build FPC with OPT="-dFPC_ARMHF" FPCMAKEOPT="-dNO_THREADING"

This last parameter removes the libc dependency from fpmake, so it 
won't need the _init and _fini symbols. It does not remove threading 
support from the RTL itself, so that's fine.


This way, FPC 3.0 should build successfully, and you should end up 
with an FPC 3.0 ARMHF compiler. You can verify it by running 
"./fpcsrc/compiler/ppcarm -l nonexisting.pp" afterwards and checking 
that it says it targets ARMHF.


If that is the case, install it in a subdirectory of your home 
directory (make ... install INSTALL_PREFIX=$HOME/somedir), create a 
symbolic link from $HOME/somedir/bin/ppcarm to 
$HOME/somedir/lib/fpc/3.0/ppcarm, add $HOME/somedir/bin to the front 
of your path, and finally add the following lines to ~/.fpc.cfg


#ifdef VER3_0
-Fu/home/pi/somedir/lib/fpc/$fpcversion/units/$fpctarget/*
-Fu/home/pi/somedir/lib/fpc/$fpcversion/units/$fpctarget/rtl
#endif

That should enable you to use both "fpc" and "ppcarm" to compile 
programs using this newly built FPC 3.0.



Jonas


./ppcarm -l nonexisting.pp
Free Pascal Compiler version 3.0.0rc1 [2015/08/20] for arm
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Linux for ARMHF
Compiling nonexisting.pp
Fatal: Cannot open file "nonexisting.pp"
Fatal: Compilation aborted

Yay! thanks for all the help everyone!

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Issue with Linking

2015-08-20 Thread Chris Moody



On 08/20/2015 03:16 PM, Jonas Maebe wrote:

Chris Moody wrote:

To further add to the confusion, I found my Raspberry did not have
locate installed, so I asked apt-get to get a copy and it obtained:

Unpacking locate (from .../locate_4.4.2-4_armhf.deb) ...

I did locate https://blogs.oracle.com/jtc/entry/is_it_armhf_or_armel and
going by Jim's blog I'm running an armhf system.

So I don't know what I have :(.


That indeed suggests you have an armhf system. I really don't get why 
it's installing an ARMEL compiler. Please file a bug with Raspbian 
about that.


You can bootstrap an armhf 3.0 compiler on an armel system, but it's a 
bit tricky:

1) install the armel compiler (you already did that
2) build FPC with OPT="-dFPC_ARMHF" FPCMAKEOPT="-dNO_THREADING"

This last parameter removes the libc dependency from fpmake, so it 
won't need the _init and _fini symbols. It does not remove threading 
support from the RTL itself, so that's fine.


This way, FPC 3.0 should build successfully, and you should end up 
with an FPC 3.0 ARMHF compiler. You can verify it by running 
"./fpcsrc/compiler/ppcarm -l nonexisting.pp" afterwards and checking 
that it says it targets ARMHF.


If that is the case, install it in a subdirectory of your home 
directory (make ... install INSTALL_PREFIX=$HOME/somedir), create a 
symbolic link from $HOME/somedir/bin/ppcarm to 
$HOME/somedir/lib/fpc/3.0/ppcarm, add $HOME/somedir/bin to the front 
of your path, and finally add the following lines to ~/.fpc.cfg


#ifdef VER3_0
-Fu/home/pi/somedir/lib/fpc/$fpcversion/units/$fpctarget/*
-Fu/home/pi/somedir/lib/fpc/$fpcversion/units/$fpctarget/rtl
#endif

That should enable you to use both "fpc" and "ppcarm" to compile 
programs using this newly built FPC 3.0.



Jonas


Seems it compiles but still complains about linking.

Free Pascal Compiler version 3.0.0rc1 [2015/08/20] for arm
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Linux for ARMHF

Assembling dentist
Linking Dentist
Dentist.pas(106) Warning: "crtbegin.o" not found, this will probably 
cause a linking failure
Dentist.pas(106) Warning: "crtend.o" not found, this will probably cause 
a linking failure

/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
10358 lines compiled, 8.9 sec
10 warning(s) issued
2 note(s) issued


Thanks for the help Jonas and others!

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Issue with Linking

2015-08-21 Thread Chris Moody



On 08/21/2015 01:08 AM, Jonas Maebe wrote:

Chris Moody wrote:

Seems it compiles but still complains about linking.

Free Pascal Compiler version 3.0.0rc1 [2015/08/20] for arm
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Linux for ARMHF

Assembling dentist
Linking Dentist
Dentist.pas(106) Warning: "crtbegin.o" not found, this will probably
cause a linking failure
Dentist.pas(106) Warning: "crtend.o" not found, this will probably cause
a linking failure


These are gcc files. When performing a regular installation of FPC, 
the path to these files is added to fpc.cfg using the -Fl parameter.


You can manually get this path with
  dirname `gcc --print-libgcc-file-name`

Then add -Fl to the "#ifdef VER3_0" section of 
your .fpc.cfg



Jonas



For now I won't worry about it as the code does turn into an executable 
program. Just thought I would report it, in case anyone was curious.


Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] crosstool-ng

2015-09-04 Thread Chris Moody

Hi all,

Going back to my cross compile to Pi question a while ago. I wounded up 
having to install crosstool-ng to cross compile VLC for the Pi.


Could this tool also be used to to cross compile FPC apps?

Chris
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal