Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2005-06

Library and unit search paths under MacOSX with fpc 2.0.0?

13 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Tom Verhoeff

I have a "standard release" installation of fpc 2.0.0 under Mac OS X.

I installed GTK through fink (as explained in the Lazarus wiki). This has given me GTK 1.2.10. No problems so far.

When I try to compile the following simple GTK Pascal tutorial program

PROGRAM base;
USES gtk;
VAR window : pGtkWidget;
BEGIN
  gtk_init(@argc, @argv); { Initialise GTK }
  window := gtk_window_new(GTK_WINDOW_TOPLEVEL);  { Create a new window }
  gtk_widget_show(window);
  gtk_main();
END.

with fpc, I need to add the following command-line options

-Fl/sw/lib -Fl/usr/X11R6/lib

as well as

-Fu/usr/local/lib/fpc/2.0.0/units/powerpc-darwin/gtk

The first two caught me by surprise, but some tracking resolved this. However, under Linux, I don't need to specify further library locations. How come?

Is there any documentation where this can be found? Is there a place where I can put this info in the FPCWiki?

But the need for -Fu is downright strange, because the "standard" /etc/fpc.cfg (which I have not changed) has the line

-Fu/usr/local/lib/fpc/2.0.0/units/$fpctarget/*

Why does it not find the gtk directory? Under Linux it simply works.

In fact, when I try to compile Lazarus under Mac OS X with

make clean all

it dies with

Fatal: Can't find unit Contnrs

It should find the Contnrs unit in

/usr/local/lib/fpc/2.0.0/units/powerpc-darwin/fcl

which should be searched because of the -Fu line shown above in /etc/fpc.cfg.

What is the problem? And how can it be repaired?

Best regards,

Tom

E-MAIL: T.Verhoeff @ TUE.NL | Fac. of Math. & Computing Science PHONE: +31 40 247 41 25 | Eindhoven University of Technology FAX: +31 40 247 54 04 | PO Box 513, NL-5600 MB Eindhoven http://www.win.tue.nl/~wstomv/ | The Netherlands

Reply by email

Ales Katona
to Tom Verhoeff

Your fpc.cfg file is ether not existing, in the wrong place or wrongly configured. I don't know where it should be on MacOSX but if you find it fix the -Fu entries so they point to right locations(note: $fpcversion etc. are variables, leave them as they are: for example in here: -Fu/usr/local/lib/fpc/$fpcversion/units/*

Ales

Tom Verhoeff wrote 63 lines
I have a "standard release" installation of fpc 2.0.0 under Mac OS X. I installed GTK through fink (as explained in the Lazarus wiki). This has given me GTK 1.2.10. No problems so far. When I try to compile the following simple GTK Pascal tutorial program PROGRAM base; USES gtk; VAR window : pGtkWidget; BEGIN gtk_init(@argc, @argv); { Initialise GTK } window := gtk_window_new(GTK_WINDOW_TOPLEVEL); { Create a new window } gtk_widget_show(window); gtk_main(); END. with fpc, I need to add the following command-line options -Fl/sw/lib -Fl/usr/X11R6/lib as well as -Fu/usr/local/lib/fpc/2.0.0/units/powerpc-darwin/gtk The first two caught me by surprise, but some tracking resolved this. However, under Linux, I don't need to specify further library locations. How come? Is there any documentation where this can be found? Is there a place where I can put this info in the FPCWiki? But the need for -Fu is downright strange, because the "standard" /etc/fpc.cfg (which I have not changed) has the line -Fu/usr/local/lib/fpc/2.0.0/units/$fpctarget/* Why does it not find the gtk directory? Under Linux it simply works. In fact, when I try to compile Lazarus under Mac OS X with make clean all it dies with Fatal: Can't find unit Contnrs It should find the Contnrs unit in /usr/local/lib/fpc/2.0.0/units/powerpc-darwin/fcl which should be searched because of the -Fu line shown above in /etc/fpc.cfg. What is the problem? And how can it be repaired? Best regards, Tom

Reply by email

Micha Nelissen
to Ales Katona
Your fpc.cfg file is ether not existing, in the wrong place or wrongly configured. I don't know where it should be on MacOSX but if you find it

It's not so simple, I think, because otherwise he also wouldn't find RTL units like system and sysutils. It seems the '*' construct doesn't work on MacOSX ?

Micha

Reply by email

Ales Katona
to Micha Nelissen
Micha Nelissen wrote 20 lines
On Wed, 15 Jun 2005 08:29:54 +0200 Ales Katona wrote: >Your fpc.cfg file is ether not existing, in the wrong place or wrongly >configured. I don't know where it should be on MacOSX but if you find it > > It's not so simple, I think, because otherwise he also wouldn't find RTL units like system and sysutils. It seems the '*' construct doesn't work on MacOSX ? Micha _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Actualy I get "contnrs" missing too if I put fpc.cfg away..

Ales

Reply by email

Marc Weustink
to Micha Nelissen: On Wed, 15 Jun 2005 08:29:54 +0200 It's not so simple, I think, because otherwise he also…
Micha Nelissen wrote 9 lines
On Wed, 15 Jun 2005 08:29:54 +0200 Ales Katona wrote: >Your fpc.cfg file is ether not existing, in the wrong place or wrongly >configured. I don't know where it should be on MacOSX but if you find it It's not so simple, I think, because otherwise he also wouldn't find RTL units like system and sysutils. It seems the '*' construct doesn't work on MacOSX ?

It does (and you have it seen working :)

To Tom:
Try to compile with -va and look at the output to find out what files are searched.

Marc

Reply by email

Tom Verhoeff
to Marc Weustink
Marc Weustink wrote 7 lines
Micha Nelissen wrote: >On Wed, 15 Jun 2005 08:29:54 +0200 >Ales Katona wrote: > > >>Your fpc.cfg file is ether not existing, in the wrong place or wrongly >>configured. I don't know where it should be on MacOSX but if you find it

It is installed in /etc/fpc.cfg and that is where I have left it, and where fpc on Mac OS X searches for it. But read on ...

Show quoted text 5 lines
>It's not so simple, I think, because otherwise he also wouldn't find RTL >units like system and sysutils. It seems the '*' construct doesn't work on >MacOSX ? It does (and you have it seen working :)

Well, rtl is mentioned separately as well, even though it is subsumed in the *. Actually .../* occurs before .../rtl in fpc.cfg; isn't that a bit odd? I could imagine that you put .../rtl before .../* so that it finds rtl units quicker. But the other way round doesn't make sense to me. You might as well leave out .../rtl. Did I miss something?

To Tom: Try to compile with -va and look at the output to find out what files are searched.

Thank you. I just did, and Aaargghh ... shame on me. I still had a ~/.fpc.cfg from a very early installation, and it was no good for the current installation. This resolves the issue of finding the units gtk and contnrs.

However, it still doesn't explain why under Linux, I don't have to add any extra library search paths, but under Mac OS X, I do (N.B. without the -Fl... it still does not work, even now that the right fpc.cfg is used).

Furthermore, Lazarus will still not compile. It gets quite a bit further now, but it chokes on compiling PropertyStorage.pas with

Fatal: Can't find unit RTLConst

It turns out that I do have rtlconsts.ppu, that is, with an extra 's'. I suspect this is a Lazarus issue.

Tom

E-MAIL: T.Verhoeff @ TUE.NL | Fac. of Math. & Computing Science PHONE: +31 40 247 41 25 | Eindhoven University of Technology FAX: +31 40 247 54 04 | PO Box 513, NL-5600 MB Eindhoven http://www.win.tue.nl/~wstomv/ | The Netherlands

Reply by email

Vincent Snijders
to Tom Verhoeff
Show quoted text 7 lines
Furthermore, Lazarus will still not compile. It gets quite a bit further now, but it chokes on compiling PropertyStorage.pas with Fatal: Can't find unit RTLConst It turns out that I do have rtlconsts.ppu, that is, with an extra 's'. I suspect this is a Lazarus issue.

Lazarus 0.9.6 (the latest released version) can't be compiled with fpc 2.0.0, because of the name change (the unit was called RTLConst in fpc 1.9.8).

Lazarus sources from cvs can be compiled with fpc 2.0.0

Vincent.

Reply by email

Jonas Maebe
to Tom Verhoeff: It is installed in /etc/fpc.cfg and that is where I have left it, and where fpc on Mac OS…
Tom Verhoeff wrote
However, it still doesn't explain why under Linux, I don't have to add any extra library search paths, but under Mac OS X, I do

That's because /sw/lib is not a default search path for the linker under Mac OS X (which is quite logical since fink is a third-party product), nor is /usr/X11R6/lib apparently.

I guess it would be best if added those paths to the default fpc.cfg for Mac OS X.

Jonas

Reply by email

Dr. Karl-Michael Schindler
to Jonas Maebe

Hi,

Jonas Maebe wrote 13 lines
On 15 jun 2005, at 14:24, Tom Verhoeff wrote: > However, it still doesn't explain why under Linux, I don't have to > add > any extra library search paths, but under Mac OS X, I do That's because /sw/lib is not a default search path for the linker under Mac OS X (which is quite logical since fink is a third-party product), nor is /usr/X11R6/lib apparently. I guess it would be best if added those paths to the default fpc.cfg for Mac OS X.

I also think, that this is probably the easiest was to resolve it. I hesitated to put that in, because I wanted the fpc.cfg to be as simple as possible.

The changed fpc.cfg file has to be put into the darwin bootstrap tar ball, which also contains the bootstrap compiler. sorry for the lack of documentation.
Actually my fpc.cfg file contains:

-Fl/usr/lib
-Fl/sw/lib
-Fl/usr/X11R6/lib

Should I put that into the darwin default fpc.cfg file?

Maybe, Ales could put his experiences to the wiki page. Just in case people using other libraries or installers. As much as I know darwinports puts its stuff into /opt.

Michael, aka mischi.

Reply by email

Jonas Maebe
to Dr. Karl-Michael Schindler
Dr. Karl-Michael Schindler wrote 6 lines
The changed fpc.cfg file has to be put into the darwin bootstrap tar ball, which also contains the bootstrap compiler. sorry for the lack of documentation. Actually my fpc.cfg file contains: -Fl/usr/lib

This one isn't necessary, it's automatically searched by the linker. / usr/local/lib could be added as well though.

-Fl/sw/lib -Fl/usr/X11R6/lib Should I put that into the darwin default fpc.cfg file?

Fine by me (possibly between #ifdef darwin)

Jonas

Reply by email

Dr. Karl-Michael Schindler
to Jonas Maebe
Jonas Maebe wrote 23 lines
On 15 jun 2005, at 15:35, Dr. Karl-Michael Schindler wrote: > The changed fpc.cfg file has to be put into the darwin bootstrap > tar ball, which also contains the bootstrap compiler. sorry for > the lack of documentation. > Actually my fpc.cfg file contains: > > -Fl/usr/lib > This one isn't necessary, it's automatically searched by the linker. /usr/local/lib could be added as well though. > -Fl/sw/lib > -Fl/usr/X11R6/lib > > Should I put that into the darwin default fpc.cfg file? > Fine by me (possibly between #ifdef darwin)

with darwin default fpc.cfg file, I meant the hand-crafted one that I put into the darwin bootstrap tar ball together with the bootstrap compiler. So, #ifdef darwin is not necessary. Until now, this tar ball is not created automatically.

When I get to update that tar ball, I will add /usr/local/lib.

Reply by email

Marco van de Voort
to Tom Verhoeff: I have a "standard release" installation of fpc 2.0.0 under Mac OS X. I installed GTK…
Show quoted text 11 lines
with fpc, I need to add the following command-line options -Fl/sw/lib -Fl/usr/X11R6/lib as well as -Fu/usr/local/lib/fpc/2.0.0/units/powerpc-darwin/gtk The first two caught me by surprise, but some tracking resolved this. However, under Linux, I don't need to specify further library locations. How come?

LD has some default paths (like /lib and /usr/lib) hardcoded. On some systems, the linker is modified to add non standard paths (/opt/lib /sw/lib /usr/local/lib, /usr/X11R6/lib) to these default paths, and some systems don't do this. BSD typically doesn't. (and requires /usr/local/lib to be included) Darwin, as a BSD derivative, seems to follow this.

I can only guess about the reasons, but two good ones are:
- running contributed software unmodified (GPL is considered non-free from BSD perspective and "dangerous"). Unlikely since they do other mods, but maybe good enough to be a historical one. There was a lot of opposition to switching to the GNU toolchain in the past.
- (the better IMHO) Non-core directories could be writable to a wider audience, leading to all kinds of trojan security dangers. This is also the reason why BSD separates /usr/lib and /usr/local/lib

Is there any documentation where this can be found? Is there a place where I can put this info in the FPCWiki?

More buildfaq work I think. But it is standard on *BSD and Unix in general (Solaris also has a few added paths, since the GNU toolchain is not globally installed). When I added this on my mac-mini I didn't even give a second thought.

(-Fu issues)

Odd. Do the Lazarus makefiles maybe disable fpc.cfg ? Try building with -OPT='-vt' or va and examine the (huge) output.

Reply by email

Marco van de Voort
to Dr. Karl-Michael Schindler: I also think, that this is probably the easiest was to resolve it. I hesitated to put…
Show quoted text 12 lines
Am 15.06.2005 um 14:47 schrieb Jonas Maebe: The changed fpc.cfg file has to be put into the darwin bootstrap tar ball, which also contains the bootstrap compiler. sorry for the lack of documentation. Actually my fpc.cfg file contains: -Fl/usr/lib -Fl/sw/lib -Fl/usr/X11R6/lib Should I put that into the darwin default fpc.cfg file?

No. This is not done on *BSD systems. The correct way is to make a .fpc.cfg.sample, and require root to install it explicitely.

Anything that is dangerous for root, should be explicitely done by root, never by an automated system.

Maybe, Ales could put his experiences to the wiki page. Just in case people using other libraries or installers. As much as I know darwinports puts its stuff into /opt.

/opt is a typical one. It is listed in the System V hier iirc.

You'll also want /usr/local/lib btw.

Reply by email