enchant icon indicating copy to clipboard operation
enchant copied to clipboard

enchant 2.7.0 fails to build with --disable-relocatable.

Open OlehVinichenko opened this issue 4 months ago • 5 comments

with --disable-relocatable option, which has worked for <2.7.0 version build would fail with:

libtool: link: ( cd ".libs" && rm -f "libenchant-2.la" && ln -s "../libenchant-2.la" "libenchant-2.la" )
/bin/sh ../libtool  --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc  -march=skylake -O2 -pipe  -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -o enchant-2 enchant.o libenchant-2.la -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0  ../lib/libgnu.la
/bin/sh ../libtool  --tag=CC   --mode=link x86_64-pc-linux-gnu-gcc  -march=skylake -O2 -pipe  -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -o enchant-lsmod-2 enchant-lsmod.o libenchant-2.la -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0  ../lib/libgnu.la
libtool: link: x86_64-pc-linux-gnu-gcc -march=skylake -O2 -pipe -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -o .libs/enchant-2 enchant.o -Wl,--export-dynamic  ./.libs/libenchant-2.so -lgmodule-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 ../lib/.libs/libgnu.a -pthread -Wl,-rpath -Wl,/usr/lib64
libtool: link: x86_64-pc-linux-gnu-gcc -march=skylake -O2 -pipe -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -o .libs/enchant-lsmod-2 enchant-lsmod.o -Wl,--export-dynamic  ./.libs/libenchant-2.so -lgmodule-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 ../lib/.libs/libgnu.a -pthread -Wl,-rpath -Wl,/usr/lib64
/usr/lib/gcc/x86_64-pc-linux-gnu/12.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: ./.libs/libenchant-2.so: undefined reference to `set_relocation_prefix'
collect2: error: ld returned 1 exit status
/usr/lib/gcc/x86_64-pc-linux-gnu/12.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: ./.libs/libenchant-2.so: undefined reference to `set_relocation_prefix'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:716: enchant-2] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [Makefile:720: enchant-lsmod-2] Error 1

when manually setting --enable-relocatable, build is fine and enchant is compiled.

OlehVinichenko avatar Apr 22 '24 04:04 OlehVinichenko

Probably related:

api.vala: In function 'enchant_set_prefix_dir':
api.vala:35:2: error: implicit declaration of function 'set_relocation_prefix' [-Wimplicit-function-declaration]
api.vala:35:2: warning: nested extern declaration of 'set_relocation_prefix' [-Wnested-externs]

manisandro avatar Apr 22 '24 07:04 manisandro

Thanks, and apologies, this has happened before. I'll add a test to CI when I fix this.

rrthomas avatar Apr 22 '24 10:04 rrthomas

FWIW it can be worked around by removing src/api.c but it will then require valac to regenerate this file.

xry111 avatar Apr 22 '24 11:04 xry111

Thanks @xry111, that also tells me that the bug is effectively hard-wiring configuration into the generated C, oops.

rrthomas avatar Apr 22 '24 11:04 rrthomas

The problem is that currently there are #ifs in the Vala code that depend on the configuration. So if you want to change the configuration, you have to recompile the Vala (as @xry111 observed). I need to remove preprocessor directives from the Vala code and replace them with C #ifdefs.

rrthomas avatar Apr 22 '24 21:04 rrthomas