Good morning codesys world, I tried to install the "Shared Memory Communication" example under Raspberry PI 4. There is a problem in the execution of the myshm.c file. The file was regularly compiled with the "gcc myshm.c -o myshm -lrt" linux command. When I run the generated executable, I immediately receive a "Segmentation fault" error (see attached screenshoot). The file is the original downloaded from the codesys-store, how come it doesn't work? Can anyone help me?
SOLUTION FOUND !!! When executing the "./myshm" executable file, "sudo" must be prefixed for permission. Running the command "sudo ./myshm" always works well. I hope it can also be useful to someone else ...
π
3
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good morning codesys world, I tried to install the "Shared Memory Communication" example under Raspberry PI 4. There is a problem in the execution of the myshm.c file. The file was regularly compiled with the "gcc myshm.c -o myshm -lrt" linux command. When I run the generated executable, I immediately receive a "Segmentation fault" error (see attached screenshoot). The file is the original downloaded from the codesys-store, how come it doesn't work? Can anyone help me?
S.G.
SOLUTION FOUND !!! When executing the "./myshm" executable file, "sudo" must be prefixed for permission. Running the command "sudo ./myshm" always works well. I hope it can also be useful to someone else ...
I've to added in the programm myshm.c the line:
include <unistd.h> for compilation and running without errors on a Raspberri Pi 3</unistd.h>
Last edit: promaco 2020-12-21
Well, good to know, thanks!