C++ program cross compile on linux using mingw works in msys2 but not directly in windows

713 views Asked by At

I have a strange problem. I have a program which depend on Qt, Zlib and ruby that I cross compile on ubuntu using mxe (x86_64-w64-mingw32.shared).

The ruby I use is not included in mxe packages, but has been compiled with the same toolchain.

Then I have a windows 10 64 bits test virtual machine with msys2 installed. When I run the program from wine on linux or in msys2 on windows it works without any problem. But when I launch it directly from the explorer the program start as expected but fail when I run ruby_setup() (I used RUBY_INIT_STACK; before, but not ruby_sysinit(&argc, &argv); since I'm lost in the middle of my program.

The list of dll provided with my program is (prefixed with agathe_ mean they are coded by me, ruby initiallisation is done in agathe_ruby.dll):

agathe_config.dll
agathe_models.dll
agathe_modules.dll
agathe_params.dll
agathe_ressources.dll
agathe_ruby.dll
agathe_utils.dll
agathe_views.dll
agathe_widgets.dll
libbz2.dll
libeay32.dll
libffi-6.dll
libfreetype-6.dll
libgcc_s_seh-1.dll
libgdbm-3.dll
libgdbm_compat-3.dll
libglib-2.0-0.dll
libgmp-10.dll
libharfbuzz-0.dll
libiconv-2.dll
libintl-8.dll
libjasper-1.dll
libjpeg-9.dll
liblcms2-2.dll
liblzma-5.dll
libmng-2.dll
libpcre16-0.dll
libpcre-1.dll
libpng16-16.dll
libstdc++-6.dll
libtiff-5.dll
libwebp-5.dll
libwebpdemux-1.dll
libyaml-0-2.dll
libzip-4.dll
qsvgicon.dll
Qt5Core.dll
Qt5Gui.dll
Qt5Svg.dll
Qt5Widgets.dll
ssleay32.dll
x64-msvcrt-ruby230.dll
zlib1.dll

Does anybody encourted that same problem and is aware of a way to fix it ?

1

There are 1 answers

0
Laurent Jospin On BEST ANSWER

Ok, I found a way to solve this... I don't know how exactly but the procedure was:

  • move the call to ruby_setup() somewhere it's not reached after a function pointer resolution.
  • make clean
  • and then re-run full cross compilation procedure.