Fix some compilation issues on BSD
Tested by: @madpilot, @nephele Refs: #5255
Differential Revision: https://code.wildfiregames.com/D3288