I don’t know if it will be useful, but I’m wondering what this log’s content is.
cd /var/discourse
./launcher enter app
cat /var/www/discourse/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/rbtrace-0.5.1/mkmf.log
And see if you can copy-paste the content here.