rrthomas / enchant

enchant spellchecking library
http://rrthomas.github.io/enchant/
GNU Lesser General Public License v2.1
347 stars 60 forks source link

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

Closed OlehVinichenko closed 7 months ago

OlehVinichenko commented 7 months ago

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.

manisandro commented 7 months ago

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]
rrthomas commented 7 months ago

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

xry111 commented 7 months ago

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

rrthomas commented 7 months ago

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

rrthomas commented 7 months ago

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.