Here is explained how to gain access to the peripheral without being root. I've just tried in my environment (Raspbian Stretch, RPi2, Qt5.9) in this way:
int main(int argc, char *argv[])
{
QCoreApplication::setSetuidAllowed(true);
QCoreApplication a(argc, argv);
MyServer server;
return a.exec();
}
then, on the target:
$ sudo chown root:root MyServer
$ sudo chmod u+s MyServer
but running it as normal user leads to a segmentation fault. Here's the output of gdb:
$ gdb MyServer
...
run(gdb) run
Starting program: /home/pi/bin/MyServer
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
bcm2835_init: Unable to open /dev/mem: Operation not permitted
...
Am I missing some steps?