Guide:
|
As a result of beslyric-for-x project development needs, began to try to develop Qt applications under Mac Os. After a successful attempt, record it and hope to help people with similar needs. This article takes the development beslyric-for-x as an example to record the steps from downloading Virtual box to normal development and release. This address: https://www.cnblogs.com/BensonLaur/p/9461589.html |
Directory
|
- Install Mac Os with virtual Box
- Preparing for the development environment under MAC Os
- Preparing for the QT development environment
- Concrete Project Development Example: Beslyric-for-x
- QT release Software under Mac
|
1. Install Mac Os using Virtual Box
1) Download and install the latest version of Virtual Box
Download the latest version of Virtual Box:https://www.virtualbox.org/wiki/downloads according to the operating system platform you are currently using
2) Download Mac Os system
Before trying to download the Mac Os DMG installation image file to install, the initial attempt was not very smooth.
Finally find another path, there is an article directly to provide the installation of Mac Os 10.12 virtual Box vdisk file, the method is very practical measurement.
Article Address: https://www.cnblogs.com/liming2017/p/7566953.html
To prevent the article from failing, simply record the steps: "(name needs to be consistent, later steps required)
Mac Os Version Select 64-bit
Recommended allocation of 4 G deposit
Use an existing virtual hard disk file: Select the vmdk file that you downloaded and extracted from just 1
3, after the creation, click Settings, in the System settings panel, the number of processors changed to 2, the motherboard option to remove the "floppy drive"
4, display option inside the video memory set to 128MB
5. Click OK to save the settings, then close the virtual machine, Run command prompt (CMD) as Administrator
6, enter your own installation directory, such as: CD "C:\Program files\oracle\virtualbox\" into the VirtualBox directory, and then enter the following content
VBoxManage.exe modifyvm "MacOS10.12"--cpuidset 00000001 000106e5 00100800 0098e3fd bfebfbffvboxmanage setextradata " MacOS10.12 "Vboxinternal/devices/efi/0/config/dmisystemproduct" "imac11,3" Vboxmanage setextradata "MacOS10.12" " Vboxinternal/devices/efi/0/config/dmisystemversion "" 1.0 "Vboxmanage setextradata" MacOS10.12 "" vboxinternal/ Devices/efi/0/config/dmiboardproduct "" Iloveapple "Vboxmanage setextradata" MacOS10.12 "" vboxinternal/devices/smc/0 /config/devicekey "" Ourhardworkbythesewordsguardedpleasedontsteal (c) applecomputerinc "VBoxManage Setextradata" MacOS10.12 "" VBOXINTERNAL/DEVICES/SMC/0/CONFIG/GETKEYFROMREALSMC "1
VBoxManage.exe not recognized, may be different from the Shell version, you can try to add ". \" in front of the . \vboxmanage.exe)
7, in virtual Box to launch the newly created VM, it should appear the graphical installation interface, step
2, prepare the development environment under the MAC
Development needs to be developed under Mac, like Visual Studio under Windows and related development packages, tools for XCode and Command line tools need to be installed under Mac
Get development environment tools from official website
I would like to transfer the files on the Windows host and Mac VMS through the virtual machine sharing mechanism, but it seems that virtual Box support doesn't seem to be good enough to download directly from the virtual machine.
Mac development tool version seems to need to have a certain correspondence with the Mac version, from the official search XCode, Address: https://developer.apple.com/download/more/
Access requires an Apple ID, a registered one can be accessed (in the beginning with the domestic 126 mailbox received the mail is not normal registration, the second direct Gmail mailbox registration success).
According to Mac version number 10.12 I downloaded the Xcode 9.0.1 and Command line Tools (Mac OS 10.12) for Xcode 9.0.1, and eventually downloaded the original or downloaded high, prompting for Mac OS 10.12.6, And the system here is 10.12.1. Fortunately, the system automatically prompts to automatically upgrade to 10.12.6, in the App Store can be specific view and upgrade.
You may be able to directly try Xcode 9 and Command line Tools (Mac Os 10.12) for Xcode 9, and you might not need to upgrade your system later.
After downloading, install Xcode and Command line Tools (Xcode How to install I do not quite remember, as if the double-click directly installed, the installation is called Xcode.app; directly in the same directory of the compression package, after the configuration needs, I cut to/applications /xcode.app's location)
Other Preparations
1, install Brew, Brew is a package management tool under Mac, like apt under Debian/ubuntu. After installation, it is convenient to download the relevant components later:
installation command:
" $ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install) "
2. Using Brew to install related development tools
I'm not quite sure what tools I need later, but Pkg-config is a ffmpeg to use later, and here I downloaded Pkg-config and related tools.
Brew Install automakepkg-config libtool
3, in addition, the MAC by default hides the "." File and other hidden files, viewing the file is a bit inconvenient, you can open Terminal enter the following command, restart effective
Write com.apple.finder appleshowallfiles-booltrue
4, I heard that Xcode comes with git (?), I did not try not clear, because I started the MAC after the first thing is to download git, so you can install XCode input git to see if there is no corresponding instructions, no manual download
Download: https://www.git-scm.com/download/
5, the first use of the MAC is not suitable for, for example, can not find a direct cut operation, shortcut keys will not be used, it is recommended to see first, shortcut keys and cutting operations
3. Preparing for the QT development environment
Download the installation package under QT Mac and configure it accordingly
Download and install QT
Here choose QT Creator 5.7.1 corresponding Mac version file,: HTTP://DOWNLOAD.QT.IO/ARCHIVE/QT/5.7/5.7.1/
Select Download: qt-opensource-mac-x64-clang-5.7.1.dmg
After downloading, the general operation of the installation of Qt, after the installation of the configuration, can refer to this article, however, I seem to automatically detect the installation, I did not how to move the relevant configuration.
Problem Solving
1. After setting up QT project, qmake compile hint: Project error:could not resolve SDK path for ' MacOSX '
Solution: Terminal input as follows: (that is, here, I decided to move the Xcode.app just extracted to the directory/applications/xcode.app, feel applications is the system software is more conventional places)
sudo xcode-Select -s/applications/xcode.app/contents/developer
Reference: http://www.renyiwei.com/archives/1326.html
2, Qmake hint similar: Application "/USR/BIN/GCC" is used by qmake, but "..." is configured in the kit.
Please update your kit or choose a mkspec for qmake that matches your target environment better.
Solution: Not resolved, not clear how to operate, directly right-click prompt, close it temporarily can continue to run
4, Concrete project Development example: Beslyric-for-x
Beslyric is a piece of open-source software designed specifically for NetEase cloud music Rolling lyrics (LRC lyrics), and the initial version is developed using the MIT protocol Open Source Interface library Soui, which supports the Windows platform. To meet the needs of other platforms (Linux and MAC) users, Beslyric-for-x is based on a cross-platform desktop application development architecture QT, which implements the development of Windows \ Linux (debian\ubuntu) \ Mac Os version.
Download Beslyric-for-x
Use git to download project code
git clone https://github.com/bensonlaur/beslyric-for-x.git
Specific
project Development
Specific development matters, can view project Reame Description: Https://github.com/BensonLaur/Beslyric-for-X
5. Use Qt release software under Mac
Temporary not practiced, supplemented by the following
Level Two title
Content
Level Three title
Content
Install Mac Os and install Qt development apps in Virtual Box