Compiling and using master on macOS

Daniel xracoonx at gmx.de
Mon Jul 13 02:02:49 UTC 2020


On 2020-07-08 08:28, Stephan Witt wrote:
> Am 07.07.2020 um 07:35 schrieb Daniel <xracoonx at gmx.de>:
>>
>> On 2020-07-07 07:30, Daniel wrote:
>>> On 2020-07-07 00:24, Stephan Witt wrote:
>>>> Am 06.07.2020 um 09:59 schrieb Daniel <xracoonx at gmx.de>:
>>>>>
>>>>> On 2020-03-15 21:37, Stephan Witt wrote:
>>>>>> Am 15.03.2020 um 17:16 schrieb Daniel <xracoonx at gmx.de>:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I am about to try compiling and using master on macOS. I just has a look at INSTALL.MacOSX. It mentions Qt version 4. That seems a bit outdated. But I guess that I am looking at the latest guide to compile on macOS, right?
>>>>>> Yes, it’s outdated. It should work with Qt4 - but Qt4 cannot be used on recent macOS.
>>>>>> Basically I’m using the script LyX-Mac-binary-release.sh in development folder. That’s much easier than other options, IMO.
>>>>>> First step is to install Xcode and the automake and/or cmake utilities. This can be done with macports or homebrew. I’m using macports.
>>>>>> Second step is to get Qt5 - as source or binary distribution. I’m using the source tarball and build Qt5 myself.
>>>>>> Optional components are the spell checker and libmagic frameworks.
>>>>>> Finally I start development/LyX-Mac-binary-release.sh with
>>>>>> --enable-cxx11
>>>>>> --with-qt-dir=/path/to/qt5
>>>>>> Stephan
>>>>>
>>>>> Thanks. Finally came around trying it on macOS. I take it one has to run the last command with sh, right? So, from the lyx directory (in the lyxgit directory) I execute
>>>>>
>>>>> sh development/LyX-Mac-binary-release.sh --enable-cxx11 --with-qt-dir=/Users/<username>/Qt/5.9.9
>>>>>
>>>>> (where I replace <username> by my macOS user name. Unfortunately, I get the following:
>>>>>
>>>>> : command not found-binary-release.sh: line 2:
>>>>> : command not found-binary-release.sh: line 4:
>>>>> : command not found-binary-release.sh: line 9:
>>>>> : command not found-binary-release.sh: line 19:
>>>>> : command not found-binary-release.sh: line 23:
>>>>> : command not found-binary-release.sh: line 27:
>>>>> ': not a valid identifiery-release.sh: line 28: unset: `LD_LIBRARY_PATH
>>>>> : command not found-binary-release.sh: line 29:
>>>>> : command not found-binary-release.sh: line 44:
>>>>> : command not found-binary-release.sh: line 49:
>>>>> development/LyX-Mac-binary-release.sh: line 53: syntax error near unexpected tok'n `in
>>>>> 'evelopment/LyX-Mac-binary-release.sh: line 53: `case "${QtVersion}:${QtAPI}" in
>>>>>
>>>>> By the way, if finally successful, where will this put the LyX.app?
>>>>>
>>>>> Daniel
>>>>
>>>> I’ve made a protocol of the steps I took to build the package on a new system. See the attached log. Probably the crucial thing is the mklyx-2.3.4.3.sh script.
>>>>
>>>> I’m used to configure and build LyX out of source. I have a working directory with one or more versions of LyX source code and a directory lyx-build for the results. For Qt I have a source directory and an install target in parallel, the build directory is in lyx-build.
>>>>
>>>> $ ls /Users/Shared/LyX
>>>> lyx-2.3.4.3 (source)
>>>> lyx-2.3.5.2 (source)
>>>> lyx-build (directory)
>>>> qt-5.9.9-frameworks-cocoa-x86_64  (QTDIR for 5.9.9)
>>>> qt-everywhere-opensource-src-5.9.9 (source)
>>>>
>>>> The lyx-build contains the build directory, the installed package (LyX.app) and the resulting disk image.
>>>>
>>>> $ ls /Users/Shared/LyX/
>>>> LyX-2.3.4.3+qt5-x86_64-cocoa.dmg (disk image)
>>>> LyX-2.3.4.3.app (working app)
>>>> LyX-2.3.4.3.build (binaries)
>>>> LyX-2.3.5.2+qt5-x86_64-cocoa.dmg (disk image)
>>>> LyX-2.3.5.2.app (working app)
>>>> LyX-2.3.5.2.build (binaries)
>>>> qt-5.9.9-build-x86_64 (binaries)
>>>>
>>>> The /bin/sh on a Mac is in fact a bash, IMO.
>>>>
>>>> Stephan
>>>>
>>>>
>>> I am using git to download the lyx source and qt installer. But the steps should be the same except for the unpacking and setting my own directories, right?
>>> Also what does
>>> osascript -e 'tell application "Finder" to display notification "LyX is great stuff"'
>>> do? It looks strange.
>>> Daniel
>>
>> Okay, I guess it can't be the same because there is a specific LyX version mentioned (2.3.4.3). What would I use if I want to compile from git (master)?
> 
> Yes, that’s true - this is the build from the shipped tar file for 2.3.4.3. But it works for git clones too.
> 
> The difference to master is the name of the directory and this is your choice. I’m using „lyx“ for it. I have another git clone for stable named „lyx-2.3.x“.
> 
> The resulting applications are placed in lyx-build and named according to the AC_INIT macro in configure.ac (e.g. LyX,2.4.0dev => LyX-2.4.0dev.app).
> 
> In case you want to do the single steps w/o the build script you may try the following:
> 
> 1. create a dedicated build dir - e.g. lyx-build/master
> 
> 2. create or update the configure script - run autogen.sh in your git checkout (in place)
> 
> 3. prepare your environment variables
> 
> export CPPFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -arch x86_64 -mmacosx-version-min=10.10"
> export CXXFLAGS=-std=c++11
> export CPPFLAGS="${CPPFLAGS}"
> export LDFLAGS="${CPPFLAGS}"
> 
> The path names are subject to change. Depending on Apples choice where to place the SDKs.
> 
> 4. run configure with your build directory as working dir (with explicit given relative path name)
> 
> (cd lyx-build/master;sh ../../lyx/configure --enable-warnings --enable-optimization=-Os --with-x=no --disable-stdlib-debug --with-qt-dir=/Users/Shared/LyX/qt-5.9.9-frameworks-cocoa-x86_64 --prefix=/path/to/application-directory/application-name)
> 
> This should produce multiple lines of „checking for something“ and finally
> 
> Configuration
>    Host type:               x86_64-apple-darwin18.7.0
>    Special build flags:      build=development std-regex warnings assertions
>    Bundled libraries:        boost mythes
>    C++ Compiler:            g++ (11.0.0)
>    C++ Compiler flags:       -Wall -Wextra -g -Os -std=c++14  -Wno-deprecated-register
>    C++ Compiler user flags:  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -arch x86_64 -mmacosx-version-min=10.10 -std=c++14  -std=c++11
>    Linker flags:
>    Linker user flags:       -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -arch x86_64 -mmacosx-version-min=10.10
>    Qt Frontend:
>        Qt version:	   5.9.9
>    Packaging:               macosx
>    LyX binary dir:          /path/to/application-directory/application-name/Contents/MacOS
>    LyX files dir:           /path/to/application-directory/application-name/Contents/Resources
> 
> === The following minor problems have been detected by configure.
> === Please check the messages below before running 'make'.
> === (see the section 'Problems' in the INSTALL file)
> 
> == cannot find magic.h. Please check that the libmagic library
>     is correctly installed on your system.
>     Falling back to builtin file format detection.
> 
> 
> Configuration of LyX was successful.
> Type 'make' to compile the program,
> and then 'make install' to install it.

Unfortunately, I get no success here either:

% export CPPFLAGS="-isysroot 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk 
-arch x86_64 -mmacosx-version-min=10.10"
export CXXFLAGS=-std=c++11
export CPPFLAGS="${CPPFLAGS}"
export LDFLAGS="${CPPFLAGS}"

% cd lyx-build/master
% sh ../../lyx/configure --enable-warnings --enable-optimization=-Os 
--with-x=no --disable-stdlib-debug 
--with-qt-dir=/Users/<user-name>/Qt/5.9.9/clang_64 
--prefix=/Applications/LyX-Dev
configuring LyX version 2.4.0dev
checking for build type... development
checking for version suffix...
checking whether Qt5 is disabled... no
checking build system type... x86_64-apple-darwin19.5.0
checking host system type... x86_64-apple-darwin19.5.0
checking target system type... x86_64-apple-darwin19.5.0
checking what packaging should be used... macosx
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... yes
checking for a BSD-compatible install... /opt/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /opt/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether UID '502' is supported by ustar format... yes
checking whether GID '20' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking for a Python interpreter with version >= 2.7.0 or 3.5.0... python3
checking for python3... /Users/<user-name>/opt/anaconda3/bin/python3
checking for python version... 3.7
checking for python platform... darwin
checking for python script directory... 
${prefix}/lib/python3.7/site-packages
checking for python extension module directory... 
${exec_prefix}/lib/python3.7/site-packages
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking for ranlib... ranlib
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking whether the compiler is clang... yes
checking for clang version... 11.0.0
checking for at least C++11 mode... -std=c++14
checking whether STL is libstdc++... no
checking whether STL is libstdc++ using the C++11 ABI... no
checking for correct regex implementation... yes
checking for std::call_once availability... yes
checking for gcc... gcc
checking whether we are using the GNU Objective C compiler... yes
checking whether gcc accepts -g... yes
checking dependency style of gcc... gcc3
checking dependency style of gcc... (cached) gcc3
checking for extra library directory... NONE
checking for extra include directory... NONE
checking for extra lib+include directory... NONE
checking for main in -lshlwapi... no
checking for main in -lpsapi... no
checking for main in -lgdi32... no
checking for main in -lole32... no
checking whether to use included boost library... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether byte ordering is bigendian... no
checking whether printing callstack is possible... (cached) yes
checking whether make_unique is defined by header memory... no
checking size of wchar_t... 4
checking for wchar_t... yes
checking for unsigned long long int... yes
checking for long long int... yes
checking for ld used by GCC... 
/Library/Developer/CommandLineTools/usr/bin/ld
checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) 
is GNU ld... no
checking for shared library run path origin... 
../../lyx/config/config.rpath: li: command not found
: command not foundnfig.rpath: line 27:
: command not foundnfig.rpath: line 32:
: command not foundnfig.rpath: line 37:
: command not foundnfig.rpath: line 39:
'./../lyx/config/config.rpath: line 40: syntax error near unexpected 
token `do
'./../lyx/config/config.rpath: line 40: `for cc_temp in $CC""; do
done
checking for iconv... yes
checking for working iconv... yes
checking how to link with libiconv... -liconv
checking for iconv declaration...
          extern size_t iconv (iconv_t cd, char * *inbuf, size_t 
*inbytesleft, char * *outbuf, size_t *outbytesleft);
checking whether to use included iconv library... no
checking whether to use included zlib library... no
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for gzopen in -lz... yes
checking whether to build dv2dt and dt2dv... no
checking magic.h usability... no
checking magic.h presence... no
checking for magic.h... no
checking for pkg-config... /opt/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for QT_CORE... checking for QT_FRONTEND... checking for X... 
disabled
checking for Qt library name... failed, retrying with Qt4
checking for QT_CORE... checking for QT_FRONTEND... checking for X... 
disabled
checking for Qt library name... (cached) failed
configure: error: cannot compile a simple Qt executable. Check you have 
the right $QTDIR.


(Where <user-dir> is my user directory.) Seems as if my Qt install was 
not correct. It created a bunch of stuff in

~/Qt/5.9.9/clang_64

But I am not sure that is what is needed. During the installation I chose

Qt > Qt 5.9.9 > macOS


Daniel



More information about the lyx-devel mailing list