I'm building a Qt5 (installed through vcpkg) project on macOS.
It builds nicely on QtCreator, debug mode. But when I try to build it from command line, also debug mode, then I get
make: *** No rule to make target `/Users/user/vcpkg/installed/x64-osx/lib/libQt5PrintSupport_debug.a', needed by `project.app/Contents/MacOS/project'. Stop.
I see libQt5PrintSupport_debug.a installed at
vcpkg/installed/x64-osx/debug/lib/libQt5PrintSupport_debug.a
So might be that when things are done from command line vcpkg/installed/x64-osx/debug/lib/ is not being searched, I guess.
How can I add this to the searched path list?
Is there a specific environment variable on macOS where .a are searched?
Building in release mode from command line works fine.
Related
I copied/paste a Qt5 project folder from a computer to another computer. They are both Ubuntu 18.04.
Same version of Qt5 and same libraries/dependencies. On the new computer, I have CMake 3.10.2, but I don't remember the verion of CMake I had on the former one. (Probably CMake 3.8).
As soon as I open Qt5 and open the folder containing the CMakeLists.txt file, and click on it, I get the following result from the output:
08:02:22: Running steps for project newcam-proc...
08:02:22: Persisting CMake state...
08:02:22: Starting: "/usr/bin/snap" --build . --target all error: unknown flag `build'
08:02:22: The process "/usr/bin/snap" exited with code 1.
Error while building/deploying project myProject (kit: Desktop Qt 5.12.5 GCC 64bit)
The kit Desktop Qt 5.12.5 GCC 64bit has configuration issues which might be the root cause for this problem. When executing step "CMake Build"
08:02:22: Elapsed time: 00:00.
And below the General Message I get:
Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.
Could not read qmake configuration file /home/emanuele/Qt/5.12.5/android_armv7/mkspecs/android-clang/qmake.conf.
Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.
Could not read qmake configuration file /home/emanuele/Qt/5.12.5/android_x86/mkspecs/android-clang/qmake.conf.
Running /usr/bin/snap /home/emanuele/Desktop/myProject -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_CXX_COMPILER:STRING=/usr/bin/g++ -DCMAKE_C_COMPILER:STRING=/usr/bin/gcc -DCMAKE_PREFIX_PATH:STRING=/home/emanuele/Qt/5.12.5/gcc_64 -DQT_QMAKE_EXECUTABLE:STRING=/home/emanuele/Qt/5.12.5/gcc_64/bin/qmake in /tmp/QtCreator-vlHbHY/qtc-cmake-LvUefYdh.
error: unknown command "/home/emanuele/Desktop/myProject", see 'snap help'.
CMake process exited with exit code 1.
I never had to use Android NDK on my previous project, nor I had to install it. And I am not sure why on the new machine is showing this message.
In addition it seems that is trying to use snap instead of the usual make.
I am not sure about what is happening and why.
What I tried so far:
1) The only thing that came to my mind was to try to create a small example application and see if it runs, it actually runs properly and gives no error as shown below:
08:16:00: Running steps for project untitled...
08:16:00: Configuration unchanged, skipping qmake step.
08:16:00: Starting: "/usr/bin/make" -j8
make: Nothing to be done for 'first'.
08:16:00: The process "/usr/bin/make" exited normally.
08:16:00: Elapsed time: 00:00.
It seems that the project that I copied/paste uses snap and if I create a new project, like a Qt Widget application, it actually uses make, exiting correctly in the output.
The flags --build . --target all are flags you typically see passed to the cmake executable, not the snap executable. This hints that your CMake environment is not configured correctly in the IDE on your new machine. I suggest following the QtCreator CMake setup instructions here to help get it configured:
To specify paths to CMake executables:
Select Tools > Options > Kits > CMake > Add.
In the Name field, specify a name for the tool.
In the Path field, specify the path to the CMake executable.
Select the Auto-create build directories check box to automatically create build directories for CMake projects.
Select Apply to save your changes.
I have never used qt before, but I got a task to build an already existing application for Windows and Mac using the newest version of qt. What I have done so far is:
Installed Visual Studio Professional 2017.
Installed the latest Qt 5 Open Source.
Note: when installing the QT 5 I installed all of the components under QT/ QT 5.10.1 which were: qt 5.10.1 components and under QT/Tools I installed QT Creator 4.6.0 CDB Debugger Support and MinGW 5.3.0 : qt 5 Tools
I cloned the branch from GitHub that I wanted to build to C:/Projects
Then in Git Bash I cd to the project and tried to run qmake. The first time I had this problem:
"bash: qmake: command not found"
After searching into the problem I found out that I haven't added "Qt/5.10.1/msvc2017_64/bin" to PATH and I added it. Now when I echo $PATH I can see the directory added.
Now after bash recognises qmake and I try to run it it says:
Project ERROR: Cannot run target compiler 'cl'. Output:
===================
Maybe you forgot to setup the environment?
I have no idea how to fix the problem due to the fact that I have never used QT to build anything before. Can you help me?
In the read me file for the application I am trying to build it says:
Step-by-step instructions
1. Clone this branch
2. cd into the project
3. Run qmake - this wil generate Makefiles for all of the project's modules
4.Run make (Use the -j4 of -j flags - this greatly speeds up the build process - see the manual page for make for more info). You can also use the -s flag to silence the output - this also wins you a few seconds.
I am a bit puzzled by the instructions, it does not say to run qmake -project anywhere, but there is a qt project file in the directory that I cd to. Does this mean that I don't have to run qmake -project?
Also I have no idea how to run make by using the -j4 and -j flags and how to run flags in general. Could someone help me?
I believe that for the Cannot Run Compiler 'cl' issue I have some kind of a problem with the set up. Did I install too many components or is it to do with the VS setup?
I highly recommend you to install Qt from the Qt installer, and to use Qt Creator.
However, if you want to use it from source, you first need to get a compiler (ex: MinGW). Then you need to execute the instructions, but you need to use a MinGW (or whatever compiler you use) command prompt, which will automatically set the environment variables needed.
Note that this is Windows specific. On mac and linux, the compiler's environment variables are already set in the default command prompt (if there is a compiler, obviously).
I have installed QtCreator (4.2.2) and cmake (3.8.1) through homebrew on Mac OS 10.12.4.
I am importing an existing CMake project but when QtCreator is running cmake, I encounter the following error:
Running "/usr/local/bin/ccmake /Users/matthieu/project/source '-GCodeBlocks - Unix Makefiles' -DCMAKE_CXX_COMPILER:STRING=/usr/bin/g++ -DCMAKE_C_COMPILER:STRING=/usr/bin/gcc '-DCMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}' -DQT_QMAKE_EXECUTABLE:STRING=" in /Users/matthieu/project/source/build-decaf-Desktop-Default.
Error opening terminal: unknown.
In QtCreator > Preferences > Environment > System, the terminal is set to:
/Applications/Qt\ Creator.app/Contents/MacOS/../Resources/scripts/openTerminal.command
My TERM env variable is set to xterm-256color. I have tried xterm-color as well but with no luck.
I start to run out of ideas if someone has any suggestions!
I suspect your Qt Creator build settings have been set up to point at ccmake instead of cmake as the CMake executable. Have a look in the Build & Run section under the CMake tab and see what executable has been set. The cmake executable is the command line tool that you want, ccmake is a curses-based UI front end to CMake meant for interactive editing of the CMake cache.
The TERM isn't being recognized. Try stepping down to something more common, like
TERM=xterm
First of all, I know that this question already exists multiple times in Stackoverflow but the answers provided for all of them didn't solve my issue(See section "Solutions worked for others" at the end of this question).
I am using the Eclipse IDE(Juno) with CDT plugin and Cygwin installed in my Windows-7 64-bit platform.
I successfully compiled and run the Hello World 'C' program but the Hello World "C++ program" is having Launch failed. Binary not found error.
I am also having recipe for target project.exe failed error in my auto-generated makefile.
Error line in makefile: #echo 'Building target: $#'
Additionally:
In c/c++ build -> toolchain editor ->
Current toolchain : Cygwin GCC
Current Builder : Gnu Make Builder
Used Tools:
GCC Assembler,
GCC Archiver,
Cygwin C++ Compiler,
Cygwin C Compiler,
Cygwin C Linker,
Cygwin C++ Linker.
When I change Current Builder from "Gnu Make Builder" to "CDT Internal Builder" the recipe for target project.exe failed error disappears but the Launch failed. Binary not found error still exists.
And also I dont have MinGW installed.
Solutions worked for others :
Before running the project directly using the run command, first Build the project and then run.
I build the project every time before I run it.
Eclipse can't find or point to an .exe file but the exe file runs fine when run from windows explorer and the answer to it is add -arch i386 to miscellaneous under linker.
My build runs without error but not creating the exe file. So this doesnt apply to me
Project->Properties->C/C++ Build->Settings->Binary Parsers
set "Cygwin PE Parser" and/or " PE Window Parser" and alike.
Tried all of them with different combinations but did not work
I also did :
adding the cygwin install dir to the path variable
added all the includes folders needed for cygwin for both GNU C and GNU C++ in Paths-and-Symbols -> includes
Saved the project before building and then running
restarted eclipse again
checked if g++ is installed using which g++ in terminal
and so on.
What could be a fix to this problem? Or do I have to install MinGW (I tried already to install MinGW with the installer.exe they provided and it failed on downloading the files several times) and try again.
I couldn't find the solution. Please show me what am I missing here.
Thanks in advance.
I'm trying to configure my NetBeans on win7 64bit, to work with the MinGW-w64.
So I put in the %PATH% variable the following paths of the compiler:
C:\mingw-w64-bin_i686\mingw\bin
C:\minGw-MSYS\msys\bin
C:\mingw-w64-bin_i686\libexec\gcc\x86_64-w64-mingw32\4.7.0
Then I opened NetBeans and this was configured:
The configuration in NetBeans
I tried to compile a little test program but I received this error:
g++.exe: fatal error: -fuse-linker-plugin, but liblto_plugin-0.dll not
found compilation terminated. make[2]: *
[dist/Debug/MinGW-Windows/test.exe] Error 1 make1: [.build-conf]
Error 2 make: ** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 1s)
I do have this file in C:\mingw-w64-bin_i686\libexec\gcc\x86_64-w64-mingw32\4.7.0
what am I missing?
Right, after months of putting this off I've finally sat down and done it. I'll probably make a more detailed post on my blog with pretty pictures but here is a trimmed down SO version which will hopefully be enough for you (and everyone else) to get going with.
Prerequisites
Remove MinGW, MSYS and CMake if you have them and can afford to lose them (we will reinstall MinGW (obv.) and MSYS but not CMake as it doesn't appear to be needed.)
Netbeans or other suitable IDE
64bit Windows.
EnvMan (optional but handy for managing Windows Environment
variables.)
Installation
MinGW-W64 C compiler and MSYS
Download and install MinGW-W64
http://mingw-w64.sourceforge.net/ (link is on the left menu with a
hyperlink called 'WIN64 Downloads'.)
There are a lot of versions which can be a bit complicated. We are
going with mingw-w64-bin_i686-mingw_20111220 (although the numbers at
the end may be different) which basically says we want the version
with the windows binaries.
Once the download is complete (about 300mb so 10min or so) extract to
C:\MinGW-W64 or similar. Make sure there aren't any spaces in the
path!
Download MSYS for MinGW-W64
Took a bit of searching
http://sourceforge.net/apps/trac/mingw-w64/wiki/MSYS is the wiki for
it and
http://sourceforge.net/projects/mingw-w64/files/External%20binary%20packages%20%28Win64%20hosted%29/MSYS%20%2832-bit%29/
is where I found the download and the version I went with was
MSYS-20111123
Once the download is complete extract the files to C:\MSys or
similar. Make sure there aren't any spaces in the path!
Setup
Add 'C:\MinGW-W64\bin' to your Windows PATH variable.
Add 'C:\MSys\msys\bin' to your Windows PATH variable.
Start Netbeans and go to Tools -> Options -> C/C++.
Click 'Add' under 'Tool Collection' and select the base directory of
MinGW-W64 (C:\MinGW-W64\bin).
Select 'MinGW' from 'Tool Collection Family' if it isn't
auto-detected and click 'OK'.
Set the 'C Compiler to C:\MinGW-W64\bin\x86_64-w64-mingw32-gcc.exe.
Set the 'C++ Compiler to C:\MinGW-W64\bin\x86_64-w64-mingw32-g++.exe.
Set the 'Make Command' to C:\MSys\msys\bin\make.exe.
And that should be it!
I should note that I am using the system to compile a library file to be use via JNI so have some additional steps for that which I missed out as they weren't needed here. However I made a quick 'Hello World' program and it compiled and ran nicely.
Happy coding!
I have just downloaded the latest automated build, unzipped it, added the main bin directory to path, and run:
x86_64-w64-mingw32-gcc test.cpp -o test.exe
and
x86_64-w64-mingw32-gcc -fuse-linker-plugin test.cpp -o test.exe
and it works. The same for the i686 variant. Your IDE is doing something wrong. Or you shouldn't have messed with the files. Or you shouldn't have removed the prefixes. Seriously.
PS: You only have to add the main "bin" directory to PATH, all the rest is wrong.
With some searching via your favorite Internet search engine, I have come across a better approach to quickly add MinGW-x64 to a Windows 64-bit system. On the Sourceforge site is MSYS2.
While following the installation directions and obtaining the most up to date packages, there may be a time out at the primary mirror site on Sourceforge. If so, follow the mirror site update directions and update the three pacman text files in the respective MSYS2 directory (e.g. /etc/pacman.d). Then proceed to complete the package updates from the MSYS2 installation directions.
Within the MSYS2 packages are things like gcc, llvm, make, dmake, etc. Here is the command used from the MSYS2 command line shell (e.g. bash) to install the GNU make utility:
$ pacman -S msys/make
The executable location it will be placed is: /usr/bin inside the MSYS2 command shell. As far as configuring Netbeans for where make.exe is located, the Windows path is:
MSYS2 installation directory\usr\bin\make.exe
(e.g. C:\msys64\usr\bin\make.exe).
To successfully build C++ with Netbeans, I used the GNU make package (e.g. msys/make). Then in order to use the default make files that Netbeans manages, and to not interfere with other C++ compilers within your Windows installation (e.g. Visual Studio, Intel, CLang from Visual Studio, etc.), run Netbeans from the MinGW-x64 command shell provided by MSYS2. In this way, the environment variables and other things like:
ls rm mkdir
will indicate successful execution and compilation within the Netbeans internal terminal window. I opened the MinGW-w64 Win64 Shell by navigating to the installed shortcut from MSYS2's installation. Then pasted into the MinGW-x64 shell command line, the Target property value from the Netbeans Windows desktop shortcut:
$ "C:\Program Files (x86)\NetBeans 7.4\bin\netbeans.exe"
And then could finally create the respective debug and release object and executable files. I also modified the Netbeans project output to be within the MSYS2 directory structure. Then run the executable within the MSYS2 MinGW-x64 shell. Running from the Netbeans IDE produces this error message:
Unable to start pty process: The application failed with exit code
-1073741515 (0xc0000135).
If the MSYS2 path were in the computer system's PATH environment variable, then perhaps this error would not happen.