tag:blogger.com,1999:blog-4215901518676958442024-03-14T15:08:46.446+03:00IT BlogAnonymoushttp://www.blogger.com/profile/08230285726288058872noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-421590151867695844.post-52206511708941167302012-10-06T17:17:00.001+03:002012-10-06T17:18:35.984+03:00Build LibreOffice on OS X 10.8 with Xcode 4.5A lot of people have problems with building LibreOffice on OS X Mountain Lion with latest Xcode 4.5.<br />
Below you can see how I succeeded with it.<br />
<br />
I tried building LibreOffice 3.6.1.2.<br />
At first I tell you what you should <b>NOT</b> do to build LibreOffice.<br />
Then you will see steps to build LibreOffice 3.6.1.2 on OS X 10.8 with Xcode 4.5.<br />
<br />
<br />
<a name='more'></a><h1>
What you should NOT do to build LibreOffice</h1>
<h3>
Do not try to build LibreOffice from source codes archive file.</h3>
My first try was building source codes from file libreoffice-core-3.6.1.2.tar.xz. This archive contains dozens of files that renamed to names with "_" (underscore) sign at the end of file name.<br />
This leads to build errors like this one:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">javac: file not found: /Users/fsv/projects/libreoffice-core-3.6.1.2/jurt/com/sun/star/lib/uno/bridges/java_remote/XConnectionInputStream_Adapter.java</span></blockquote>
<div>
This is because file <span style="font-family: Courier New, Courier, monospace;">XConnectionInputStream_Adapter.java</span> renamed to <span style="font-family: Courier New, Courier, monospace;">XConnectionInputStream_Adapter.java_</span>.</div>
<br />
<h3>
Do not try to build LibreOffice with MacOSX SDK 10.7 or MacOSX SDK 10.8.</h3>
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.<br />
If you'll use SDK 10.7, you'll see next build error:<br />
<blockquote class="tr_bq">
<span style="font-family: 'Courier New', Courier, monospace; font-size: x-small;">/Users/fsv/projects/libreoffice-core/vcl/aqua/source/dtrans/PictToBmpFlt.cxx:133:7: error: use of undeclared identifier 'KillPicture'</span></blockquote>
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:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">checking the presence of the SDK 10.6... configure: error: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk not found</span></blockquote>
Below I tell how to add SDK 10.6 to Xcode 4.5.<br />
<br />
<h3>
Do not try to build LibreOffice with gcc/g++</h3>
<div>
There were a lot of build errors that I couldn't solve. For example this one:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">Undefined symbols for architecture i386:</span><span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> "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:</span><span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> non-virtual thunk to ucbhelper::ContentImplHelper::getParent()in contenthelper.o</span><span style="font-family: Courier New, Courier, monospace; font-size: x-small;">ld: symbol(s) not found for architecture i386</span></blockquote>
Instead of gcc/g++ use clang/clang++.<br />
<br />
<h3>
Do not try to build LibreOffice for x86_64 architecture</h3>
This will lead to build errors like this one:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">macosx-create-bundle: error: file is not an executable or shared library.</span></blockquote>
</div>
You need add -m32 parameter to CC/CXX<br />
<br />
<h3>
Do not try to build LibreOffice with --enable-werror parameter</h3>
Currently 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:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">/Users/fsv/projects/libreoffice-core/cppu/source/uno/lbenv.cxx:199:50: error: unused variable 'insertion' [-Werror,-Wunused-variable]</span><br />
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;"> ::std::pair< Ptr2ObjectMap::iterator, bool > insertion(</span></blockquote>
<h3>
Do not try re-run `./autogen.sh` with different options without `make clean`</h3>
<div>
<div>
This can lead to build errors. And it's hard to find what's happened.</div>
<div>
If you want to change some options for autogen.sh script, always run `make clean`.</div>
<br />
<br />
<br />
<h1>
Steps To build LibreOffice on Mac OS X 10.8 with Xcode 4.5</h1>
Now it's time to list all steps to build LibreOffice<br />
<h3>
Step 1. Add MacOSXSDK10.6 to Xcode</h3>
Xcode 4.5 doesn't have OS X SDK 10.6.<br />
But you can download Xcode 4.3.2 for Lion <a href="https://developer.apple.com/downloads/" target="_blank">here</a>. Mount dmg image and copy SDK:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">`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`</span></blockquote>
<h3>
Step 2. Install Xcode Command Line Tools</h3>
In Xcode 4.5 go Xcode -> Preferences... -> Downloads -> Components, then choose install Command Line Tools<br />
<br />
<h3>
Step 3. Install MacPorts, install autotools and other tools</h3>
Install <a href="http://www.macports.org/" target="_blank">MacPorts</a>.<br />
Then run next command:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">`sudo port install autoconf automake m4 p5-archive-zip`</span></blockquote>
<h3>
Step 4. Clone LibreOffice git repository, checkout branch that you need</h3>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">`git clone git://anongit.freedesktop.org/libreoffice/core libreoffice-core`</span></blockquote>
Then checkout branch that you need. For me this is<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">`git checkout libreoffice-3-6-1`</span></blockquote>
<h3>
Step 5. Run autogen.sh and make</h3>
Create autogen.lastrun file in source codes root directory with next content:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">--disable-binfilter<br />
--disable-build-mozilla<br />
--disable-mozilla<br />
--disable-odk<br />
--disable-online-update<br />
--disable-python<br />
--enable-debug=cppu/ cppuhelper/ sal/ sfx2/ stoc/ sw/ toolkit/ unotools/ vcl/<br />
--enable-epm<br />
--with-java-target-version=1.6<br />
--with-macosx-version-min-required=10.6<br />
--with-max-jobs=2<br />
--with-num-cpus=2<br />
--without-doxygen<br />
--without-help<br />
--without-helppack-integration<br />
--without-myspell-dicts<br />
CC=clang -m32<br />
CXX=clang++ -m32</span></blockquote>
You can add/change/remove some params, but do <b>NOT</b> try adding --enable-werror param!<br />
Then run autogen.sh script without args. It will use parameters from autogen.lastrun file.<br />
<br />
Then you can make LibreOffice:<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace; font-size: x-small;">`make`</span></blockquote>
<br />
Build succeeded in 1.5 hours.<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/08230285726288058872noreply@blogger.com0tag:blogger.com,1999:blog-421590151867695844.post-56536473694712041482012-03-09T16:07:00.001+03:002012-03-09T16:18:37.741+03:00Missing stack trace in Xcode 4.2+ on iOS Device and Simulator when exception is thrown<div dir="ltr" style="text-align: left;" trbidi="on">
After updating Xcode to version 4.2 I had difficulties with iOS app debugging.<br />
For example, when I call <b>objectAtIndex:</b> method of an empty NSArray object, my app receives <b>SIGABRT</b> signal and execution is stopped in <b>main()</b> function with no information that can help me to find the error:<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIcu9JBs_h5LTtVSIOpcCcLgJVPD5F6hZUpZj-Y2U0q95sln0kneImrsrOcZ_r44DoSUMxQ6ABVJtT2dXH_Es1cUwM0yxpYuFW9Nnb3DygNld2W1PKG3L9sE4yox05xlq_BVOuWO6Nq7vk/s1600/Screen+Shot+2012-03-09+at+15.08.48+.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIcu9JBs_h5LTtVSIOpcCcLgJVPD5F6hZUpZj-Y2U0q95sln0kneImrsrOcZ_r44DoSUMxQ6ABVJtT2dXH_Es1cUwM0yxpYuFW9Nnb3DygNld2W1PKG3L9sE4yox05xlq_BVOuWO6Nq7vk/s400/Screen+Shot+2012-03-09+at+15.08.48+.png" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">NSRangeException will be thrown</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIc4sO7aN62UnY-WpDV60JXIqFrM_E6Uw7EXZjKLpKsob3Uq_eCg6aY2owMHZCZxF19-UesNI2wtjRlK5CeOjH8qcmPTzfHpnHIuND7HAVV3UC-hBS91ZGFwciyvmA2pHt0BgekricHfpQ/s1600/Screen+Shot+2012-03-09+at+15.13.53+.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="305" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIc4sO7aN62UnY-WpDV60JXIqFrM_E6Uw7EXZjKLpKsob3Uq_eCg6aY2owMHZCZxF19-UesNI2wtjRlK5CeOjH8qcmPTzfHpnHIuND7HAVV3UC-hBS91ZGFwciyvmA2pHt0BgekricHfpQ/s400/Screen+Shot+2012-03-09+at+15.13.53+.png" width="400" /></a></td></tr>
</tbody></table>
In console we can see that our app has terminated due to uncaught exception <b>NSRangeException</b>.<br />
So the problem is that Xcode doesn't setup exception handler.<br />
<br />
<a name='more'></a>Xcode allows us add exception breakpoints. Open Breakpoint Navigator and click "+" in bottom left of this tab:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhML0jdY6rieDabOAChWtfH49qsjNi4dqhD7i8gaIT0pbCHA-aK13JDvgd9eMxGKFOKSEf2J_rpX3chY1XuLzvb4YCgmrzOqDW-OeedZ50UfZeVC9vuXvw9A8pV6G9EAL35wJLkypW38H83/s1600/Screen+Shot+2012-03-09+at+15.10.59+.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhML0jdY6rieDabOAChWtfH49qsjNi4dqhD7i8gaIT0pbCHA-aK13JDvgd9eMxGKFOKSEf2J_rpX3chY1XuLzvb4YCgmrzOqDW-OeedZ50UfZeVC9vuXvw9A8pV6G9EAL35wJLkypW38H83/s400/Screen+Shot+2012-03-09+at+15.10.59+.png" width="270" /></a></div>
<br />
Then click "Add Exception Breakpoint...". You will see next window:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdDDKkK8TUNu1vFkb9R8odOISlq3T04lV0dpr66LVVZv5ThGs3068iOSWPElJ9l0lFeE24CmB_XiH0QWsNDIuy2gJfX1Bt4tiohDUDpTOK8upKIx5LvaUjWta5zu_r6dYgqmOaUf0H4GLY/s1600/Screen+Shot+2012-03-09+at+15.11.22+.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="226" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdDDKkK8TUNu1vFkb9R8odOISlq3T04lV0dpr66LVVZv5ThGs3068iOSWPElJ9l0lFeE24CmB_XiH0QWsNDIuy2gJfX1Bt4tiohDUDpTOK8upKIx5LvaUjWta5zu_r6dYgqmOaUf0H4GLY/s400/Screen+Shot+2012-03-09+at+15.11.22+.png" width="400" /></a></div>
<br />
After clicking "Done" try to run your app. You will see that execution is stopped on line of code where exception is thrown with full stack trace:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg63Y8AGygcRu5GyydvrXpopul_Xhe2SaE465Xypm_0iPEFIeWocFix1H4b7dyczjpzRC_bRZRsJpfpFhCH3VxSpXCrZIiTPR6f8c1ur_nDp3DMJcZW6R5YKM0Dvz_bUowoKAiYr-phKm1X/s1600/Screen+Shot+2012-03-09+at+15.12.24+.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="317" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg63Y8AGygcRu5GyydvrXpopul_Xhe2SaE465Xypm_0iPEFIeWocFix1H4b7dyczjpzRC_bRZRsJpfpFhCH3VxSpXCrZIiTPR6f8c1ur_nDp3DMJcZW6R5YKM0Dvz_bUowoKAiYr-phKm1X/s400/Screen+Shot+2012-03-09+at+15.12.24+.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
Also Xcode allows us to share any breakpoint with all your projects. When you Right-click (or Ctrl-Click) on breakpoint and choose "Move Breakpoint To"->"User" you will move the breakpoint to your user profile.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtZFWR5Vh3pL3U-o6uXBAS-5nmm0XXrv8vHle_ietb8EujvqrMYArOTay0ALsWnOslDRCxm-zK5olT3IYLO1iYiYY4yCYsOeveGiXJFBHEF7256npA6K75dtMZrNLURdR8B_CuuAYAOeIn/s1600/Screen+Shot+2012-03-09+at+15.11.40+.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="181" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtZFWR5Vh3pL3U-o6uXBAS-5nmm0XXrv8vHle_ietb8EujvqrMYArOTay0ALsWnOslDRCxm-zK5olT3IYLO1iYiYY4yCYsOeveGiXJFBHEF7256npA6K75dtMZrNLURdR8B_CuuAYAOeIn/s400/Screen+Shot+2012-03-09+at+15.11.40+.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
Now it's much more easier to debug any iOS app in Xcode. </div>Anonymoushttp://www.blogger.com/profile/08230285726288058872noreply@blogger.com0