Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building shared monolithic library on MSYS/MinGW64, can't locate wxwidgets libraries #138

Open
sokolas opened this issue Jan 2, 2025 · 1 comment

Comments

@sokolas
Copy link

sokolas commented Jan 2, 2025

I've tried building wxlua and wxwidgets as a static library (as described here), and everything works fine. Now, I need to have wxWidgets as a shared library, to expose some of its functionality to other libraries I plan to use. So, I've build wxWidgets 3.2.6 and 3.2.2.1 (not sure if the version is relevant, as the issue is related to finding the libraries) as a shared monolithic library:

./configure --prefix="$INSTALL_DIR"  --disable-debug \
    --enable-monolithic \
    --enable-compat30 \
    --enable-privatefonts \
    --with-libjpeg=builtin --with-libpng=builtin --with-libtiff=builtin --with-expat=builtin \
    --with-zlib=builtin \
    CFLAGS="-Os" CXXFLAGS="-Os -DNO_CXX11_REGEX"
  make -j1 SHARED=1 || { echo "Error: failed to build wxWidgets"; exit 1; }
  make install

The result is libwx_mswu-3.2.dll.a in INSTALL_DIR/lib and wxmsw32u_gcc_custom.dll in INSTALL_DIR/bin. Then I'm trying to build wxlua like this:

cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" -DCMAKE_BUILD_TYPE=MinSizeRel-DBUILD_SHARED_LIBS=TRUE \
    -DCMAKE_CXX_FLAGS="-DLUA_COMPAT_MODULE" \
    -DwxWidgets_CONFIG_EXECUTABLE="$INSTALL_DIR/bin/wx-config" \
    -DwxWidgets_COMPONENTS="mono" \
    -DwxLuaBind_COMPONENTS="xrc;xml;media;richtext;propgrid;gl;html;adv;core;net;base" \
    -DwxLua_LUA_LIBRARY_USE_BUILTIN=FALSE \
    -DwxLua_LUA_INCLUDE_DIR="$INSTALL_DIR/include/luajit-2.1" -DwxLua_LUA_LIBRARY="$INSTALL_DIR/lib/lua$LUAV.dll" .
  (cd modules/luamodule; make $MAKEFLAGS) || { echo "Error: failed to build wxLua"; exit 1; }
  (cd modules/luamodule; make install)

and I get the following result:

-- Found wxWidgets: -L/home/user/built_test_dynamic_2024-12-31/deps/lib;;;-Wl,--subsystem,windows;-mwindows;-lwx_mswu-3.2 (found version "3.2.6")
-- *
-- * Found wxWidgets :
CMake Warning at build/CMakewxAppLib.cmake:564 (message):
  WARNING: Unable to find wxWidgets_PORTNAME/UNIVNAME/UNICODEFLAG/DEBUGFLAG
  from lib names! You may have to add code to CMake to help it parse your
  wxWidgets lib names.
Call Stack (most recent call first):
  build/CMakewxAppLib.cmake:322 (PARSE_WXWIDGETS_LIB_NAMES)
  CMakeLists.txt:58 (FIND_WXWIDGETS)


-- * - wxWidgets_VERSION           = 3.2.6 = 3.2.6
-- * - wxWidgets_COMPONENTS        = scintilla;mono
-- * - wxWidgets_INCLUDE_DIRS      = I:/msys64/home/user/built_test_dynamic_2024-12-31/deps/lib/wx/include/msw-unicode-3.2;I:/msys64/home/user/built_test_dynamic_2024-12-31/deps/include/wx-3.2
-- * - wxWidgets_LIBRARY_DIRS      =
-- * - wxWidgets_LIBRARIES         = -L/home/user/built_test_dynamic_2024-12-31/deps/lib;;;-Wl,--subsystem,windows;-mwindows;-lwx_mswu-3.2
-- * - wxWidgets_CXX_FLAGS         =
-- * - wxWidgets_DEFINITIONS       = _FILE_OFFSET_BITS=64;wxDEBUG_LEVEL=0;WXUSINGDLL;__WXMSW__
-- * - wxWidgets_DEFINITIONS_DEBUG =
-- * - wxWidgets_PORTNAME          =
-- * - wxWidgets_UNIVNAME          =
-- * - wxWidgets_UNICODEFLAG       =
-- * - wxWidgets_DEBUGFLAG         =

I think the issue lies somewhere in the wx-config, because when I call it I get the following:

./wx-config --libs mono
-L/home/user/built_test_dynamic_2024-12-31/deps/lib   -Wl,--subsystem,windows -mwindows -lwx_mswu-3.2

There's no .a or .dll that the cmake script relies on to parse the configuration here.

Same goes for non-monolithic build, but the libraries output is a bit different:

Found wxWidgets: -L/home/user/build_test_dynamic_separate/deps/lib;;;-Wl,--subsystem,windows;-mwindows;-lwx_mswu_xrc-3.2;-lwx_baseu_xml-3.2;-lwx_mswu_media-3.2;-lwx_mswu_richtext-3.2;-lwx_mswu_propgrid-3.2;-lwx_mswu_gl-3.2;-lwx_mswu_html-3.2;-lwx_mswu_core-3.2;-lwx_baseu_net-3.2;-lwx_baseu-3.2 (found version "3.2.2")

As you can see, there's no .a or .dll as well.

Is there any way to fix this build?

@sokolas
Copy link
Author

sokolas commented Jan 8, 2025

I could somewhat resolve the issue by building everything using MSVC, but the discussion may still have some worth for those who prefer GCC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant