Below you can see how I succeeded with it.
I tried building LibreOffice 188.8.131.52.
At first I tell you what you should NOT do to build LibreOffice.
Then you will see steps to build LibreOffice 184.108.40.206 on OS X 10.8 with Xcode 4.5.
What you should NOT do to build LibreOffice
Do not try to build LibreOffice from source codes archive file.My first try was building source codes from file libreoffice-core-220.127.116.11.tar.xz. This archive contains dozens of files that renamed to names with "_" (underscore) sign at the end of file name.
This leads to build errors like this one:
javac: file not found: /Users/fsv/projects/libreoffice-core-18.104.22.168/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java
This is because file XConnectionInputStream_Adapter.java renamed to XConnectionInputStream_Adapter.java_.
Do not try to build LibreOffice with MacOSX SDK 10.7 or MacOSX SDK 10.8.You need MacOSX SDK 10.6. One of the reasons is QuickTime.framework with deprecated function KillPicture. This function is not declared in headers of SDK 10.7 and 10.8. Only in SDK 10.6.
If you'll use SDK 10.7, you'll see next build error:
/Users/fsv/projects/libreoffice-core/vcl/aqua/source/dtrans/PictToBmpFlt.cxx:133:7: error: use of undeclared identifier 'KillPicture'Xcode 4.5 doesn't have MacOSX SDK 10.6. You will see next error if you add --with-macosx-version-min-required=10.6 parameter:
checking the presence of the SDK 10.6... configure: error: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk not foundBelow I tell how to add SDK 10.6 to Xcode 4.5.
Do not try to build LibreOffice with gcc/g++
There were a lot of build errors that I couldn't solve. For example this one:You need add -m32 parameter to CC/CXX
Undefined symbols for architecture i386: "com::sun::star::uno::Reference<com::sun::star::uno::XInterface>::operator com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&() const", referenced from: non-virtual thunk to ucbhelper::ContentImplHelper::getParent()in contenthelper.old: symbol(s) not found for architecture i386Instead of gcc/g++ use clang/clang++.
Do not try to build LibreOffice for x86_64 architectureThis will lead to build errors like this one:
macosx-create-bundle: error: file is not an executable or shared library.
Do not try to build LibreOffice with --enable-werror parameterCurrently LibreOffice have a lot of warnings unfixed. --enable-werror option adds -Werror parameter to compiler, and unused parameters/variables will generate build errors like this one:
/Users/fsv/projects/libreoffice-core/cppu/source/uno/lbenv.cxx:199:50: error: unused variable 'insertion' [-Werror,-Wunused-variable]
::std::pair< Ptr2ObjectMap::iterator, bool > insertion(
Do not try re-run `./autogen.sh` with different options without `make clean`
This can lead to build errors. And it's hard to find what's happened.
If you want to change some options for autogen.sh script, always run `make clean`.
Steps To build LibreOffice on Mac OS X 10.8 with Xcode 4.5Now it's time to list all steps to build LibreOffice
Step 1. Add MacOSXSDK10.6 to XcodeXcode 4.5 doesn't have OS X SDK 10.6.
But you can download Xcode 4.3.2 for Lion here. Mount dmg image and copy SDK:
`sudo cp -r /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk`
Step 2. Install Xcode Command Line ToolsIn Xcode 4.5 go Xcode -> Preferences... -> Downloads -> Components, then choose install Command Line Tools
Step 3. Install MacPorts, install autotools and other toolsInstall MacPorts.
Then run next command:
`sudo port install autoconf automake m4 p5-archive-zip`
Step 4. Clone LibreOffice git repository, checkout branch that you need
`git clone git://anongit.freedesktop.org/libreoffice/core libreoffice-core`Then checkout branch that you need. For me this is
`git checkout libreoffice-3-6-1`
Step 5. Run autogen.sh and makeCreate autogen.lastrun file in source codes root directory with next content:
--disable-binfilterYou can add/change/remove some params, but do NOT try adding --enable-werror param!
--enable-debug=cppu/ cppuhelper/ sal/ sfx2/ stoc/ sw/ toolkit/ unotools/ vcl/
Then run autogen.sh script without args. It will use parameters from autogen.lastrun file.
Then you can make LibreOffice:
Build succeeded in 1.5 hours.