Re: [fpc-pascal] Basically on the right track?

2012-12-30 Thread Patrick

On 12-12-29 12:10 PM, Leonardo M. Ramé wrote:


From: Patrick 
To: FPC-Pascal users discussions 
Cc: Sven Barth 
Sent: Saturday, December 29, 2012 1:18 PM
Subject: Re: [fpc-pascal] Basically on the right track?


I was able to compile helloworld2 and run it without errors.

Sorry for the long email ! thanks for reading it-Patrick




Patrick, btw, do you know you can create GTK2 (and QT, Win32, etc) apps with 
FreePascal without bothering with low level GTK2 libraries?, please take a look 
at the Lazarus Project (http://lazarus.freepascal.org), it'll make your life 
much, much easier.

Regards,
--
Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Hi Leonardo

Thanks for your post. Actually I want to do some wacky stuff mixing 
Pascal, Ada and Lua. I think I will need to learn the lower level stuff.


Happy new year :)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Basically on the right track?

2012-12-29 Thread Leonardo M . Ramé
>
> From: Patrick 
>To: FPC-Pascal users discussions  
>Cc: Sven Barth  
>Sent: Saturday, December 29, 2012 1:18 PM
>Subject: Re: [fpc-pascal] Basically on the right track?
> 
>
>I was able to compile helloworld2 and run it without errors.
>
>Sorry for the long email ! thanks for reading it-Patrick
>



