Segmentation fault with cthreads on FreeBSD

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Segmentation fault with cthreads on FreeBSD

Free Pascal - General mailing list
Following program

program test;
{$IFDEF UNIX}
uses cthreads;
{$ENDIF}
begin
     writeln('test');
end.

Compile with FPC 3.0.4 on FreeBSD 12. When run test program, it causes segmentation fault. 

What is wrong? Without cthreads unit, it run fine.

Zamrony P. Juhara
https://v3.juhara.com
https://github.com/zamronypj

Fano Framework
https://fanoframework.github.io

mod_pascal
https://zamronypj.github.io/mod_pascal

_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault with cthreads on FreeBSD

Marco van de Voort-2

Op 2020-06-08 om 10:14 schreef Zamrony P. Juhara via fpc-pascal:

> Following program
>
> program test;
> {$IFDEF UNIX}
> uses cthreads;
> {$ENDIF}
> begin
>  writeln('test');
> end.
>
> Compile with FPC 3.0.4 on FreeBSD 12. When run test program, it causes
> segmentation fault.
>
> What is wrong? Without cthreads unit, it run fine.
>
Possibly a linker issue. See if you can change the linker to ld.bfd
_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault with cthreads on FreeBSD

Free Pascal - General mailing list
In reply to this post by Free Pascal - General mailing list
Hello.

When compiling your code with fpc installed from freebsd package:

$ sudo pkg install fpc
$ sudo pkg install lang/fpc-units

All is OK, your test.pas run as expected.

But compiling your code with fpc compiled from source, there is indeed that
error message:
fish: "./test" terminated by signal SIGSEGV 5Address boundary error)



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault with cthreads on FreeBSD

Free Pascal - General mailing list
@fredvs yes I install from source code.

Zamrony P. Juhara
https://v3.juhara.com
https://github.com/zamronypj

Fano Framework
https://fanoframework.github.io

mod_pascal
https://zamronypj.github.io/mod_pascal

On Tue, Jun 9, 2020 at 0:12, fredvs via fpc-pascal
Hello.

When compiling your code with fpc installed from freebsd package:

$ sudo pkg install fpc
$ sudo pkg install lang/fpc-units

All is OK, your test.pas run as expected.

But compiling your code with fpc compiled from source, there is indeed that
error message:
fish: "./test" terminated by signal SIGSEGV 5Address boundary error)



--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Segmentation fault with cthreads on FreeBSD

Free Pascal - General mailing list
> @fredvs yes I install from source code.

Hum, so, imho, the MakeFile provided by official FPC download source has
something wrong.
I did try to using fpmake to re-create it but the resulted MakeFile did not
fix the problem.

Maybe the creator of the fpc FreeBSD package could give some light what to
change in the MakeFile.

I used this script:

!/bin/sh
COMPILER=/usr/local/lib/fpc/3.0.4/ppcx64
gmake clean
gmake all FPC=$COMPILER OPT="-Fl/usr/local/lib"
gmake FPC=$COMPILER install INSTALL_PREFIX=/usr/local/

This compiles and install fpc 3.0.4 but, like explained, your application
compiles ok but crash while running.

A contrario the compiler installed via the official pkg of FreeBSD gives a
compiled program that runs ok:

$ sudo pkg update
$ sudo pkg install fpc
$ sudo pkg install lang/fpc-units





--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal