How to deal with ld error: 'can not be used when making a PIE object; recompile with -fPIC'?

Since the systemc library is a static library, its default for POSITION_INDEPENDENT_CODE is false. You need to set it to true and rebuild the systemc library. That should fix the error you’re seeing. You may find the CMAKE_POSITION_INDEPENDENT_CODE variable to be useful if you need to set this across a number of targets rather than just this one case.