Patrick, btw, do you know you can create GTK2 (and QT, Win32, etc) apps with 
FreePascal without bothering with low level GTK2 libraries?, please take a look 
at the Lazarus Project (http://lazarus.freepascal.org), it'll make your life 
much, much easier.

Regards,
-- 
Leonardo M. Ramé
http://leonardorame.blogspot.com

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


Re: [fpc-pascal] Basically on the right track?

2012-12-29 Thread Patrick

Hi Again Sven

I don't know how I could have compiled the wrong file, I will stick to 
the Makefiles from now on to keep this simpler.


I switched over to Mint (I almost lost 2.5 TBs of data! but all is well 
now). I installed 2.6 from the repository. I have not installed a source 
based fpc.



I am still getting gtk related errors. If you could help me just a 
little more that would be great.


I wanted to see how far the problem spreads so I took the package folder 
from the source folder I downloaded and made a shell script that looks 
like this:



make   ./aspell
make   ./bfd
make   ./bzip2
and so on...

the results from calling make on each individual folder in the packages 
folder was not so bad:




:bash Pat_Make.sh > aaa_results
/usr/bin/ld: warning: ./link.res contains output sections; did you 
forget -T?
/usr/bin/ld: warning: ./link.res contains output sections; did you 
forget -T?

make[1]: *** [all] Error 1
make: *** [fastcgi] Error 2
make[1]: *** [all] Error 1
make: *** [fcl-web] Error 2
/usr/bin/ld: warning: ./link.res contains output sections; did you 
forget -T?



fastcgi and fcl-web seemed to give errors but that was all.


when I called make from inside gtk2 I got this:
:make
/usr/bin/ppcx64 -Fusrc -Fusrc/glib -Fusrc/atk -Fusrc/pango 
-Fusrc/pangocairo -Fusrc/gtk+/gdk-pixbuf -Fusrc/gtk+/gdk -Fusrc/gtk+/gtk 
-Fusrc/libglade -Fusrc/gtkglext -Fusrc/gtkext -Fusrc/gtk2x11 
-Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/rtl 
-Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/pasjpeg 
-Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/hash 
-Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/paszlib 
-Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/fcl-base 
-Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/fcl-image 
-Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/x11 
-Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/cairo -Fisrc/gtk2x11/include 
-FE. -FUunits/x86_64-linux -Cg -Fl/usr/lib/gcc/x86_64-linux-gnu/4.7 
-Flinclude -Fl/etc/ld.so.conf.d/*.conf -dx86_64 src/buildgtk2.pp

Free Pascal Compiler version 2.6.0-6 [2012/10/05] for x86_64
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling src/buildgtk2.pp
Compiling ./src/gtk+/gtk/gtk2.pas
Compiling ./src/glib/glib2.pas
goption.inc(67,1) Warning: Possible library conflict: symbol 
"g_cclosure_marshal_BOOLEAN__FLAGS" from library "libglib-2.0.so" also 
found in library "libgobject-2.0.so"
glib2.pas(1692,54) Warning: Converting pointers to signed integers may 
result in wrong comparison results and range errors, use an unsigned 
type instead.
glib2.pas(1719,17) Warning: Converting pointers to signed integers may 
result in wrong comparison results and range errors, use an unsigned 
type instead.

Compiling ./src/atk/atk.pas
Compiling ./src/pango/pango.pas
Compiling ./src/gtk+/gdk-pixbuf/gdk2pixbuf.pas
Compiling ./src/gtk+/gdk/gdk2.pas
gdktypes.inc(156,33) Warning: Converting pointers to signed integers may 
result in wrong comparison results and range errors, use an unsigned 
type instead.
gdktypes.inc(161,28) Warning: Converting pointers to signed integers may 
result in wrong comparison results and range errors, use an unsigned 
type instead.

Compiling ./src/libglade/libglade2.pas
Compiling ./src/gtkglext/gdkglext.pas
Compiling ./src/gtkglext/gtkglext.pas
Compiling ./src/gtkext/gtk2ext.pp
Compiling ./src/gtk2x11/gdk2x.pas
Compiling ./src/pangocairo/pangocairo.pas
180750 lines compiled, 0.7 sec
5 warning(s) issued



when I called make from inside the gtk2 examples I got:

:make
make -C helloworld all
make[1]: Entering directory 
`/home/patrick/modified_since_dec29_2012/programming/pascal_small_folder/packages2.6/gtk2/examples/helloworld'
/usr/bin/ppcx64 -Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/rtl 
-Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/pasjpeg 
-Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/hash 
-Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/paszlib 
-Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/fcl-base 
-Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/fcl-image 
-Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/x11 
-Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/cairo 
-Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/gtk2 -FE. -FUunits/x86_64-linux 
-Cg -Fl/usr/lib/gcc/x86_64-linux-gnu/4.7 -Flinclude 
-Fl/etc/ld.so.conf.d/*.conf -dx86_64 helloworld.pas

Free Pascal Compiler version 2.6.0-6 [2012/10/05] for x86_64
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling helloworld.pas
helloworld.pas(28,11) Error: Incompatible types: got "Boolean32" 
expected "LongInt"

helloworld.pas(96) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
make[1]: *** [helloworld] Error 1
make[1]: Leaving directory 
`/home/patrick/modified_since_dec29_2012/programming/pascal_small_folder/packages2.6/gtk2/examples/helloworld'

make: *** [helloworld_all] Error 2
:

I also had similar errors inside the scribblin example:
/bin/mkdir -p units/x86_64-linux
/usr/bin/ppcx64 -Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/rtl 
-Fu/usr/lib/fpc/2.6.0/units/x86_64-linux/pasjpeg 

Re: [fpc-pascal] Basically on the right track?

2012-12-28 Thread Sven Barth

On 28.12.2012 22:53, Patrick wrote:

Ah ! the liblua.a file was there at the start and then after make clean,
make it was not. Thanks !


The liblua.a file is not necessarily what you think it is. On *nix 
platforms the .a files are used for smartlinking, not for linking 
against something.




I tried the  -st switch but a script was not generated. I have the
results below but don't worry too much about it, I am going to start
fresh again


This is because you used it on the wrong file (see below). The script is 
only generated if the code compiles correctly.




:fpc -st helloworld.pas


This should have been for your helloworld2 to check what the linking 
errors are for. With the helloworld you have a compile error which is 
before the linking phase.



Free Pascal Compiler version 2.6.0 [2012/08/24] for x86_64
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling helloworld.pas
helloworld.pas(28,11) Error: Incompatible types: got "Boolean32"
expected "LongInt"
helloworld.pas(96) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not
specify a source file to be compiled)


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


Re: [fpc-pascal] Basically on the right track?

2012-12-28 Thread Patrick


Could you try to compile the example using "-st" and then run the 
generated ppas.sh script and report it's output here? I hope to get 
more error information from the linker this way...


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


Hi again Sven

I am going to switch over to Mint right now. If I don't respond it's 
because I screwed my email !


Ah ! the liblua.a file was there at the start and then after make clean, 
make it was not. Thanks !


I tried the  -st switch but a script was not generated. I have the 
results below but don't worry too much about it, I am going to start 
fresh again


Thanks-Patrick



:fpc -st helloworld.pas
Free Pascal Compiler version 2.6.0 [2012/08/24] for x86_64
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling helloworld.pas
helloworld.pas(28,11) Error: Incompatible types: got "Boolean32" 
expected "LongInt"

helloworld.pas(96) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not 
specify a source file to be compiled)


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


Re: [fpc-pascal] Basically on the right track?

2012-12-28 Thread Sven Barth

On 28.12.2012 19:04, Patrick wrote:

However I am delighted to see a lua package in there. I have more
experience with lua. Make is running without errors but I expected to
see a liblua.a archive file after and did not see it, there were more
warnings. (I have them at the end of the email)


You won't see a liblua.a file, because Free Pascal does not use .a files 
for such purposes. Free Pascal generates .o and .ppu files which can 
then again be used when compiling a program. Also the lua package should 
already be compiled if you installed the deb. Take a look at 
/usr/lib/fpc/2.6.0/units/x86_64-linux/lua (or something similar). 
Nevertheless you should be able to just add the "lua" unit to the uses 
clause and it should work. You need the lua library installed of course.



helloworld2.pas(99,1) Error: Error while linking
helloworld2.pas(99,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
make: *** [helloworld2] Error


Could you try to compile the example using "-st" and then run the 
generated ppas.sh script and report it's output here? I hope to get more 
error information from the linker this way...


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


Re: [fpc-pascal] Basically on the right track?

2012-12-28 Thread Patrick

Hope I am not wearing out the warm welcome I have received

I installed the 64 bit .deb package from the website. I am still getting 
a lot of errors. I am starting to wonder if I have borked my install. I 
am on Debian stable right now. I can move to Mint Mate desktop...


At the end of the email are the errors when compiling a simple gtk2 app

However I am delighted to see a lua package in there. I have more 
experience with lua. Make is running without errors but I expected to 
see a liblua.a archive file after and did not see it, there were more 
warnings. (I have them at the end of the email)


Any advice or do you think I should start with a fresh install?

Thanks!


helloworld2.pas(99,1) Error: Error while linking
helloworld2.pas(99,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
make: *** [helloworld2] Error



:make
/usr/bin/ppcx64 -Fu../../rtl/units/x86_64-linux -Fisrc -FE. 
-FUunits/x86_64-linux -Cg -dx86_64 src/lua.pas

Free Pascal Compiler version 2.6.0 [2012/08/24] for x86_64
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling src/lua.pas
575 lines compiled, 0.0 sec
/usr/bin/ppcx64 -Fu../../rtl/units/x86_64-linux -Fisrc -FE. 
-FUunits/x86_64-linux -Cg -dx86_64 src/lualib.pas

Free Pascal Compiler version 2.6.0 [2012/08/24] for x86_64
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling src/lualib.pas
104 lines compiled, 0.0 sec
/usr/bin/ppcx64 -Fu../../rtl/units/x86_64-linux -Fisrc -FE. 
-FUunits/x86_64-linux -Cg -dx86_64 src/lauxlib.pas

Free Pascal Compiler version 2.6.0 [2012/08/24] for x86_64
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling src/lauxlib.pas
lauxlib.pas(292,6) Warning: Conversion between ordinals and pointers is 
not portable
lauxlib.pas(292,27) Warning: Conversion between ordinals and pointers is 
not portable

380 lines compiled, 0.0 sec
2 warning(s) issued

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


Re: [fpc-pascal] Basically on the right track?

2012-12-28 Thread Patrick

On 12/28/2012 08:39 AM, Juha Manninen wrote:

On Fri, Dec 28, 2012 at 6:47 AM, Patrick  wrote:
   

I am also finding the site confusing. If I click on AMD64/x86_64  on the
binary download page and then choose  sourceforge, I end up being offered a
package that says fpc-2.6.0.i386-linux.tar.

I did find another link and installed the compiler.
 

The AMD64/x86_64 link is for a crosscompiler of some sort. It does not
work when you install it to your 64-bit computer. I have tested that
many times because I always forget it.
It is so extremely misleading! Could someone from the FPC team please fix it.
Also the FPC sources can be found only behind many clicks. It could be
more straightforward.
... and the Debian packages are divided to 44 (or some) pieces which
should be downloaded one by one.
Fortunately Mattias Gärtner has made easy Debian packages for FPC.
They can be found in Lazarus downloads page. (!)

This is bad. The first impression is always important and installation
should be as simple as possible.
It bothers me even though I am not a newbie any more.
Lazarus pages are a bit messy, too, but not as bad.


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

   

Hi Juha

Thanks for your post :)

Could you send me the link for the right 64 bit binary ?

Thanks Marco and Sven for your posts too, let me make sure my set up is 
correct first though before I trouble you more with helloworld.pas


-Patrick


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


Re: [fpc-pascal] Basically on the right track?

2012-12-28 Thread Juha Manninen
On Fri, Dec 28, 2012 at 6:47 AM, Patrick  wrote:
> I am also finding the site confusing. If I click on AMD64/x86_64  on the
> binary download page and then choose  sourceforge, I end up being offered a
> package that says fpc-2.6.0.i386-linux.tar.
>
> I did find another link and installed the compiler.

The AMD64/x86_64 link is for a crosscompiler of some sort. It does not
work when you install it to your 64-bit computer. I have tested that
many times because I always forget it.
It is so extremely misleading! Could someone from the FPC team please fix it.
Also the FPC sources can be found only behind many clicks. It could be
more straightforward.
... and the Debian packages are divided to 44 (or some) pieces which
should be downloaded one by one.
Fortunately Mattias Gärtner has made easy Debian packages for FPC.
They can be found in Lazarus downloads page. (!)

This is bad. The first impression is always important and installation
should be as simple as possible.
It bothers me even though I am not a newbie any more.
Lazarus pages are a bit messy, too, but not as bad.


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


Re: [fpc-pascal] Basically on the right track?

2012-12-28 Thread Mark Morgan Lloyd

Sven Barth wrote:

On 28.12.2012 05:47, Patrick wrote:

Free Pascal Compiler version 2.6.0 [2011/12/23] for x86_64
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling helloworld.pas
helloworld.pas(28,11) Error: Incompatible types: got "Boolean32"
expected "LongInt"
helloworld.pas(97) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not
specify a source file to be compiled)


How does your helloworld.pas look like? It's hard to guess what's wrong 
without seeing the code...


Look back to 15:30 yesterday.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Basically on the right track?

2012-12-28 Thread Marco van de Voort
In our previous episode, Sven Barth said:
> > Fatal: Compilation aborted
> > Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not
> > specify a source file to be compiled)
> 
> How does your helloworld.pas look like? It's hard to guess what's wrong 
> without seeing the code...

Since it mentions boolean32, I bet it is a GTK2 hello world. The boolean32
was partially introduced because nothing else properly mapped to a GTK2
boolean.

Only solution: update the outdated example, or use newer examples.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Basically on the right track?

2012-12-28 Thread Sven Barth

On 28.12.2012 05:47, Patrick wrote:

Free Pascal Compiler version 2.6.0 [2011/12/23] for x86_64
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling helloworld.pas
helloworld.pas(28,11) Error: Incompatible types: got "Boolean32"
expected "LongInt"
helloworld.pas(97) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not
specify a source file to be compiled)


How does your helloworld.pas look like? It's hard to guess what's wrong 
without seeing the code...


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


Re: [fpc-pascal] Basically on the right track?

2012-12-28 Thread Sven Barth

On 27.12.2012 17:11, Patrick wrote:
>
>> This is exactly what I thought. You are trying to use the GTK1 unit.
>> The unit for GTK+ is called "gtk2". Take a look into "packages/gtk"
>> and "packages/gtk2" of a Free Pascal source folder to see the
>> differences in the units (just look at the *.pas/*.pp files and ignore
>> the *.inc files for now).
>>
>> Also you could try whether you can compile the examples listed in
>> "packages/gtk2/examples".
>>
>> Regards,
>> Sven
>> 
> Thanks Sven
>
> I am sure you are right about this.
>
> Do you happen to know if there is a way to specify the install
> directory? I don't blame you guys for not using autotools but I often
> use a flag --prefex=/pat with configure to install into a directory not
> in my PATH. I then call my source built programs using their full path
> names instead. I installed 2.4 by mistake from source(in /usr) and seem
> to be having trouble removing it.

The variable for make you are looking for is "INSTALL_PREFIX". It 
behaves like --prefix for configure.


Regards,
Sven

PS: Sorry, Patrick, this should have gone to the list. -.-
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Basically on the right track?

2012-12-27 Thread Patrick
Sorry to bug everyone again. I am still mixed up. I was having trouble 
with both source compiled builds and Debian stable packages on a 64 bit 
machine so I switched computers and used an atom based netbook. I still 
ended up with errors related to number types. I switched back to the 64 
bit computer and installed a binary from the site. I am still getting 
errors I have included one at the end of this email.


I am also finding the site confusing. If I click on AMD64/x86_64  on the 
binary download page and then choose  sourceforge, I end up being 
offered a package that says fpc-2.6.0.i386-linux.tar.


I did find another link and installed the compiler.

I appreciate all the time everyone has already put in-Patrick



Free Pascal Compiler version 2.6.0 [2011/12/23] for x86_64
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling helloworld.pas
helloworld.pas(28,11) Error: Incompatible types: got "Boolean32" 
expected "LongInt"

helloworld.pas(97) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not 
specify a source file to be compiled)


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


Re: [fpc-pascal] Basically on the right track?

2012-12-27 Thread Patrick


This is exactly what I thought. You are trying to use the GTK1 unit. 
The unit for GTK+ is called "gtk2". Take a look into "packages/gtk" 
and "packages/gtk2" of a Free Pascal source folder to see the 
differences in the units (just look at the *.pas/*.pp files and ignore 
the *.inc files for now).


Also you could try whether you can compile the examples listed in 
"packages/gtk2/examples".


Regards,
Sven


Thanks Sven

I am sure you are right about this.

Do you happen to know if there is a way to specify the install 
directory? I don't blame you guys for not using autotools but I often 
use a flag --prefex=/pat with configure to install into a directory not 
in my PATH. I then call my source built programs using their full path 
names instead. I installed 2.4 by mistake from source(in /usr) and seem 
to be having trouble removing it.


Thanks again for all your time-Patrick


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


Re: [fpc-pascal] Basically on the right track?

2012-12-27 Thread Sven Barth

On 27.12.2012 16:11, Patrick wrote:

:fpc hello_gtk.pas
Free Pascal Compiler version 2.4.0-2 [2010/02/20] for x86_64


Try to update to FPC 2.6.0. 2.4.0 is quite old already (around 3 years).


Copyright (c) 1993-2009 by Florian Klaempfl
Target OS: Linux for x86-64
Compiling hello_gtk.pas
Linking hello_gtk
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/usr/bin/ld: cannot find -lgtk
hello_gtk.pas(70,1) Error: Error while linking
hello_gtk.pas(70,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not
specify a source file to be compiled)

[snip]

PROGRAM hello_world;

USES gtk, gdk, glib;


This is exactly what I thought. You are trying to use the GTK1 unit. The 
unit for GTK+ is called "gtk2". Take a look into "packages/gtk" and 
"packages/gtk2" of a Free Pascal source folder to see the differences in 
the units (just look at the *.pas/*.pp files and ignore the *.inc files 
for now).


Also you could try whether you can compile the examples listed in 
"packages/gtk2/examples".


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


Re: [fpc-pascal] Basically on the right track?

2012-12-27 Thread Patrick
Wow ! I was really surprised to see all these emails when I woke up 
today! Thanks everyone.


So my message was held in the moderator queue for a while and I have 
been reading more.


Sorry for not reading through the man pages of fpc. I found the -Fu switch.

I have also read more about gpc and it seems abandoned, sorry for 
mentioning it here.


At the end of the email I have the hello world gtk program I tried to 
compile, the compiler error and an apt-get message from debian stable 
showing gtk dev installed.


I have been able to compile gtk c examples and other languages.



"Is it possible to specify the libraries to use to fpc ? In Ada we have 
.gpr files that can list where things are to be found. "


"What do you mean with this question ? "

This was an odd question to ask, sorry. With Ada we have .gpr files that 
can be used in place of Makefiles(for the most part). With fpc switches 
I will be fine now, sorry for the noise.


I am enjoying my holidays, I hope you guys are too !

-Patrick





:fpc hello_gtk.pas
Free Pascal Compiler version 2.4.0-2 [2010/02/20] for x86_64
Copyright (c) 1993-2009 by Florian Klaempfl
Target OS: Linux for x86-64
Compiling hello_gtk.pas
Linking hello_gtk
/usr/bin/ld: warning: link.res contains output sections; did you forget -T?
/usr/bin/ld: cannot find -lgtk
hello_gtk.pas(70,1) Error: Error while linking
hello_gtk.pas(70,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not 
specify a source file to be compiled)



root@foo:/# apt-get install libgtk2.0-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libgtk2.0-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 23 not upgraded.
N: Ignoring file 'squeeze-backports.list.save' in directory 
'/etc/apt/sources.list.d/' as it has an invalid filename extension

root@foo:/#


PROGRAM hello_world;

USES gtk, gdk, glib;

{ -hello }

PROCEDURE hello( widget : pGtkWidget ; data : gpointer ); cdecl;
{ This is a callback function. The data arguments are ignored in this 
example. More on callbacks later }

BEGIN
writeln('Hello World!');
END; { --hello-- }

{ delete_event }
FUNCTION delete_event( widget : pGtkWidget ; event : pGdkEvent ; data : 
gpointer ) :

gint; cdecl;
{ If you return FALSE from the --delete_event-- signal handler, GTK will 
emit the --destroy-- signal. Returning TRUE means you don't want
the window to be destroyed. This is useful for popping up 'are you sure 
you want to quit?' type dialogs. }

BEGIN
writeln('delete event occurred');
{ Returning FALSE from the function, as we do here, causes the 
--destroy-- signal to be emitted. }

delete_event := 0; { i.e. FALSE }
END; { -delete_event-- }

{ -destroy }
PROCEDURE destroy( widget : pGtkWidget ; data : gpointer ); cdecl;
{ Another callback - this one will kill the app }
BEGIN
gtk_main_quit();
END; { 
---destroy--- }


{ ---Global Variables }
VAR
window, button : pGtkWidget; { GtkWidget is the storage type for widgets }
{ --Main Program-- }
BEGIN
{ This is called in all GTK applications. Arguments are parsed from the 
command line and are returned to the application. }

gtk_init(@argc, @argv);

window := gtk_window_new(GTK_WINDOW_TOPLEVEL); { Create a new window }

{ When the window is given the --delete_event-- signal (this is given by 
the window manager, usually by the --close-- option,
or on the titlebar), we ask it to call the delete_event() function as 
defined above. The data passed to the callback function

is NIL and is ignored in the callback function. }
gtk_signal_connect(GTK_OBJECT(window), 'delete_event',
GTK_SIGNAL_FUNC(@delete_event), NIL);

{ Here we connect the --destroy-- event to a signal handler. This event 
occurs when we call gtk_widget_destroy() on the window,

or if we return FALSE in the --delete_event-- callback. }
gtk_signal_connect(GTK_OBJECT(window), 'destroy',
GTK_SIGNAL_FUNC(@destroy), NIL);

{ Creates a new button with the label 'Hello World'. }
button := gtk_button_new_with_label('Hello World');

{ When the button receives the --clicked-- signal, it will call the 
procedure hello() -defined above- passing it NIL as its argument. }

gtk_signal_connect(GTK_OBJECT(button), 'clicked',
GTK_SIGNAL_FUNC(@hello), NIL);

{ This packs the button into the window (a gtk container). }
gtk_container_add(GTK_CONTAINER(window), button);

{ The final step is to display this newly created widget. }
gtk_widget_show(button);

{ and the window }
gtk_widge

Re: [fpc-pascal] Basically on the right track?

2012-12-27 Thread microcode
On Thu, Dec 27, 2012 at 12:04:53PM +, Mark Morgan Lloyd wrote:
> microc...@zoho.com wrote:
> 
> >Ada support off Linux and Windows gets very expensive. But the market is far
> >from dead. New standards have been approved even recently.
> 
> Unfortunately, that's also true of COBOL and even of some earlier
> programming representations :-)

That's what old hardware and emulators are for. I know you realize that. But
now we're getting too far afield for this list. Carry on, gents!

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


Re: [fpc-pascal] Basically on the right track?

2012-12-27 Thread Mark Morgan Lloyd

microc...@zoho.com wrote:


Ada support off Linux and Windows gets very expensive. But the market is far
from dead. New standards have been approved even recently.


Unfortunately, that's also true of COBOL and even of some earlier 
programming representations :-)


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Basically on the right track?

2012-12-27 Thread Sven Barth

On 27.12.2012 12:23, Mark Morgan Lloyd wrote:

 Realistically, Ada and Modula-x are dead.


Unlike Pascal Ada recently (a few days ago) received a new standard...

See here: http://www.ada2012.org/

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


Re: [fpc-pascal] Basically on the right track?

2012-12-27 Thread microcode
On Thu, Dec 27, 2012 at 11:23:42AM +, Mark Morgan Lloyd wrote:
> Patrick wrote:
> 
> >I fell in love with Ada about 14 months ago. Including the
> >cardboard box, i now have 53lbs of Ada books(A few still to read),
> >I am planning on diving into Pascal in this way too and  I want to
> >mix Ada and Pascal.
> 
> Like a number of other people around here, I've used Modula-2
> extensively in the past. I've also done a bit of selling and
> supporting for Ada, back in the days when there weren't any full
> implementations that ran on PCs.
> 
>   Realistically, Ada and Modula-x are dead.

You should try telling that to Irvine Compiler Corp., Aonix, Green Hills,
Adacore, RR, IBM, and the other companies who are still developing and
selling their Ada toolchains ;-) "Reports of the death of Ada have been
greatly exaggerated!"

> Just about everybody agrees that Ada and Modula-2 were praiseworthy
> in avoiding Pascal's "dangling else" problem, and some would argue
> that Pascal implementations could usefully have a switch to allow
> that alternative syntax. But apart from that, I'd strongly caution
> against spending too much time on them except for pure
> hobby/research interest.

That's indisputably true of Modula-2. But there are still jobs in Ada and
while it's a niche if you can snag one they pay extremely well. Ada is
well supported on Linux (in particular your favorite distro, Debian, has a
very dedicated and hard-working maintainer) but is also available for any
Linux distro, and Windows. It's a top-flight GPL toolchain supporting all
the optional Annexes and there is also a gcc version derived from that.

Ada support off Linux and Windows gets very expensive. But the market is far
from dead. New standards have been approved even recently.

--
_ _  
._ _ _ <_> ___  _ _  ___  ___  ___  _| | ___ 
| ' ' || |/ | '| '_>/ . \/ | '/ . \/ . |/ ._>
|_|_|_||_|\_|_.|_|  \___/\_|_.\___/\___|\___.
 

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


Re: [fpc-pascal] Basically on the right track?

2012-12-27 Thread Mark Morgan Lloyd

Patrick wrote:

I fell in love with Ada about 14 months ago. Including the cardboard 
box, i now have 53lbs of Ada books(A few still to read), I am planning 
on diving into Pascal in this way too and  I want to mix Ada and Pascal. 


Like a number of other people around here, I've used Modula-2 
extensively in the past. I've also done a bit of selling and supporting 
for Ada, back in the days when there weren't any full implementations 
that ran on PCs.


Realistically, Ada and Modula-x are dead.

Practically all of the things that made Ada and Modula-2 notable in the 
early 1980s- strong typing, modularity, exception handling etc.- have 
been recognised as "Good Things" and implemented in other languages. 
Also the various adjunct programs that were specified for a full Ada 
implementation have generally been implemented in IDEs for other 
languages (with a particular nod here to the very wide range of programs 
flitting about the Java ecosystem).


Just about everybody agrees that Ada and Modula-2 were praiseworthy in 
avoiding Pascal's "dangling else" problem, and some would argue that 
Pascal implementations could usefully have a switch to allow that 
alternative syntax. But apart from that, I'd strongly caution against 
spending too much time on them except for pure hobby/research interest.


I am having some trouble compiling gtk pascal examples, the linker can't 
find -lgtk etc. It looks like it is a naming issue and I can create 
links to get myself out of trouble however,


As an adjunct to anything written by more experienced users such as Sven 
and Michael: you really need to tell us what version of FPC you're 
running, and what operating system etc. you're running on.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Basically on the right track?

2012-12-27 Thread Michael Van Canneyt



On Mon, 24 Dec 2012, Patrick wrote:


Hi Everyone

This is my first post here.

I have NOT read all the documentation, please forgive this but I was hoping 
to ask a couple of questions to make sure I am on the right track before 
diving into Pascal.


I fell in love with Ada about 14 months ago. Including the cardboard box, i 
now have 53lbs of Ada books(A few still to read), I am planning on diving 
into Pascal in this way too and  I want to mix Ada and Pascal. I found an 
example on the web last night and it looks easy. The only thing is the 
example used the gnu pascal compiler,


Question 1:
Can fpc create gcc compatible object code ?


gcc can use the object files. This is not a problem.

But things are not that simple. 
The FPC codebase requires certain symbols to be present, 
depending on the code you create.


These symbols are usually only generated when you create a program or library.

It means your ada project will have to
a) provide these symbols
b) initialize them correctly.



or

Question 2:
alternatively can gpc be used to compile the gtk binding?


The FPC list is the wrong list to ask that :)




I am having some trouble compiling gtk pascal examples, the linker can't find 
-lgtk etc. It looks like it is a naming issue and I can create links to get 
myself out of trouble however,


Sounds like you don't have the -dev packages installed.
Simply installing those will fix the issue. 
I would not recommend fiddling with links yourself.




Question 3:
Is it possible to specify the libraries to use to fpc ? In Ada we have .gpr 
files that can list where things are to be found.


What do you mean with this question ?

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


Re: [fpc-pascal] Basically on the right track?

2012-12-27 Thread Sven Barth

On 24.12.2012 20:26, Patrick wrote:

Question 1:
Can fpc create gcc compatible object code ?


As FPC can use GCC created object code the other way round should be 
possible, too. You only need to pay attention that FPC mangles the 
identifers. So a function "Bar(aArg: Integer): Integer" in unit "Foo" 
will in the object code have a name of something like 
"FOO_$$_BAR$INTEGER". So if you want to use Pascal functions from 
another language you should add a "[public: 'Bar']" after the function's 
declaration so that you can use the function by the name 'Bar'.



Question 2:
alternatively can gpc be used to compile the gtk binding?


I don't use GPC and thus can't comment on it. AFAIK GPC also relies on a 
quite old GCC version (3.x).



I am having some trouble compiling gtk pascal examples, the linker can't
find -lgtk etc. It looks like it is a naming issue and I can create
links to get myself out of trouble however,


Which GTK examples? Are you trying GTK (aka GTK 1) or GTK+ (aka GTK 2) 
examples? You need to have the correct development library installed for 
them (especially important if you are on a deb-based system like Debian 
or Ubuntu).




Question 3:
Is it possible to specify the libraries to use to fpc ? In Ada we have
.gpr files that can list where things are to be found.


FPC relies on the search paths that the system knows. You can specify 
additional paths using "-Fl/path" and then those paths will be searched 
first.


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