[fpc-pascal] Segmentation fault with cthreads on FreeBSD

2020-06-08 Thread 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.

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  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Segmentation fault with cthreads on FreeBSD

2020-06-08 Thread Marco van de Voort


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  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Segmentation fault with cthreads on FreeBSD

2020-06-08 Thread 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  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Segmentation fault with cthreads on FreeBSD

2020-06-08 Thread Zamrony P. Juhara via fpc-pascal
@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 wrote:   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  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
  
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Segmentation fault with cthreads on FreeBSD

2020-06-08 Thread fredvs via fpc-pascal
> @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  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal