On Mon, 3 Nov 2025 at 21:30, Georg Baum <[email protected]> wrote:
> Am 03.11.25 um 00:21 schrieb Thibaut Cuvelier: > > Hi all, > > > > I'm trying to build LyX at head, but MSVC isn't too happy with libiconv > > 1.18: > > > > D:\LyX\lyx\3rdparty\libiconv\1.18\lib\genflags.c(37): error C2016: C > > requires that a struct or union have at least one member > > D:\LyX\lyx\3rdparty\libiconv\1.18\lib\genflags.c(38): error C2016: C > > requires that a struct or union have at least one member > > D:\LyX\lyx\3rdparty\libiconv\1.18\lib\genflags.c(39): error C2016: C > > requires that a struct or union have at least one member > > > > I'm not sure what I can do, as it's in generated code⦠Apparently, it's > > not really legal C code, which MSVC and GCC/Clang resolve differently > > (e.g., https://stackoverflow.com/questions/78525821/handling-c2016- > > error-on-windows-using-visual-studio-code <https://stackoverflow.com/ > > questions/78525821/handling-c2016-error-on-windows-using-visual-studio- > > code>). > > Maybe it is not even needed for our usage of libiconv. In the old > version genflags.c was not compiled, but I did not understand why. > > Can you please try to exclude genflags.c from the build? If that does > not produce a linker error then this is the best solution IMHO. I did just that in b0e815cd95: the linker doesn't say anything and LyX runs without trouble. We could go one step further and remove all the code generators (as in the accompanying patch), it might also reduce LyX' binary size (but that would probably be the only benefit). As the version in the LyX Git history already has flags.h, genflags.c doesn't seem to be particularly useful. diff --git a/3rdparty/libiconv/CMakeLists.txt b/3rdparty/libiconv/CMakeLists.txt --- a/3rdparty/libiconv/CMakeLists.txt (revision b0e815cd952fc2feb25d3c033a004ee951185c98) +++ b/3rdparty/libiconv/CMakeLists.txt (date 1762203740489) @@ -64,7 +64,7 @@ set(SRC_LIBCHARSET ${SRCDIR}/libcharset/lib/localcharset.c) # libiconv -set(SRC_LIBICONV ${SRCDIR}/lib/compat.c ${SRCDIR}/lib/genaliases2.c ${SRCDIR}/lib/genaliases.c ${SRCDIR}/lib/gentranslit.c ${SRCDIR}/lib/iconv.c) +set(SRC_LIBICONV ${SRCDIR}/lib/compat.c ${SRCDIR}/lib/iconv.c) add_library(iconv ${SRC_LIBICONV} ${SRC_LIBCHARSET}) set_target_properties(iconv PROPERTIES COMPILE_FLAGS -DBUILDING_LIBICONV) @@ -73,13 +73,8 @@ set(ICONV_LIBRARY iconv CACHE STRING "libiconv library" FORCE) set(ICONV_FOUND iconv CACHE STRING "libiconv found" FORCE) -foreach(_base iconv genaliases2 genaliases) - handle_source_option("CC" ${SRCDIR}/lib/${_base}.c -Wno-unused-macros) -endforeach() +handle_source_option("CC" ${SRCDIR}/lib/iconv.c -Wno-unused-macros -Wno-cast-align -Wno-parentheses-equality -Wno-static-in-inline -Wno-unused-parameter -Wno-sign-compare -Wno-type-limits -Wno-missing-field-initializers -Wno-redundant-decls -Wno-implicit-fallthrough -Wno-strict-prototypes) -handle_source_option("CC" ${SRCDIR}/lib/iconv.c -Wno-cast-align -Wno-parentheses-equality -Wno-static-in-inline -Wno-unused-parameter -Wno-sign-compare -Wno-type-limits -Wno-missing-field-initializers -Wno-redundant-decls -Wno-implicit-fallthrough -Wno-strict-prototypes) -handle_source_option("CC" ${SRCDIR}/lib/genaliases2.c -Wno-unused-but-set-variable -Wno-unused-function) -handle_source_option("CC" ${SRCDIR}/lib/gentranslit.c -Wno-format) set_target_properties(iconv PROPERTIES FOLDER "3rd_party" INTERPROCEDURAL_OPTIMIZATION ${LYX_IPO_SUPPORTED})
-- lyx-devel mailing list [email protected] https://lists.lyx.org/mailman/listinfo/lyx-devel
