Closed yan12125 closed 1 month ago
Ah, it is because I put the chewing_*version()
methods in a separate file and so they are put in a separate object file.
Thanks for the fix! It's somewhat a surprise for me that WHOLE_ARCHIVE
breaks linking with sqlite on Windows.
Describe the bug
On Arch Linux, a test fails to link due to missing symbols:
Such errors happen after https://github.com/chewing/libchewing/pull/597
To Reproduce
git clone https://aur.archlinux.org/libchewing-git.git
cd libchewing-git && makepkg -s
(here I use the AUR package as it comes with a hack for ncurses - that's another issue I need to investigate and report)
Expected behavior Everything builds fine
Screenshots N/A
Platform (please complete the following information):
Additional context
Here,
chewing_version*
symbols are in a separate object file:Probably that's why those symbols are dropped during linking.
I can force usage of the object file with:
But that may not be scalable with more and more symbols.
A more general fix might be
--whole-archive
. CMake >= 3.24 can use theWHOLE_ARCHIVE
generator expression as indicated in https://stackoverflow.com/a/76761933. For example,Here
INTERFACE_LINK_LIBRARIES
is necessary, as the targetchewing_capi
created by corrosion is an inferface library: https://github.com/corrosion-rs/corrosion/blob/v0.5.0/cmake/Corrosion.cmake#L567