cmajor-lang / cmajor

The Cmajor public repository
https://cmajor.dev
Other
534 stars 31 forks source link

Make Cmajor library relocatable on Linux #57

Closed tomikaa87 closed 6 months ago

tomikaa87 commented 6 months ago

Hi,

I've tried building Cmajor on Kubuntu Linux 22.04.4 with GCC 11.4, and I got the following error regarding a linker failure.

/usr/bin/ld: tools/CmajDLL/CMakeFiles/performer_cmaj_lib.dir/__/__/modules/compiler/src/diagnostics/cmaj_ErrorHandling.cpp.o: relocation R_X86_64_TPOFF32 against `_ZN4cmajL13activeHandlerE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status

As the compiler suggested, I've added the missing flag to the Cmajor library to make it position-independent.

cesaref commented 6 months ago

Thanks for this - I actually found this last week when reviewing a compile problem with later gcc versions on linux - we trigger the compile for this module from another CmakeLists.txt which has this option set, so it masked the issue with the public repo cmake compilation. The android build suffers the same issue.

Our updates take a somewhat circuitous route to make it to the public repo, so we can't directly accept pull requests, but thanks again for the feedback.