Forum OpenACS Q&A: Response to nsopenssl build problem

Collapse
Posted by Drazen Kacar on
ld: fatal: relocations remain against allocatable but non-writable sections
means that you have not compiled your code with PIC flag. The linker doesn't throw that error by default, but gcc asks for it behind your back. So recompile with -fPIC.

The sections in question are ELF sections. Allocatable means that they will be placed into the object you are building (your shared library) and non-writable means read-only, ie. the text segment. That's the part with the code. It's supposed to be shared among all processes which use that library, but it cannot be shared unless the code was compiled with PIC flag.

So the compiler is trying to do you a favor by asking linker to throw an error if you forget to specify PIC flag when compiling.

I have no idea why AOLserver Makefiles want to build modules directly with ld or with gcc's -nostartfiles option. As far as I can tell, that's a bug.