[cfe-dev] Why clang may not be compatible with gcc for .a file generation?

Joerg Sonnenberger via cfe-dev cfe-dev at lists.llvm.org
Thu Jan 24 06:32:00 PST 2019


On Wed, Jan 23, 2019 at 09:00:20PM -0600, Peng Yu via cfe-dev wrote:
> Then, I run configure from a GNU package, which gives the following
> error. It asks to recompile the .a with -fPIC. Is it because gcc and
> clang has different default on whether -fPIC is enabled? Could anybody
> help explain why there is such a difference? Thanks.

On some platforms GCC will create PIE by default. If clang doesn't match
that, it would certainly explain what you see. Try to compile your code
with -fPIE.

Joerg


More information about the cfe-dev mailing list