Reuben Thomas wrote:
> Thanks, I'd got as far as -fPIC, but not the cross-platform version.
> ...
> What's the symptom I should get in normal use?
When creating the shared library, the linker would complain about a
"relocation in text segment". It doesn't do so on new Linux distros
where the system compiler enables -fPIE by default (in order for
ASLR to work). It also doesn't do so on i386 (since there, for
historical reasons, relocations in the text segment are allowed;
they merely reduce the performance).
OK, I've now added $lt_cv_prog_compiler_pic to CFLAGS when building (embedded) libiconv. This seems to add -DPIC on MSYS2 (Mingw64). I am building with --disable-shared, because I don't want to install a libiconv shared library, to avoid conflicts. However, libtool can't link a static library into a shared library on mingw64.
I guess two options are i) somehow build libiconv as a convenience library (can I do that without patching its build system?) or ii) build the shared library but install it in pkglibdir.
I've successfully implemented option ii) on GNU/Linux, I'm currently stuck on getting it working on macOS. I think I also got it working on Windows, but I can't remember, to be honest (in CI, macOS is tried and breaks first, killing the Windows jobs).
I will get back to this at some point.
I guess another option is simply to declare a dependency on GNU libiconv, and to require it is installed *somewhere*, and make that the user's problem (including communicating where it is installed to Recode's build system), but that doesn't seem very nice.