Compile on MacOS: Difference between revisions
No edit summary |
|||
(12 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Docnav | {{Docnav | ||
|[[Compile_on_Linux|Compile on Linux]] | |[[Compile_on_Linux|Compile on Linux]] | ||
| | | | ||
}} | }} | ||
Line 61: | Line 61: | ||
<li>Qt: {{URL|ftp://ftp.trolltech.com/qt/source/qt-mac-opensource-4.4.1.dmg}} (this is for version 4.4.1, the current one at the time of writing, there may be a newer)</li> | <li>Qt: {{URL|ftp://ftp.trolltech.com/qt/source/qt-mac-opensource-4.4.1.dmg}} (this is for version 4.4.1, the current one at the time of writing, there may be a newer)</li> | ||
<li>GSL: {{URL|ftp://ftp.gnu.org/gnu/gsl/}} (the current version at the time of writing: 1.11)</li> | <li>GSL: {{URL|ftp://ftp.gnu.org/gnu/gsl/}} (the current version at the time of writing: 1.11)</li> | ||
<li> muParser: {{URL|http://downloads.sourceforge.net/muparser/ | <li> muParser: {{URL|http://downloads.sourceforge.net/muparser/}} (the current version at the time of writing: 1.30)</li> | ||
<li>Qwt: {{URL|http://downloads.sourceforge.net/qwt/ | <li>Qwt: {{URL|http://downloads.sourceforge.net/qwt/}} (the current version at the time of writing: 5.1.1)</li> | ||
<li>QwtPlot3D: {{URL|http://prdownloads.sourceforge.net/qwtplot3d/qwtplot3d-0.2.7.zip?download}} (the current version at the time of writing: 0.2.7)</li> | <li>QwtPlot3D: {{URL|http://prdownloads.sourceforge.net/qwtplot3d/qwtplot3d-0.2.7.zip?download}} (the current version at the time of writing: 0.2.7)</li> | ||
</ol> | </ol> | ||
Line 69: | Line 69: | ||
# Open the image file and install Qt for Mac. | # Open the image file and install Qt for Mac. | ||
# Open Terminal and change to the directory which the gsl-x.xx.tar.gz locates. For example, type | # Open Terminal and change to the directory which the gsl-x.xx.tar.gz locates. For example, type <code><nowiki>cd Downloads</nowiki></code>, if gsl-x.xx.tar.gz locates in the downloads folder of your home directory. | ||
# Type | # Type <code><nowiki>tar -xzf gsl-x.xx.tar.gz</nowiki></code> to extract the files | ||
# Type | # Type <code><nowiki>cd gsl-x.xx</nowiki></code> | ||
# Type | # Type <code><nowiki>./configure</nowiki></code>. | ||
# Type | # Type <code><nowiki> sudo make</nowiki></code> and enter your password as prompted. | ||
# If there is no error occurring, then type | # If there is no error occurring, then type <code><nowiki>sudo make install</nowiki></code> to install GSL. If you regret for the installation, you can type <code><nowiki>sudo make uninstall</nowiki></code>. If there is any error occurs and you want to restart the process, please type <code><nowiki>make clean</nowiki></code>. | ||
# Change to the directory which the muparser*.tar.gz locates and type | # Change to the directory which the muparser*.tar.gz locates and type <code><nowiki> tar -xzf muparser*.tar.gz</nowiki></code> to extract the files. | ||
# Type | # Type <code><nowiki>cd muparser</nowiki></code>. | ||
# Type | # Type <code><nowiki>./configure --enable-shared=no</nowiki></code> because LabRPS requires static library. | ||
# Type | # Type <code><nowiki>make</nowiki></code>. | ||
# Type | # Type <code><nowiki>sudo make install</nowiki></code>. The same options of make in (7) are still applicable. | ||
# Change to the directory which the qwt*.zip locates and type | # Change to the directory which the qwt*.zip locates and type <code><nowiki>unzip qwt*.zip</nowiki></code> to extract the files. | ||
# Change to the directory which the qwtplot3d*.zip locates and type | # Change to the directory which the qwtplot3d*.zip locates and type <code><nowiki>unzip qwtplot3d*.zip</nowiki></code> to extract the files. | ||
# Change to the directory which the LabRPS*.zip locates and type | # Change to the directory which the LabRPS*.zip locates and type <code><nowiki>unzip LabRPS*.zip</nowiki></code> to extract the files. | ||
# Copy both qwt-*.*.* and qwtplot3d folders into {{incode|LabRPS_*/3rdparty/}}, and change the folder name qwt-*.*.* into qwt | # Copy both qwt-*.*.* and qwtplot3d folders into {{incode|LabRPS_*/3rdparty/}}, and change the folder name qwt-*.*.* into qwt | ||
# Change to the newly created directory {{incode|LabRPS*/3rdparty/qwt}} | # Change to the newly created directory {{incode|LabRPS*/3rdparty/qwt}} | ||
# Open qwtconfig.pri with any text editor and add | # Open qwtconfig.pri with any text editor and add <code><nowiki>#</nowiki></code> at the beginning of the line <code><nowiki>CONFIG += QwtDll</nowiki></code> for building static library. | ||
# Type | # Type <code><nowiki>qmake -spec macx-g++</nowiki></code> to create make file for gcc compilier instead of xcode. | ||
# Type | # Type <code><nowiki>make</nowiki></code>. The same option <code><nowiki>clean</nowiki></code> of make in (7) is still applicable here. | ||
# Change to the newly created directory {{incode|LabRPS*/3rdparty/qwtplot3d}} | # Change to the newly created directory {{incode|LabRPS*/3rdparty/qwtplot3d}} | ||
# Open qwtplot3d.pro with any text editor and add a line | # Open qwtplot3d.pro with any text editor and add a line <code><nowiki>CONFIG += staticlib</nowiki></code> next to the line <code><nowiki>QT += opengl</nowiki></code> for building static library. | ||
# Type | # Type <code><nowiki>qmake -spec macx-g++</nowiki></code> to create make file for gcc compilier instead of xcode. | ||
# Type | # Type <code><nowiki>make</nowiki></code>. The same option <code><nowiki>clean</nowiki></code> of make in (7) is still applicable here. | ||
# Change to the directory {{incode|LabRPS*/}} and type {{incode|qmake -spec macx-g++}} | # Change to the directory {{incode|LabRPS*/}} and type {{incode|qmake -spec macx-g++}} | ||
# Type {{incode|sudo make}} | # Type {{incode|sudo make}} | ||
Line 103: | Line 103: | ||
# [http://doc.trolltech.com/4.4/deployment-mac.html Deploying an Application on Qt/Mac] | # [http://doc.trolltech.com/4.4/deployment-mac.html Deploying an Application on Qt/Mac] | ||
The basic step for building UB is to pass the option | The basic step for building UB is to pass the option <code><nowiki>-arch ppc -arch i386</nowiki></code> to compiler gcc and linker ld. Qt simply takes care this problem by adding the block <code><nowiki>macx {CONFIG += x86 ppc }</nowiki></code> in each source's {{incode|*.pro}} file. However, it is somewhat different for unix <code><nowiki>configure</nowiki></code>-base stuffs. The followings are the procedure for reference. | ||
# Building GSL in UB | # Building GSL in UB | ||
# Change to the root directory of GSL source and type | # Change to the root directory of GSL source and type <code><nowiki>./configure --disable-dependency-tracking</nowiki></code> | ||
# Type | # Type <code><nowiki>make CFLAGS="-g -O2 -arch i386 -arch ppc" LDFLAGS="-arch i386 -arch ppc"</nowiki></code> to pass the desired option. The original values of CFLAGS and LDFLAGS in makefile after executing configure script are <code><nowiki>-g -O2" and "</nowiki></code>, respectively. Therefore, I just append <code><nowiki>-arch i386 -arch ppc</nowiki></code> to the original values and put them after <code><nowiki>make</nowiki></code> to override. | ||
# Same as (I).(7). | # Same as (I).(7). | ||
# Building muParser in UB | # Building muParser in UB | ||
# Change to the root directory of GSL source and type | # Change to the root directory of GSL source and type <code><nowiki>./configure --enable-shared=no --disable-dependency-tracking</nowiki></code>. | ||
# Type | # Type <code><nowiki>make CPPFLAGS="-arch i386 -arch ppc" LDFLAGS="-arch i386 -arch ppc"</nowiki></code>. I do not use CFLAGS variable because the makefile does not contain it. However, I find CPPFLAGS, which should stands for c++ flags, in makefile and then I use it to pass the desired option. | ||
# Same as (I).(12). | # Same as (I).(12). | ||
# Building Qwt and QwtPlot3D in UB | # Building Qwt and QwtPlot3D in UB | ||
# Change to {{incode|LabRPS*/3rdparty/qwt}} and open qwtconfig.pri with text editor. | # Change to {{incode|LabRPS*/3rdparty/qwt}} and open qwtconfig.pri with text editor. | ||
# Adding the block | # Adding the block <code><nowiki>macx {CONFIG += x86 ppc }</nowiki></code> | ||
# Same as (I).(18)--(20) | # Same as (I).(18)--(20) | ||
# Change to {{incode|LabRPS*/3rdparty/qwtplot3d}} and open qwtplot3d.pro with text editor. | # Change to {{incode|LabRPS*/3rdparty/qwtplot3d}} and open qwtplot3d.pro with text editor. | ||
# Adding the block | # Adding the block <code><nowiki>macx {CONFIG += x86 ppc }</nowiki></code> after <code><nowiki>QT += opengl</nowiki></code>. In fact, this location is somewhat arbitrary and not necessarily here. | ||
{CONFIG += x86 ppc} | |||
# Same as (I).(22)--(24) | # Same as (I).(22)--(24) | ||
# Building LabRPS in UB | # Building LabRPS in UB | ||
# Change to {{incode|LabRPS*/LabRPS}} and open LabRPS.pro with text editor. | # Change to {{incode|LabRPS*/LabRPS}} and open LabRPS.pro with text editor. | ||
# Adding the block macx | # Adding the block <code><nowiki>macx {CONFIG += x86 ppc }</nowiki></code> in the section for Default settings for Linux / Mac OS X | ||
# Same as (I).(25)--(35) | # Same as (I).(25)--(35) | ||
Closing remark: The described procedures are testes and built on OS X 10.5.4 and | Closing remark: The described procedures are testes and built on OS X 10.5.4 and | ||
a macbook. The older OS such as 10.4.x and PPC machine might need to minor | a macbook. The older OS such as 10.4.x and PPC machine might need to minor | ||
revision on the procedures. For example, | revision on the procedures. For example, <code><nowiki>QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk</nowiki></code> might need to be added into the *.pro, {{incode|-isysroot /Developer/SDKs/MacOSX10.4u.sdk}} need to be added into CFLAGS | ||
and LDFLAGS. | and LDFLAGS. | ||
Good luck building LabRPS on Mac OS X. - Yu-Hung Lien | Good luck building LabRPS on Mac OS X. - Yu-Hung Lien |
Latest revision as of 02:54, 25 August 2022
This page explains step by step how to compile LabRPS 0.001 or newer on MacOS. For other platforms see Compiling.
Prerequisites
Compiling LabRPS on MacOS requires several tools and libraries.
- A compiler. LabRPS is tested with MinGW—other compilers may work, but instructions for their use are not included here. More details in #Compiler, below.
QwtPlot3D and Qwt must be compiled against Qt 5.x! If these are compiled with Qt3 or Qt4, the application might crash.
Get the source
In the following instructions, the source and build folders are created side-by-side under
/Users/username/LabRPS
but you can use whatever folders you want.
mkdir ~/LabRPS cd ~/LabRPS
The following command will clone the LabRPS git repository into a directory called LabRPS-git.
git clone https://github.com/LabRPS/LabRPS LabRPS-git
Create the build folder.
mkdir ~/LabRPS/build
Building LabRPS
Downloading the requirements:
Please download Qt, GSL, MuParser, Qwt and Qwt3D from their web sites before building:
- Qt:
ftp://ftp.trolltech.com/qt/source/qt-mac-opensource-4.4.1.dmg
(this is for version 4.4.1, the current one at the time of writing, there may be a newer) - GSL:
ftp://ftp.gnu.org/gnu/gsl/
(the current version at the time of writing: 1.11) - muParser:
http://downloads.sourceforge.net/muparser/
(the current version at the time of writing: 1.30) - Qwt:
http://downloads.sourceforge.net/qwt/
(the current version at the time of writing: 5.1.1) - QwtPlot3D:
http://prdownloads.sourceforge.net/qwtplot3d/qwtplot3d-0.2.7.zip?download
(the current version at the time of writing: 0.2.7)
(I) Building the OS X binary on one's own platform:
- Open the image file and install Qt for Mac.
- Open Terminal and change to the directory which the gsl-x.xx.tar.gz locates. For example, type
cd Downloads
, if gsl-x.xx.tar.gz locates in the downloads folder of your home directory. - Type
tar -xzf gsl-x.xx.tar.gz
to extract the files - Type
cd gsl-x.xx
- Type
./configure
. - Type
sudo make
and enter your password as prompted. - If there is no error occurring, then type
sudo make install
to install GSL. If you regret for the installation, you can typesudo make uninstall
. If there is any error occurs and you want to restart the process, please typemake clean
. - Change to the directory which the muparser*.tar.gz locates and type
tar -xzf muparser*.tar.gz
to extract the files. - Type
cd muparser
. - Type
./configure --enable-shared=no
because LabRPS requires static library. - Type
make
. - Type
sudo make install
. The same options of make in (7) are still applicable. - Change to the directory which the qwt*.zip locates and type
unzip qwt*.zip
to extract the files. - Change to the directory which the qwtplot3d*.zip locates and type
unzip qwtplot3d*.zip
to extract the files. - Change to the directory which the LabRPS*.zip locates and type
unzip LabRPS*.zip
to extract the files. - Copy both qwt-*.*.* and qwtplot3d folders into
LabRPS_*/3rdparty/
, and change the folder name qwt-*.*.* into qwt - Change to the newly created directory
LabRPS*/3rdparty/qwt
- Open qwtconfig.pri with any text editor and add
#
at the beginning of the lineCONFIG += QwtDll
for building static library. - Type
qmake -spec macx-g++
to create make file for gcc compilier instead of xcode. - Type
make
. The same optionclean
of make in (7) is still applicable here. - Change to the newly created directory
LabRPS*/3rdparty/qwtplot3d
- Open qwtplot3d.pro with any text editor and add a line
CONFIG += staticlib
next to the lineQT += opengl
for building static library. - Type
qmake -spec macx-g++
to create make file for gcc compilier instead of xcode. - Type
make
. The same optionclean
of make in (7) is still applicable here. - Change to the directory
LabRPS*/
and typeqmake -spec macx-g++
- Type
sudo make
- As the building ends up with no error, the LabRPS application will be in
LabRPS*/LabRPS
. Unfortunately, the icon seems missed for some unknown reason and shows as a generic application icon.
(II) Building Universal Binaries (UB):
The whole process is essentially same as above except some extra commands for universal binaries. The references for building universal binaries for typical unix make systems can be found at:
- Porting UNIX/Linux Applications to Mac OS X: Compiling for Multiple CPU Architectures
- Building Universal Binaries from "configure"-based Open Source Projects
- qmake Platform Notes
- Deploying an Application on Qt/Mac
The basic step for building UB is to pass the option -arch ppc -arch i386
to compiler gcc and linker ld. Qt simply takes care this problem by adding the block macx {CONFIG += x86 ppc }
in each source's *.pro
file. However, it is somewhat different for unix configure
-base stuffs. The followings are the procedure for reference.
- Building GSL in UB
- Change to the root directory of GSL source and type
./configure --disable-dependency-tracking
- Type
make CFLAGS="-g -O2 -arch i386 -arch ppc" LDFLAGS="-arch i386 -arch ppc"
to pass the desired option. The original values of CFLAGS and LDFLAGS in makefile after executing configure script are-g -O2" and "
, respectively. Therefore, I just append-arch i386 -arch ppc
to the original values and put them aftermake
to override. - Same as (I).(7).
- Building muParser in UB
- Change to the root directory of GSL source and type
./configure --enable-shared=no --disable-dependency-tracking
. - Type
make CPPFLAGS="-arch i386 -arch ppc" LDFLAGS="-arch i386 -arch ppc"
. I do not use CFLAGS variable because the makefile does not contain it. However, I find CPPFLAGS, which should stands for c++ flags, in makefile and then I use it to pass the desired option. - Same as (I).(12).
- Building Qwt and QwtPlot3D in UB
- Change to
LabRPS*/3rdparty/qwt
and open qwtconfig.pri with text editor. - Adding the block
macx {CONFIG += x86 ppc }
- Same as (I).(18)--(20)
- Change to
LabRPS*/3rdparty/qwtplot3d
and open qwtplot3d.pro with text editor. - Adding the block
macx {CONFIG += x86 ppc }
afterQT += opengl
. In fact, this location is somewhat arbitrary and not necessarily here. - Same as (I).(22)--(24)
- Building LabRPS in UB
- Change to
LabRPS*/LabRPS
and open LabRPS.pro with text editor. - Adding the block
macx {CONFIG += x86 ppc }
in the section for Default settings for Linux / Mac OS X - Same as (I).(25)--(35)
Closing remark: The described procedures are testes and built on OS X 10.5.4 and
a macbook. The older OS such as 10.4.x and PPC machine might need to minor
revision on the procedures. For example, QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk
might need to be added into the *.pro, -isysroot /Developer/SDKs/MacOSX10.4u.sdk
need to be added into CFLAGS
and LDFLAGS.
Good luck building LabRPS on Mac OS X. - Yu-Hung Lien
Additional information
- Forums and mailing lists If you want to discuss LabRPS with other users (or the developers) or if you are insterested in its further development, you can go to the LabRPS forum.
- License LabRPS is distributed under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. A copy of this license is provided in the file `gpl.txt`.
Thus it is "free software". "Free software" is a matter of liberty, not price. To understand the concept, you should think of "free" as in "free speech", not as in "free beer". "Free software" is also often called Open Source, FOSS, or FLOSS. When we say that LabRPS is "free", we are talking about
- The freedom to run the program, for any purpose (freedom 0).
- The freedom to study how the program works, and adapt it to your needs (freedom 1). Access to the source code is a precondition for this.
- The freedom to redistribute copies so you can help your neighbor (freedom 2).
- The freedom to improve the program, and release your improvements to the public, so that the whole community benefits (freedom 3). Access to the source code is a precondition for this.
That said, LabRPS is also free as in "free beer". We do not charge money for anything you can download on our homepage and we will not do so in the future. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- Getting started
- Installation: Download, Windows, Linux, Mac, Additional components, AppImage
- Basics: About LabRPS, Interface, RPS Objects, Object name, Preferences, Workbenches, Document structure, Properties, Help LabRPS, Donate
- Help: Tutorials, Video tutorials
- Workbenches: Std Base, WindLab, SeismicLab, SeaLab, UserLab, Spreadsheet, Plot, Web
- Hubs: User hub, Power users hub, Developer hub