I want to compile QT statically , I did the following steps:
1)configure -static -debug -opensource
2)nmake sub-src but in this step I have some errors like
D:\qt\bin\rcc.exe -name mimetypes D:\qt-everywhere-opensource-src-5.0.1\
qtbase\src\corelib\mimetypes\mimetypes.qrc -o .rcc\debug_static\qrc_mimetypes.cp
p
'D:\qt\bin\rcc.exe' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'D:\qt\bin\rcc.exe' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0
\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
what should I do?
Before trying to compile Qt 5.x, you may need to install some libraries (depends of the modules you want to compile) :
ActivePerl (** needed, as it is used to configure qtsdk)
Microsoft Windows SDK 7.1
Microsoft DirectX SDK
Python
ICU
...
If you plan to use a library (like Assimp for example) which internally use the same libraries (like zlib), you may have to overwrite these libraries, located in the qtbase\src\3rdparty sub-directories, with their latest versions.
Edit the file configure.bat, located in the qtbase directory, and comment out the line 45 :
::if not exist %QTSRC%\.gitignore goto sconf
Edit the file qmake.conf, located in qtbase\mkspecs\win32-msvc2010 (if you're using Visual Studio 2010) or in qtbase\mkspecs\win32-msvc2012 (if you're using Visual Studio 2012) :
line 9 : CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target
line 23 : QMAKE_CFLAGS_RELEASE = -O2 -MT
line 24 : QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
line 25 : QMAKE_CFLAGS_DEBUG = -Zi -MTd
Start the Visual Studio command prompt : Start > Programs > Microsoft Visual Studio 20XX > Visual Studio Tools.
Make sure that the path to Perl.exe is in the PATH environment variable : PATH=%PATH%;C:\Perl\bin (or PATH=%PATH%;C:\Perl64\bin if compiling for x64).
Go in the qtbase directory : CD \Qt\5.0.1\qtbase.
Configure Qt for compiling statically debug and release versions :
configure -developer-build -opensource -confirm-license -platform win32-msvc2010 -mp -nomake examples -nomake tests -static (if you're using Visual Studio 2010)
configure -developer-build -opensource -confirm-license -platform win32-msvc2012 -mp -nomake examples -nomake tests -static (if you're using Visual Studio 2012)
Examples and tests can be compiled later, if you need them.
If you plan to use OpenGL, add -opengl desktop to the command line, otherwise Qt will use by default OpenGL/ES which is targeted for mobile devices.
If your CPU is not multicore capable, remove the -mp option.
Go back in the parent directory : CD ...
Configure again Qt : configure -developer-build -opensource -confirm-license -platform win32-msvc20XX-opengl desktop -mp -nomake examples -nomake tests -static
(I'm not sure this step is needed, but as it takes just a few seconds...).
Compile : nmake.
Another method for compiling is to use jom and specify the number of CPU cores to use : C:\Qt\jom\jom.exe -j #NUMBER_OF_CORES#.
You will find the compiled static libraries in the qtbase\lib folder and the files to include in the sub-directories of qtbase\include.
To use them, you will have to use static run-time libraries (/MT or /MTd) in your Visual C++ project.
Related
Ive got the following lines on my cmake
add_custom_command(TARGET
myAppSDK POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${PROJECT_SOURCE_DIR}/src/client/media/*.*"
"${PROJECT_SOURCE_DIR}/dist/include/client/media"
DEPENDS myAppSDK
)
this works in both Linux and MacOS, but in windows it does not work with the error
NMAKE : fatal error U1077: 'echo' : return code '0x1'
It seems like Cmake on windows does not support copying multiple files because if I change the line from (asterisk dot asterisk) to specifying individual files it works. The thing is, if I do it that way it will be a lot of files to specify.
Im using CMAKE version 3.17.5
Compiler: MSVC
in windows.
Any workaround for this?
I downloaded Codeblocks bundled with GCC from here
The C part is running fine
I read this wiki tutorial which says having GCC will allow me to compile objective C by just adding -lobjc to the compiler options
However, I have followed the steps mentioned in this tutorial and added the -lobjc option, but it doesn't compile
This is the build error message I get in codeblocks:
-------------- Build: Debug in test_prog_proj (compiler: GNU GCC Obj-C Compiler)---------------
mingw32-gcc.exe -Wall -g -c D:\backup\cb_files\objc_files\test_prog_proj\test_prog.m -o obj\Debug\test_prog.o
mingw32-gcc.exe: error: CreateProcess: No such file or directory
Process terminated with status 1 (0 minute(s), 2 second(s))
1 error(s), 0 warning(s) (0 minute(s), 2 second(s))
As shown above, it does not show the -lobjc option
I have also tried manually compiling the above program in Windows cmd by going into the folder containing the .m file. I gave the following command:
mingw32-gcc.exe -Wall -g -c D:\backup\cb_files\objc_files\test_prog_proj\test_prog.m -o obj\Debug\test_prog.o -lobjc
But I get the same error in cmd
mingw32-gcc.exe: error: CreateProcess: No such file or directory
I also tried
gcc -g -fgnu-runtime -O -c some_class.m
that I got from here, but it gives me the same CreateProcess error. How do I start compiling Objective C code in Windows (preferably using GCC and Codeblocks) ?
--- EDIT 1 ---
I did as suggested in Mike Kinghan's answer below, and uninstalled my older Codeblocks instgallation, then reinstalled MinGW and codeblocks separately. The Codeblocks uninstall removed the Codeblocks folder in Program Files, but when I reinstalled Codeblocks again (version without MinGW bundled together), the "GNU GCC Obj-C" settings I made with the previous installation was still there, along with the -lobjc flag in the "linker settings" tab.
However, the problem is that it's still not working. I get the following error if I try to build from Codeblocks
Goto "Settings->Compiler...->Global compiler settings->GNU GCC Obj-C Compiler->Toolchain executables" and fix the compiler's setup.
Tried to run compiler executable 'C:\Program Files\CodeBlocks\MinGW/bin/mingw32-gcc.exe', but failed!
Skipping... Nothing to be done (all items are up-to-date).
This is what Toolchains executable looks like:
If I try to compile it from cmd by going in to the folder with the .m file and issuing the command
mingw32-gcc.exe -Wall -g -c D:\backup\cb_files\objc_files\test_prog_proj\test_prog.m -o obj\Debug\test_prog.o -lobjc
it gives the error
mingw32-gcc.exe: error: CreateProcess: No such file or directory
What is the problem here?
--- EDIT 2 ---
Following the suggestion in Mike Kinghan's answer I deleted the old instance of "GNU GCC Obj-C Compiler" in the list of compiliers, and recreated with the current version of "GNU GCC Compiler"
However, the program still does not work. This is the message I get in the build log:
-------------- Build: Debug in test_prog_proj (compiler: GNU GCC Obj-C Compiler)---------------
Linking stage skipped (build target has no object files to link)
Nothing to be done (all items are up-to-date).
Cleaning the project and then building it again gives the same message. Trying to run the project anyway gives me a dialog box saying the project is not built, and clicking on Yes to build the project just pops the same "project not built yet" dialog box up again. The file icons in the Workspace tree of the Projects tab also seem to be grayed out:
This is what Toolchain Executable looks like:
I have added -lobjc in Linker Settings as mentioned here as well.
I right clicked the project icon in the Project tree, went to Build Options and added -lobjc in the Linker Settings as well:
What is the problem with this project at the moment?
--- EDIT 3 ---
I ended up completely uninstalling Codeblocks (uninstall from windows start menu, delete codeblocks folder in %APPDATA%), uninstalling MinGW (deleting the c:\MinGW folder) and reinstalling everything from scratch. I followed all the instructions in the Wiki (except the Troubleshooting section, but I think that part is irrelevant) and it still doesn't work (same problem as described in Edit 2 in this post).
How do I get Codeblocks to detect and compile obj-C code? Also, it is not showing me the compiler command line arguments when I try to build it from the Codeblocks interface. Why is this and how can I get it to show me whatever the full command line it is using?
The GCC program we loosely call the "the compiler" - [mingw32-](gcc|g++) -
is actually a compiler/linker frontend that invokes a real language
compiler and/or linker depending on what the input files and commandline options
indicate you want it to do.
Input files with an .m extension indicate they are Objective C source files
that are to be compiled with the GNU Objective C compiler, cc1obj. But you
haven't got it. Hence the failure you see.
A GCC installation will include the C compiler cc1 and, optionally, compilers
for other languages - C++, Fortran, Objective (C|C++), Go ... You say you got your MinGW GCC installation as
bundled with Code::Blocks. That bundled MinGW omits the Objective C compiler, cc1obj , because the maintainers
reckon it a niche language.
Best remove your CB installation and bundled MinGW and then install MinGW GCC independently from
one of the rival projects:-
https://sourceforge.net/projects/mingw-w64/
https://sourceforge.net/projects/mingw/
Run the installer and ensure that you get Objective C as well as any other compilers you
want.
After that, replace your CB installation it with the codeblocks-17.12-setup.exe installer (not codeblocks-17.12mingw-setup.exe),
from https://sourceforge.net/projects/codeblocks/files/Binaries/17.12/Windows/. This installer includes no compilers and
will auto-detect your MinGW installation.
Then proceed as you already did to create a GNU GCC Obj-C compiler setup in the CB IDE.
Later ... still not working
Your GNU GCC Obj-C compiler-setup has persisted from your previous
CB install and has been rendered out-of-date by the fact that your
new MinGW installation is no longer part of Code::Blocks. As you see,
it still looks for the toolchain executables in C:\Program Files\Codeblocks\MinGW,
whereas your new MinGW is somewhere else.
When you reinstalled Code::Blocks you should have seen its attempt to auto-detect compilers,
and that it detected your MinGW toolchain in (say) C:\MinGW. It will have configured
a compiler setup for GNU GCC Compiler on that basis, with the correct path to
the toolchain executables. But it will not have modified any persisting compiler setups that
you created yourself, such as GNU GCC Obj-C.
First check that the auto-detected setup GNU GCC Compiler is good just
by creating a "Hello world" C console project and seeing that you can build it.
I assume you'll be able to, but if not, then go into the GNU GCC Compiler setup
yourself and manually set the Compiler's installation directory correctly.
Then, set the same Compiler's installation directory for your GNU GCC Obj-C
compiler setup.
I'm making a DLL, written in C++ with Qt Creator (but no Qt stuff inside, pure homemade C++), and using a standard qmake + MinGW/g++ build process. My friend is doing the framework/main soft, and he's using Visual Studio Express 2015, and he's supposed to use my DLL inside of that. Because of that I want to use the same visual studio compiler for my project in Qt Creator.
So I noticed that Qt Creator had auto detected the Visual Studio C++ 14 compiler, which I believe is the one attached to Visual Studio Express 2015. When I create a kit with that compiler and set my project to compile with that kit, I get a suggested "Make" step which calls jom in the bin folder of my Qt Creator installation. I have no idea what this is and I get the following output (see below).
I don't know what to do from here. I also tried to create a compiler directly from the nmake executable in my Visual Studio installation, and then using it - but I get a very similar error about '-' not being recognized as an option. Any hints are greatly appreciated !
12:56:27: Starting: "C:\Qt\qtcreator-3.1.1\bin\jom.exe"
Usage: jom #commandfile
jom [options] [/f makefile] [macro definitions] [targets]
nmake compatible options:
/A build all targets
/D display build information
/E override environment variable macros
/F <filename> use the specified makefile
/G display included makefiles
/H show help
/I ignore all exit codes
/K keep going - build unrelated targets on error
/N dry run - just print commands
/NOLOGO do not print logo
/P print makefile info
/R ignore predefined rules and macros
/S silent mode
/U print content of inline files
/L same as /NOLOGO
/W print the working directory before and after other processing
/X <filename> write stderr to file.
/Y disable batch mode inference rules
jom only options:
/DUMPGRAPH show the generated dependency graph
/DUMPGRAPHDOT dump dependency graph in dot format
/J <n> use up to n processes in parallel
/KEEPTEMPFILES keep all temporary files
/VERSION print version and exit
Error: unknown command line option '-' in arguments: '/L-j4'
12:56:27: The process "C:\Qt\qtcreator-3.1.1\bin\jom.exe" exited with code 128.
Error while building/deploying project Ford_DAT_framework_DLL_as_plugin (kit: MVS Ford)
When executing step 'Make'
12:56:27: Elapsed time: 00:04.
So I used qmake -tpvc to generate a VCproj file which compiled almost immediately in Visual Studio Express 2015 which my friend uses. I guess that's a valid solution to my problem then !
I've tried official howto but failed. I got error:
"The procedure entry point InterlockedCompareExchange#12 could not be located in the dynamic link library libstdc++-6.dll"
The problem was due the old gcc compiler, bundled with DevKit from rubyinstaller.org (4.5 vs 4.8 on my PC). Use MSYS instead. Assume we have zeromq source inside D:\libs\zeromq, then the procedure is:
Download GUI MinGW installer.
Install base and MSYS (if you already have working gcc compiler you probably only need MSYS).
Launch MSYS environment by executing C:\MinGW\msys\1.0\msys.bat.
Follow Using MSYS with MinGW section:
mount c:/mingw /mingw
cd /d/libs/zeromq
./configure --prefix=/mingw
make
Copy /d/libs/zeromq/src/.libs/libzmq.dll to your desired place.
In fact I needed to use ZeroMQ with C++, so I downloaded zmq.hpp, moved it to include directory, and compiled hwserver.cpp to test it:
C:\MinGW\bin\g++.exe -o hwserver hwserver.cpp -L. -lzmq -ID:\libs\zeromq\include
It worked, but when I launch it I got:
Assertion failed!
Program: D:\tmp\zmq\hwserver.exe
File: D:\libs\zeromq\include/zmq.hpp, Line 280
Expression: rc == 0
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
I've managed to get rid of this failure by commenting lines 279, 280. Similar issue
1) ran "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd /x64 /Debug" to set environment variables.
2) ran "vcexpress" from that command prompt. The reason for starting from the command prompt is so that the correct compiler and linker are detected. Otherwise they defaulted to x86_amd64 when vcexpress is run from the start menu.
3) attempted to build my project, a SuperBuild generated by CMake which calls msbuild to compile some static solution files. Received this error:
You are attempting to build a Win32 application from an x64-environment.
If using the Windows 7.1 SDK build environment, type setenv / x86
The solution was to change the TARGET_CPU variable. When setenv /x64 /debug was run, it set:
C:\Temp\cmakeex\build>echo %TARGET_CPU%
x64
I changed this to amd64, and the project now builds successfully:
>set TARGET_CPU=amd64