How to overcome 'Error 2' during Static Build with minGw (not being able to compile Tokenizer.cpp)
-
wrote on 8 Aug 2018, 08:41 last edited by koahnig 8 Aug 2018, 09:23
I have been struggling to build Static version of Qt so that can deploy the application I have developed. I would sincerely appreciate any tips and pointers (sharing of the experience) to overcome this error. The error message is as follow:
g++ -c -fno-keep-inline-dllexport -O2 -std=c++1y -fexceptions -mthreads -Wall -W -Wextra -Wno-unknown-pragmas -Wno-comment -Wno-missing-field-initializers -Wno-switch -Wno-unused-parameter -Wno-write-strings -Wno-sign-compare -Wno-missing-braces -Wno-unused-but-set-variable -Wno-unused-variable -Wno-narrowing -Wno-maybe-uninitialized -Wno-strict-aliasing -Wno-type-limits -Wno-unused-local-typedefs -Wno-reorder -Wno-conversion-null -Wno-delete-non-virtual-dtor -Wvla -DUNICODE -D_UNICODE -DWIN32 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -D_WINDOWS -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DWIN32_LEAN_AND_MEAN=1 -DANGLE_ENABLE_D3D11 -DANGLE_DEFAULT_D3D11=1 -DNDEBUG -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -D_SECURE_SCL=0 -I. -I../../../../3rdparty/angle/src/compiler/preprocessor -I../../../../../mkspecs/win32-g++ -o .obj/release/Token.o ../../../../3rdparty/angle/src/compiler/preprocessor/Token.cpp /C/Qt/5.11.1/Src/qtbase/src/angle/src/compiler/preprocessor/flex_wrapper.sh --noline --nounistd --outfile=release/Tokenizer.cpp ../../../../3rdparty/angle/src/compiler/preprocessor/Tokenizer.l process_begin: CreateProcess(NULL, /C/Qt/5.11.1/Src/qtbase/src/angle/src/compiler/preprocessor/flex_wrapper.sh --noline --nounistd --outfile=release/Tokenizer.cpp ../../../../3rdparty/angle/src/compiler/preprocessor/Tokenizer.l, ...) failed. make (e=2): The system cannot find the file specified. Makefile.Release:162: recipe for target 'release/Tokenizer.cpp' failed minGw32-make[7]: *** [release/Tokenizer.cpp] Error 2 minGw32-make[7]: Leaving directory 'C:/Qt/5.11.1/Src/qtbase/src/angle/src/compiler/preprocessor' Makefile:36: recipe for target 'release' failed minGw32-make[6]: *** [release] Error 2 minGw32-make[6]: Leaving directory 'C:/Qt/5.11.1/Src/qtbase/src/angle/src/compiler/preprocessor' Makefile:41: recipe for target 'sub-preprocessor-make_first-ordered' failed minGw32-make[5]: *** [sub-preprocessor-make_first-ordered] Error 2 minGw32-make[5]: Leaving directory 'C:/Qt/5.11.1/Src/qtbase/src/angle/src/compiler' Makefile:42: recipe for target 'sub-compiler-make_first-ordered' failed minGw32-make[4]: *** [sub-compiler-make_first-ordered] Error 2 minGw32-make[4]: Leaving directory 'C:/Qt/5.11.1/Src/qtbase/src/angle/src' Makefile:40: recipe for target 'sub-src-make_first' failed minGw32-make[3]: *** [sub-src-make_first] Error 2 minGw32-make[3]: Leaving directory 'C:/Qt/5.11.1/Src/qtbase/src/angle' Makefile:498: recipe for target 'sub-angle-make_first' failed minGw32-make[2]: *** [sub-angle-make_first] Error 2 minGw32-make[2]: Leaving directory 'C:/Qt/5.11.1/Src/qtbase/src' Makefile:44: recipe for target 'sub-src-make_first' failed minGw32-make[1]: *** [sub-src-make_first] Error 2 minGw32-make[1]: Leaving directory 'C:/Qt/5.11.1/Src/qtbase' makefile:79: recipe for target 'module-qtbase-make_first' failed minGw32-make: *** [module-qtbase-make_first] Error 2
The environment is as follows:
OS Name: Microsoft Windows 10 Pro OS Version: 10.0.17134 N/A Build 17134 Processor(s): 1 Processor(s) Installed. [01]: Intel64 Family 6 Model 78 Stepping 3 GenuineIntel ~2607 Mhz BIOS Version: American Megatrends Inc. F.09, 31/05/2016 Windows Directory: C:\WINDOWS System Directory: C:\WINDOWS\system32 Qt version: 5.11.1 minGw32-make version: GNU Make 3.82.90 Built for i686-w64-mingw32
**This is the contents of the preprocessor folder **
C:\Qt\5.11.1\Src\qtbase\src\3rdparty\angle\src\compiler\preprocessor>ls DiagnosticsBase.cpp DirectiveParser.cpp Input.cpp Macro.cpp Preprocessor.cpp Token.h pp_utils.h DiagnosticsBase.h DirectiveParser.h Input.h Macro.h Preprocessor.h Tokenizer.h DirectiveHandlerBase.cpp ExpressionParser.h Lexer.cpp MacroExpander.cpp SourceLocation.h Tokenizer.l DirectiveHandlerBase.h ExpressionParser.y Lexer.h MacroExpander.h Token.cpp numeric_lex.h
[edit: koahnig] code tags added
-
I have been struggling to build Static version of Qt so that can deploy the application I have developed. I would sincerely appreciate any tips and pointers (sharing of the experience) to overcome this error. The error message is as follow:
g++ -c -fno-keep-inline-dllexport -O2 -std=c++1y -fexceptions -mthreads -Wall -W -Wextra -Wno-unknown-pragmas -Wno-comment -Wno-missing-field-initializers -Wno-switch -Wno-unused-parameter -Wno-write-strings -Wno-sign-compare -Wno-missing-braces -Wno-unused-but-set-variable -Wno-unused-variable -Wno-narrowing -Wno-maybe-uninitialized -Wno-strict-aliasing -Wno-type-limits -Wno-unused-local-typedefs -Wno-reorder -Wno-conversion-null -Wno-delete-non-virtual-dtor -Wvla -DUNICODE -D_UNICODE -DWIN32 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -D_WINDOWS -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DWIN32_LEAN_AND_MEAN=1 -DANGLE_ENABLE_D3D11 -DANGLE_DEFAULT_D3D11=1 -DNDEBUG -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -D_SECURE_SCL=0 -I. -I../../../../3rdparty/angle/src/compiler/preprocessor -I../../../../../mkspecs/win32-g++ -o .obj/release/Token.o ../../../../3rdparty/angle/src/compiler/preprocessor/Token.cpp /C/Qt/5.11.1/Src/qtbase/src/angle/src/compiler/preprocessor/flex_wrapper.sh --noline --nounistd --outfile=release/Tokenizer.cpp ../../../../3rdparty/angle/src/compiler/preprocessor/Tokenizer.l process_begin: CreateProcess(NULL, /C/Qt/5.11.1/Src/qtbase/src/angle/src/compiler/preprocessor/flex_wrapper.sh --noline --nounistd --outfile=release/Tokenizer.cpp ../../../../3rdparty/angle/src/compiler/preprocessor/Tokenizer.l, ...) failed. make (e=2): The system cannot find the file specified. Makefile.Release:162: recipe for target 'release/Tokenizer.cpp' failed minGw32-make[7]: *** [release/Tokenizer.cpp] Error 2 minGw32-make[7]: Leaving directory 'C:/Qt/5.11.1/Src/qtbase/src/angle/src/compiler/preprocessor' Makefile:36: recipe for target 'release' failed minGw32-make[6]: *** [release] Error 2 minGw32-make[6]: Leaving directory 'C:/Qt/5.11.1/Src/qtbase/src/angle/src/compiler/preprocessor' Makefile:41: recipe for target 'sub-preprocessor-make_first-ordered' failed minGw32-make[5]: *** [sub-preprocessor-make_first-ordered] Error 2 minGw32-make[5]: Leaving directory 'C:/Qt/5.11.1/Src/qtbase/src/angle/src/compiler' Makefile:42: recipe for target 'sub-compiler-make_first-ordered' failed minGw32-make[4]: *** [sub-compiler-make_first-ordered] Error 2 minGw32-make[4]: Leaving directory 'C:/Qt/5.11.1/Src/qtbase/src/angle/src' Makefile:40: recipe for target 'sub-src-make_first' failed minGw32-make[3]: *** [sub-src-make_first] Error 2 minGw32-make[3]: Leaving directory 'C:/Qt/5.11.1/Src/qtbase/src/angle' Makefile:498: recipe for target 'sub-angle-make_first' failed minGw32-make[2]: *** [sub-angle-make_first] Error 2 minGw32-make[2]: Leaving directory 'C:/Qt/5.11.1/Src/qtbase/src' Makefile:44: recipe for target 'sub-src-make_first' failed minGw32-make[1]: *** [sub-src-make_first] Error 2 minGw32-make[1]: Leaving directory 'C:/Qt/5.11.1/Src/qtbase' makefile:79: recipe for target 'module-qtbase-make_first' failed minGw32-make: *** [module-qtbase-make_first] Error 2
The environment is as follows:
OS Name: Microsoft Windows 10 Pro OS Version: 10.0.17134 N/A Build 17134 Processor(s): 1 Processor(s) Installed. [01]: Intel64 Family 6 Model 78 Stepping 3 GenuineIntel ~2607 Mhz BIOS Version: American Megatrends Inc. F.09, 31/05/2016 Windows Directory: C:\WINDOWS System Directory: C:\WINDOWS\system32 Qt version: 5.11.1 minGw32-make version: GNU Make 3.82.90 Built for i686-w64-mingw32
**This is the contents of the preprocessor folder **
C:\Qt\5.11.1\Src\qtbase\src\3rdparty\angle\src\compiler\preprocessor>ls DiagnosticsBase.cpp DirectiveParser.cpp Input.cpp Macro.cpp Preprocessor.cpp Token.h pp_utils.h DiagnosticsBase.h DirectiveParser.h Input.h Macro.h Preprocessor.h Tokenizer.h DirectiveHandlerBase.cpp ExpressionParser.h Lexer.cpp MacroExpander.cpp SourceLocation.h Tokenizer.l DirectiveHandlerBase.h ExpressionParser.y Lexer.h MacroExpander.h Token.cpp numeric_lex.h
[edit: koahnig] code tags added
wrote on 8 Aug 2018, 09:28 last edited byHi and welcome to devnet forum
Please use code tags in your postings. They provide also some helpful formatting for different other output.
The error message stems from your makefile. AFAIK that is odd.
From where did you get the source for compilation?
In general you can also easily deploy applciations based on dlls to other machines.
You should be aware of the license implications in case you like to distribute your work. -
Hi and welcome to devnet forum
Please use code tags in your postings. They provide also some helpful formatting for different other output.
The error message stems from your makefile. AFAIK that is odd.
From where did you get the source for compilation?
In general you can also easily deploy applciations based on dlls to other machines.
You should be aware of the license implications in case you like to distribute your work.wrote on 8 Aug 2018, 09:42 last edited by yaoki 8 Aug 2018, 09:47@koahnig
Thank you very much for your reply and very useful advices.The source was obtained using qt-unified-windows-x86-3.0.5-online.exe that I have downloaded from Qt's official website.
I have also tried windeployqt.exe and get all dll files and deploy that way; however, I got an error message when I tried to open the app in the other computer 'The code execution cannot proceed because libgcc_s_dw2-1.dll was not found. Reinstalling the program may fix this problem'.
Again I sincerely appreciate anybody's input on this.
-
@koahnig
Thank you very much for your reply and very useful advices.The source was obtained using qt-unified-windows-x86-3.0.5-online.exe that I have downloaded from Qt's official website.
I have also tried windeployqt.exe and get all dll files and deploy that way; however, I got an error message when I tried to open the app in the other computer 'The code execution cannot proceed because libgcc_s_dw2-1.dll was not found. Reinstalling the program may fix this problem'.
Again I sincerely appreciate anybody's input on this.
Hi
That is mingw runtime. You might need to add
win32 {
QMAKE_LFLAGS += -static-libgc
}
to the pro file to link that static as well. -
@koahnig
Thank you very much for your reply and very useful advices.The source was obtained using qt-unified-windows-x86-3.0.5-online.exe that I have downloaded from Qt's official website.
I have also tried windeployqt.exe and get all dll files and deploy that way; however, I got an error message when I tried to open the app in the other computer 'The code execution cannot proceed because libgcc_s_dw2-1.dll was not found. Reinstalling the program may fix this problem'.
Again I sincerely appreciate anybody's input on this.
wrote on 8 Aug 2018, 13:08 last edited by@yaoki said in How to overcome 'Error 2' during Static Build with minGw (not being able to compile Tokenizer.cpp):
@koahnig
Thank you very much for your reply and very useful advices.The source was obtained using qt-unified-windows-x86-3.0.5-online.exe that I have downloaded from Qt's official website.
I have also tried windeployqt.exe and get all dll files and deploy that way; however, I got an error message when I tried to open the app in the other computer 'The code execution cannot proceed because libgcc_s_dw2-1.dll was not found. Reinstalling the program may fix this problem'.
Again I sincerely appreciate anybody's input on this.
You are using the source code accompanying a pre-built?
AFAIK this is still not recommended. You can find the source code all versions in Qt archives. Here is a link to the complete source for Qt5.11.1. For windows you need to download always the zip. The tar.xz is for linux based systems.
-
Hi
That is mingw runtime. You might need to add
win32 {
QMAKE_LFLAGS += -static-libgc
}
to the pro file to link that static as well.wrote on 8 Aug 2018, 20:11 last edited byAgain thank you for the pointer, it turned out that the PATH was pointing to the different MinGW than the one I was using to compile my Qt app. So now the dynamically linked one can be deployed!! Thank you so much!! (currently trying to make static build following koahnig's suggestion)
-
Again thank you for the pointer, it turned out that the PATH was pointing to the different MinGW than the one I was using to compile my Qt app. So now the dynamically linked one can be deployed!! Thank you so much!! (currently trying to make static build following koahnig's suggestion)
@yaoki
Good luck. -
@yaoki said in How to overcome 'Error 2' during Static Build with minGw (not being able to compile Tokenizer.cpp):
@koahnig
Thank you very much for your reply and very useful advices.The source was obtained using qt-unified-windows-x86-3.0.5-online.exe that I have downloaded from Qt's official website.
I have also tried windeployqt.exe and get all dll files and deploy that way; however, I got an error message when I tried to open the app in the other computer 'The code execution cannot proceed because libgcc_s_dw2-1.dll was not found. Reinstalling the program may fix this problem'.
Again I sincerely appreciate anybody's input on this.
You are using the source code accompanying a pre-built?
AFAIK this is still not recommended. You can find the source code all versions in Qt archives. Here is a link to the complete source for Qt5.11.1. For windows you need to download always the zip. The tar.xz is for linux based systems.
wrote on 9 Aug 2018, 05:00 last edited by@koahnig
Thank you for the input. In addition to downloading the source from the archive (https://download.qt.io/archive/qt/5.11/5.11.1/single/) I had to add C:\Qt\qt-everywhere-src-5.11.1\gnuwin32\bin to the path then I was successfully able to run mingw32-make!!Again thank you very much for your useful help!
-
@koahnig
Thank you for the input. In addition to downloading the source from the archive (https://download.qt.io/archive/qt/5.11/5.11.1/single/) I had to add C:\Qt\qt-everywhere-src-5.11.1\gnuwin32\bin to the path then I was successfully able to run mingw32-make!!Again thank you very much for your useful help!
wrote on 9 Aug 2018, 08:14 last edited by koahnig 8 Sept 2018, 18:58Not sure why you needed to have the directory added to the PATH environment.
Beware that you might have added a trap for the future, when changing to a different Qt version. I remember that PATH played a role when I was still using MSVC long ago. Since I am using Qt creator and MinGW, the setting is no longer required, respectively it is handled by creator. There you can change to a different toolkit very fast without remembering all the odd, forgotten stuff.
1/10