Without sudo the LED does not react, so sudo (root rights) are needed. That is also stated in the documentation of the PascalIO Package.
There's something wrong there, since you've already said that you're in the gpio group.
I did some tracing an added some more code. The error occurs at FpOpen('/sys/class/gpio//gpio12/direction', O_WRONLY); Error 9: Bad file number.
I checked UserID, GroupID and ProcessID with and without debugging, but they where the same.
Does that actually exist? I was looking at those devices in a slightly different context a few days ago
https://forum.lazarus.freepascal.org/index.php/topic,53365.msg395471.html#msg395471 and there definitely wasn't a gpio12 on my Rpi.
# ls -l /sys/class/gpio
...the leading # is a convention that indicates that your shell login is root, you'll usually get there using
sudo su or similar.
Is there a way to run the program from the IDE with root privileges? Maybe via "run"->"run parameters"->"launching application"?
Ouch. Short answer: no, longer answer (again, slightly different context)
https://forum.lazarus.freepascal.org/index.php/topic,53541.msg396133.html#msg396133What you can do however is run your program using gdbserver as root i.e. something like (in my case)
# gdbserver :2345 ./Watchxxx-x86_64-linux-gtk2
In the IDE you'll need Tools -> Options -> Debugger -> Debugger backend -> Debugger type and path set to gdbserver, and Debugger_Remote_Port set to 2345 to match the command. You might also need to install gdbserver if it's not on your system already... that's fairly foolproof but I've had the occasional problem with it at the GPIO level.
I've just tried using
/usr/bin/sudo -A -k -E as the "Launching application" without success, even though that works as part of the build sequence.
I'm afraid I'm out shortly for a few hours so if you choose to try that I won't be able to advise until later.
MarkMLl