If somebody else needs it, I made a docker image with DJGPP compiler(based on gcc 14.2, targets i586). It also contains header/library files for GRX 2.49.
More info here:
https://hub.docker.com/r/jagholin/dosbox-gcc