[m-users.] aarch64 runtime reports "caught segmentation violation"
Julien Fischer
jfischer at opturion.com
Tue May 17 23:06:57 AEST 2022
Hi,
On Tue, 17 May 2022, Van Ly wrote:
> The aarch64 Mercury runtime on Rpi 4B 8GB is unable to run a
> "hello world" example. Any ideas on how to proceed? Details follow.
...
> $ mmc --make hello
> Making Mercury/int3s/hello.int3
> Making Mercury/ints/hello.int
> Making Mercury/cs/hello.c
> Making Mercury/os/hello.o
> Making hello
>
> $ ./hello
>
> *** Mercury runtime: caught segmentation violation ***
> cause: address not mapped to object
> address involved: (nil)
> This may have been caused by a stack overflow, due to unbounded recursion.
> exiting from signal handler
> Segmentation fault
The first question would be: what compilation grade is being used to
compile hello.m? (Based on the above runtime error message and the
platform, I guess it would be asm_fast.gc.)
Some things to try:
1. Is this is an issue related to the use of shared Mercury libraries
on that system? You can check by compiling with:
$ mmc --mercury-linkage static hello
and see if that then works.
2. Is it some issue with the C compiler on that system? Forcing -O0 in
the C compiler when building and installing Mercury and also compiling
your program would be the way to check that.
The former can be done by placing a file named Mmake.params at the
top-level of the Mercury source tree containing the following:
EXTRA_CFLAGS = -O0
The latter can be done by:
$ mmc --cflags "-O0" hello
3. If the compilation grade you are using (see above) is asm_fast.gc,
then you may want to install and use a high-level C grade (e.g. hlc.gc)
instead. They are generally a bit more forgiving of portability issues.
Julien.
More information about the users
mailing list