Board index » delphi » My GPC compiled programs always segfault

My GPC compiled programs always segfault

Decided to try out gpc, with fond memories of my TP days ...

I downloaded the latest gpc, and installed in on my RH 6.1 system.
The compiler runs without error, but the binaries it produces always
segfault when I run them.  Even trivial programs like Hello, world
dump core.  Ouch!

It's a linker/library problem I suspect, so what should I start checking?
On a gpc -v , ld was looking for a library like -lgpm (or mebbe -lgmp,
I'm working from memory here) and I had to make a symbolic link from
an existing libgpm.so.2.0.2 to libgpm.so so that ld would continue.
Perhaps that's it?

The system was previously healthy gcc-wise, and I have been able to
rebuild my kernel without problems.  What is the relationship between
having gpc and gcc installed on the same system?  Are they
inter-dependent?  Use the same libraries?

Is there any standard in gpc-land for static or dynamically linked
executables?  Or are things as they are in gcc-land (both types used
frequently)?

Thanks for any advice,
Rich

 

Re:My GPC compiled programs always segfault


Quote
>It's a linker/library problem I suspect, so what should I start checking?
>On a gpc -v , ld was looking for a library like -lgpm (or mebbe -lgmp,
>I'm working from memory here) and I had to make a symbolic link from
>an existing libgpm.so.2.0.2 to libgpm.so so that ld would continue.
>Perhaps that's it?

It could be; I'm no GPC expert, but we (FPC team) had also some problems
with GPM.

GPM > 1.17 changes structures(support for gpm in xterms added as one of the
reasons) , if the header files for the mouse support of
GPM are still at this level, it would explain the crash.

Re:My GPC compiled programs always segfault


In <86hvc1$...@nntpa.cb.lucent.com>,

Quote
Rich Abbot <r...@ldvmail.ldv.lucent.com> wrote:
> Decided to try out gpc, with fond memories of my TP days ...

> I downloaded the latest gpc, and installed in on my RH 6.1 system.
> The compiler runs without error, but the binaries it produces always
> segfault when I run them.  Even trivial programs like Hello, world
> dump core.  Ouch!

Did you get a GPC binary? In this case, it might be due to the glibc
incompatibilities (which cause frequent problems with binaries of
all kinds). Then, you might want to get the source and build GPC
yourself (which is not difficult on Linux).

If you did so already, please tell me the exact version of the GPC
and GCC sources used -- gpc-19991030 with gcc-2.95* should be fine.

Quote
> It's a linker/library problem I suspect, so what should I start checking?
> On a gpc -v , ld was looking for a library like -lgpm (or mebbe -lgmp,
> I'm working from memory here) and I had to make a symbolic link from
> an existing libgpm.so.2.0.2 to libgpm.so so that ld would continue.
> Perhaps that's it?

libgmp is used if the program uses the GMP unit -- the symlink you
made looks fine (with gmp instead of gpm), as 2.0.2 is the same
version I'm using, too, and the most recent one, AFAIK.

If you didn't use the GMP unit, it would be strange if GPC tries to
link the GMP library. It does link -lgpc which is its run time
system.

Quote
> The system was previously healthy gcc-wise, and I have been able to
> rebuild my kernel without problems.  What is the relationship between
> having gpc and gcc installed on the same system?  Are they
> inter-dependent?  Use the same libraries?

GPC can use any library GCC uses plus its own library (libgpc). In
particular, it uses libc, libm and libgcc by default, and further
libraries such as libgmp, librx or libncurses if GPC units are used
which require them.

Quote
> Is there any standard in gpc-land for static or dynamically linked
> executables?  Or are things as they are in gcc-land (both types used  
> frequently)?

As in gcc-land. You can try the `-static' switch to enforce static
linking (if you have static versions of all libs installed, but this
is probably the case), and see if it makes a difference.

Frank

PS: You also might want to write to the GPC mailing list
(g...@gnu.de, subscriptions under gpc-requ...@gnu.de). Perhaps
someone on the list knows more about the problem than me (I'm not
using RH myself)...

--
Frank Heckenbach, frank@[NOSPAM.REMOVE.THIS]g-n-u.de, http://fjf.gnu.de/
PGP and GPG keys:           http://fjf.gnu.de/plan
Pascal code, BP CRT bugfix: http://fjf.gnu.de/programs.html
Free GNU Pascal Compiler:   http://home.pages.de/~GNU-Pascal/

Other Threads