Closed JaXt0r closed 1 year ago
Hi there, it looks like it's failing to load some codecvt
function. That's weird since phoenix does not directly use codecvt
which might indicate another issue. Can you try configuring the project with -DBUILD_SHARED_LIBS=OFF
? If that doesn't work, please post the contents of your CMake cache which you can get with cmake -B build -LA
.
Thank you for your fast reply.
I checked it... Unfortunately disabling shared libs with this flag didn't fix the error.
Here's my CMake cache output:
BUILD_SHARED_LIBS:BOOL=OFF
BUILD_SQUISH_EXTRA:BOOL=OFF
BUILD_SQUISH_WITH_ALTIVEC:BOOL=OFF
BUILD_SQUISH_WITH_OPENMP:BOOL=OFF
BUILD_SQUISH_WITH_SSE2:BOOL=ON
BUILD_TESTING:BOOL=ON
CMAKE_ADDR2LINE:FILEPATH=C:/ProgramData/chocolatey/bin/addr2line.exe
CMAKE_AR:FILEPATH=C:/ProgramData/chocolatey/bin/ar.exe
CMAKE_BUILD_TYPE:STRING=Release
CMAKE_COLOR_MAKEFILE:BOOL=ON
CMAKE_CXX_COMPILER:FILEPATH=C:/ProgramData/chocolatey/bin/c++.exe
CMAKE_CXX_COMPILER_AR:FILEPATH=C:/ProgramData/chocolatey/bin/gcc-ar.exe
CMAKE_CXX_COMPILER_RANLIB:FILEPATH=C:/ProgramData/chocolatey/bin/gcc-ranlib.exe
CMAKE_CXX_FLAGS:STRING=
CMAKE_CXX_FLAGS_DEBUG:STRING=-g
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
CMAKE_CXX_STANDARD_LIBRARIES:STRING=-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
CMAKE_C_COMPILER:FILEPATH=C:/ProgramData/chocolatey/bin/gcc.exe
CMAKE_C_COMPILER_AR:FILEPATH=C:/ProgramData/chocolatey/bin/gcc-ar.exe
CMAKE_C_COMPILER_RANLIB:FILEPATH=C:/ProgramData/chocolatey/bin/gcc-ranlib.exe
CMAKE_C_FLAGS:STRING=
CMAKE_C_FLAGS_DEBUG:STRING=-g
CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
CMAKE_C_STANDARD_LIBRARIES:STRING=-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
CMAKE_DLLTOOL:FILEPATH=C:/ProgramData/chocolatey/bin/dlltool.exe
CMAKE_EXE_LINKER_FLAGS:STRING=
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_GNUtoMS:BOOL=OFF
CMAKE_INSTALL_BINDIR:PATH=bin
CMAKE_INSTALL_DATADIR:PATH=
CMAKE_INSTALL_DATAROOTDIR:PATH=share
CMAKE_INSTALL_DOCDIR:PATH=
CMAKE_INSTALL_INCLUDEDIR:PATH=include
CMAKE_INSTALL_INFODIR:PATH=
CMAKE_INSTALL_LIBDIR:PATH=lib
CMAKE_INSTALL_LIBEXECDIR:PATH=libexec
CMAKE_INSTALL_LOCALEDIR:PATH=
CMAKE_INSTALL_LOCALSTATEDIR:PATH=var
CMAKE_INSTALL_MANDIR:PATH=
CMAKE_INSTALL_OLDINCLUDEDIR:PATH=/usr/include
CMAKE_INSTALL_PREFIX:PATH=C:/Program Files (x86)/test_lib
CMAKE_INSTALL_RUNSTATEDIR:PATH=
CMAKE_INSTALL_SBINDIR:PATH=sbin
CMAKE_INSTALL_SHAREDSTATEDIR:PATH=com
CMAKE_INSTALL_SYSCONFDIR:PATH=etc
CMAKE_LINKER:FILEPATH=C:/ProgramData/chocolatey/bin/ld.exe
CMAKE_MAKE_PROGRAM:FILEPATH=C:/ProgramData/chocolatey/bin/mingw32-make.exe
CMAKE_MODULE_LINKER_FLAGS:STRING=
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_NM:FILEPATH=C:/ProgramData/chocolatey/bin/nm.exe
CMAKE_OBJCOPY:FILEPATH=C:/ProgramData/chocolatey/bin/objcopy.exe
CMAKE_OBJDUMP:FILEPATH=C:/ProgramData/chocolatey/bin/objdump.exe
CMAKE_RANLIB:FILEPATH=C:/ProgramData/chocolatey/bin/ranlib.exe
CMAKE_RC_COMPILER:FILEPATH=C:/ProgramData/chocolatey/bin/windres.exe
CMAKE_RC_FLAGS:STRING=
CMAKE_RC_FLAGS_DEBUG:STRING=
CMAKE_RC_FLAGS_MINSIZEREL:STRING=
CMAKE_RC_FLAGS_RELEASE:STRING=
CMAKE_RC_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_READELF:FILEPATH=C:/ProgramData/chocolatey/bin/readelf.exe
CMAKE_SHARED_LINKER_FLAGS:STRING=
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
CMAKE_SKIP_RPATH:BOOL=NO
CMAKE_STATIC_LINKER_FLAGS:STRING=
CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=
CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=
CMAKE_STRIP:FILEPATH=C:/ProgramData/chocolatey/bin/strip.exe
CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
COVERAGE_COMMAND:FILEPATH=C:/ProgramData/chocolatey/bin/gcov.exe
COVERAGE_EXTRA_FLAGS:STRING=-l
CTEST_SUBMIT_RETRY_COUNT:STRING=3
CTEST_SUBMIT_RETRY_DELAY:STRING=5
DART_TESTING_TIMEOUT:STRING=1500
DOCTEST_NO_INSTALL:BOOL=OFF
DOCTEST_USE_STD_HEADERS:BOOL=OFF
DOCTEST_WITH_MAIN_IN_STATIC_LIB:BOOL=ON
DOCTEST_WITH_TESTS:BOOL=OFF
FETCHCONTENT_BASE_DIR:PATH=C:/Users/Zamonien/source/repos/_JaXt0r/unZENity-VR-workspace/unZENity-VR/test-lib/build/_deps
FETCHCONTENT_FULLY_DISCONNECTED:BOOL=OFF
FETCHCONTENT_QUIET:BOOL=ON
FETCHCONTENT_SOURCE_DIR_DOCTEST:PATH=
FETCHCONTENT_SOURCE_DIR_GLM:PATH=
FETCHCONTENT_SOURCE_DIR_LEXY:PATH=
FETCHCONTENT_SOURCE_DIR_LIBSQUISH:PATH=
FETCHCONTENT_SOURCE_DIR_MIO:PATH=
FETCHCONTENT_UPDATES_DISCONNECTED:BOOL=OFF
FETCHCONTENT_UPDATES_DISCONNECTED_DOCTEST:BOOL=OFF
FETCHCONTENT_UPDATES_DISCONNECTED_GLM:BOOL=OFF
FETCHCONTENT_UPDATES_DISCONNECTED_LEXY:BOOL=OFF
FETCHCONTENT_UPDATES_DISCONNECTED_LIBSQUISH:BOOL=OFF
FETCHCONTENT_UPDATES_DISCONNECTED_MIO:BOOL=OFF
INSTALL_SUBPROJECTS:BOOL=ON
LEXY_FORCE_CPP17:BOOL=OFF
LEXY_USER_CONFIG_HEADER:FILEPATH=
MAKECOMMAND:STRING=C:/Program\ Files/CMake/bin/cmake.exe --build . --config "${CTEST_CONFIGURATION_TYPE}"
MEMORYCHECK_COMMAND:FILEPATH=MEMORYCHECK_COMMAND-NOTFOUND
MEMORYCHECK_SUPPRESSIONS_FILE:FILEPATH=
PHOENIX_BUILD_EXAMPLES:BOOL=OFF
PHOENIX_BUILD_SHARED:BOOL=OFF
PHOENIX_BUILD_TESTS:BOOL=ON
PHOENIX_DEBUG_POSTFIX:STRING=d
PHOENIX_DISABLE_SANITIZERS:BOOL=OFF
PHOENIX_INSTALL:BOOL=ON
PHOENIX_LOG_LEVEL:STRING=3
SITE:STRING=DESKTOP-7BOPH10
doctest_SOURCE_DIR:PATH=C:/Users/Zamonien/source/repos/_JaXt0r/unZENity-VR-workspace/unZENity-VR/test-lib/build/_deps/doctest-src
glm_SOURCE_DIR:PATH=C:/Users/Zamonien/source/repos/_JaXt0r/unZENity-VR-workspace/unZENity-VR/test-lib/build/_deps/glm-src
lexy_SOURCE_DIR:PATH=C:/Users/Zamonien/source/repos/_JaXt0r/unZENity-VR-workspace/unZENity-VR/test-lib/build/_deps/lexy-src
libsquish_SOURCE_DIR:PATH=C:/Users/Zamonien/source/repos/_JaXt0r/unZENity-VR-workspace/unZENity-VR/test-lib/build/_deps/libsquish-src
mio.installation:BOOL=ON
mio.windows.full_api:BOOL=OFF
mio_SOURCE_DIR:PATH=C:/Users/Zamonien/source/repos/_JaXt0r/unZENity-VR-workspace/unZENity-VR/test-lib/build/_deps/mio-src
One more hint/idea: I'm building the solution with cmake from CLI. I don't use Visual Studio right now.
Googling for codecvt reveals, that it's related to some VS dlls (e.g. msvcp140_codecvt_ids.dll). But I don't understand why it would cause errors at runtime as end users won't have VS DLLs installed on their machines too. 🤔
And one more thing: How do you actually build your solution? From VS 2022 or also via CLI?
Hm I am not able to reproduce your issue. I just spun up a clean VM into which I installed MinGW via MSYS2 (https://www.msys2.org/) like this:
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-gcc mingw-w64-x86_64-toolchain make
in an MSYS2 shell (i.e. the one you get after installation). I made sure to put C:\msys64\mingw64\bin
in PATH
. Then I installed CMake and Git in the Windows environment and copy-pasted your example. It compiles just fine (running the commands through powershell) and I can execute test_lib.exe
without issue.
There might be a problem with your MinGW installation then. I can see that you installed it through chocolatey so there might be additional setup you have to do there. You could try to compile a basic C++ program like:
#include <iostream>
int main() {
std::cout << "Hello, world!\n";
return 0;
}
to check whether it's an issue with your installation or a problem with my CMake build script (which could totally be the case).
How do you actually build your solution? From VS 2022 or also via CLI?
I build on Linux using Clang most of the time.
Hm. Thanks for the feedback so far. Let me dig deeper and check further on my end.
I found the error:
This increases size of .exe file from 300kB to 5.5MB, but still ok I guess. 🤷♂️
Thanks again for your help!
For references, my new CMakeLists.txt:
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 17)
project(test_lib VERSION 0.1.0)
add_subdirectory(phoenix)
add_executable(test_lib main.cpp)
target_link_options(test_lib PUBLIC "-static-libstdc++") # <-- new
target_link_libraries(test_lib phoenix)
Hi team,
I want to set up phoenix as linked dependency to my C++ project.
Unfortunately calling a phoenix function leads to runtime exception:
I checked repositories phoenix-studio and OpenGothic for some references how to handle but without success.
What am I missing?
I'm posting my setup here to reproduce:
main.cpp
CMakeLists.txt
build commands
(cmake version = 3.25.2)
--> executing test_lib.exe