简体   繁体   中英

Missing DLLs cross-compile wxWidgets shared library on ubuntu

I try to cross-compile under Linux to Windows using the shared library. I followed the instructions on wxWidgets wiki but while executing main out.exe I got a lot of missing DLL Errors.

Here's how I builded the library :

../configure --disable-debug_flag --host=x86_64-w64-mingw32 --build=x86_64-linux-gnu -with-msw

Here's how I compile and Link :

First : x86_64-w64-mingw32-g++ -c  *.cpp  *.h  $(/wxWidgets/build_win/wx-config --cxxflags)

Second : x86_64-w64-mingw32-g++ -o out.exe *.o  $(/wxWidgets/build_win/wx-config --libs) -static-libgcc -static-libstdc++

When I use wine out.exe I got these errors :

002a:err:module:import_dll Library wxbase313u_gcc_custom.dll (which is needed by L"Z:\\home\\ubuntu\\test.exe") not found
002a:err:module:import_dll Library wxmsw313u_core_gcc_custom.dll (which is needed by L"Z:\\home\\ubuntu\\test.exe") not found
002a:err:module:attach_dlls Importing dlls for L"Z:\\home\\ubuntu\\test.exe" failed, status c0000135

I've added the missing DLLs in the same folder as out.exe (They were located in /wxWidgets/build_win/lib/ ) and doing this added lot of more errors :

wine out.exe 
0028:err:module:import_dll Library libgcc_s_seh-1.dll (which is needed by L"Z:\\home\\ubuntu\\Bureau\\test\\wxbase313u_gcc_custom.dll") not found
0028:err:module:import_dll Library libstdc++-6.dll (which is needed by L"Z:\\home\\ubuntu\\Bureau\\test\\wxbase313u_gcc_custom.dll") not found
0028:err:module:import_dll Library wxbase313u_gcc_custom.dll (which is needed by L"Z:\\home\\ubuntu\\Bureau\\test\\out.exe") not found
0028:err:module:import_dll Library libgcc_s_seh-1.dll (which is needed by L"Z:\\home\\ubuntu\\Bureau\\test\\wxbase313u_gcc_custom.dll") not found
0028:err:module:import_dll Library libstdc++-6.dll (which is needed by L"Z:\\home\\ubuntu\\Bureau\\test\\wxbase313u_gcc_custom.dll") not found
0028:err:module:import_dll Library wxbase313u_gcc_custom.dll (which is needed by L"Z:\\home\\ubuntu\\Bureau\\test\\wxmsw313u_core_gcc_custom.dll") not found
0028:err:module:import_dll Library libgcc_s_seh-1.dll (which is needed by L"Z:\\home\\ubuntu\\Bureau\\test\\wxmsw313u_core_gcc_custom.dll") not found
0028:err:module:import_dll Library libstdc++-6.dll (which is needed by L"Z:\\home\\ubuntu\\Bureau\\test\\wxmsw313u_core_gcc_custom.dll") not found
0028:err:module:import_dll Library wxmsw313u_core_gcc_custom.dll (which is needed by L"Z:\\home\\ubuntu\\Bureau\\test\\out.exe") not found
0028:err:module:attach_dlls Importing dlls for L"Z:\\home\\ubuntu\\Bureau\\test\\out.exe" failed, status c0000135

Here's my folder content :

ChildPanels.o                  wxmsw313u_gl_gcc_custom.dll
main.o                         wxmsw313u_html_gcc_custom.dll
MainPanel.o                    wxmsw313u_media_gcc_custom.dll
out.exe                        wxmsw313u_propgrid_gcc_custom.dll
wxbase313u_gcc_custom.dll      wxmsw313u_qa_gcc_custom.dll
wxbase313u_net_gcc_custom.dll  wxmsw313u_ribbon_gcc_custom.dll
wxbase313u_xml_gcc_custom.dll  wxmsw313u_richtext_gcc_custom.dll
wxmsw313u_adv_gcc_custom.dll   wxmsw313u_stc_gcc_custom.dll
wxmsw313u_aui_gcc_custom.dll   wxmsw313u_webview_gcc_custom.dll
wxmsw313u_core_gcc_custom.dll  wxmsw313u_xrc_gcc_custom.dll

Can anyone help me with this ?

EDIT :

It work copying all of these DLLs to my folder :

libgcc_s_seh-1.dll  libstdc++-6.dll  libwinpthread-1.dll wxmsw313u_core_gcc_custom.dll  wxbase313u_gcc_custom.dll

I don't understand why I need to copy the libgcc and libstdc++ to my folder because I linked them staticly. Is it not possible to link static libgcc and libstdc++ and shared wxWidgets ?

Also, how can I tell the compiler I want my DLLs to be loaded from a folder named /lib for example inside my app folder ?

This is not really wxWidgets-specific, but just the way that DLLs work: they need to be found during the program execution and this means either being in the same directory as the program itself, or in one of the directories in the PATH environment variable.

You can't "tell the compiler" anything about the path where the DLLs are found because this path must be used at run time, not compile time.

The simplest workaround if you really, really want to have the DLLs in another directory is to use a wrapper (it could be a script or another compiled program) that would add this directory to the PATH before launching the real application. Alternatively, just link statically and don't bother with the DLLs at all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM