Sign in Join

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

Mailing lists / fpc-pascal / 2020-06

Segmentation fault with cthreads on FreeBSD

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Marco van de Voort
to Zamrony P. Juhara

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

Show quoted text 15 lines
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

fredvs
to Zamrony P. Juhara: Following program program test;{$IFDEF UNIX}uses cthreads;{$ENDIF}begin   …

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)

Zamrony P. Juhara
to fredvs

@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)

fredvs
to Zamrony P. Juhara
@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