[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Ubuntu CMake instructions
From: |
David Chisnall |
Subject: |
Re: Ubuntu CMake instructions |
Date: |
Thu, 27 Dec 2012 19:55:23 +0000 |
Hi Patrky,
Thanks for doing this, I have a few comments:
On 27 Dec 2012, at 18:26, Patryk Laurent wrote:
> Greetings,
>
> Here are some step-by-step instructions for installing the latest Objective C
> (including libobjc2) on a fresh Ubuntu server 12.10. I have posted it to the
> Wiki in case anyone has edits.
>
> http://wiki.gnustep.org/index.php/GNUstep_under_Ubuntu_Linux
>
> Best,
> Patryk
>
>
> # Objective C 2.0 installation
> # On fresh install of Ubuntu 12.10 Server
> # Patryk Laurent (http://pakl.net/)
> # Dec 27, 2012
>
> sudo aptitude install build-essential git subversion ninja cmake
>
> svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
> cd llvm/tools
> svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
> cd .. # Back to llvm directory
> ./configure --enable-optimized
Please use the CMake build system for LLVM, not the autoconf one. The autoconf
one does not install the CMake modules, which are needed for building out of
tree modules, such as the LLVM optimisation passes included with libobjc2.
It's also significantly faster to configure, and better at handling incremental
builds.
I'd also recommend using ninja instead of make (-G Ninja to the cmake command
line), although it doesn't make much difference if you are not doing
incremental builds. If you are going to update LLVM / Clang regularly, using
ninja will save a lot of build time.
Oh, and in-tree builds are not supported for LLVM with either build system, and
do periodically break.
> make -j4 # Go off to prepare cup of coffee here.
-j4 depends a lot on the amount of RAM you have. For LLVM, -j {number of GBs
of RAM you have} generally gives best performance. A number of the phases
(especially linking, but compiling some of the template-heavy classes is the
same) use about 1GB of RAM and if you hit swap then that can easily turn a
five-second compile into a one minute compile.
>
> export PATH=$PATH:~/llvm/Release+Asserts/bin # Add to .bashrc
> export CC=clang # Add to .bashrc
Also export CXX=clang++.
> clang -v
>
> svn co http://svn.gna.org/svn/gnustep/modules/core
> svn co http://svn.gna.org/svn/gnustep/libs/libobjc2/trunk libobjc2
You should build and install libobj2 at this point:
$ cd libobjc2
$ mkdir Build
$ cd Build
$ cmake ..
$ make -j8 && sudo make install
or:
$ cmake .. -G Ninja
$ ninja && sudo -E ninja install
(ninja is marginally faster with libobjc2, but it's a small project so the
difference is typically a fraction of a second)
If you don't have an existing GNUstep install, libobjc2 should now be installed
in /usr/lib on GNU/Linux systems. If you do have one, then it will be
installed by default in wherever gnustep-config recommends. If you want to
change this, add a -DGNUSTEP_INSTALL_TYPE={NONE,LOCAL,SYSTEM,NETWORK} to your
cmake command line.
For Debian / Ubuntu, I would probably recommend setting CPACK_GENERATOR to DEB
and setting CMAKE_INSTALL_PREFIX to a staging directory. Then, instead of make
install, run make package. This will give you a .deb of libobjc2, which should
make life a bit easier. For RPM-based Linux systems, s/DEB/RPM/ in the above
instructions.
> cd core/make
> ./configure --enable-debug-by-default --with-layout=gnustep
> make && sudo -E make install
> . /usr/GNUstep/System/Library/Makefiles/GNUstep.sh # Add to .bashrc
>
> sudo aptitude install gobjc # Otherwise we get "cc1obj not found
This will only happen if you are building things with gcc. You shouldn't be,
since you've just gone to the trouble of building clang. I suspect that it's
because you didn't set CXX=clang++.
> cd ../../libobjc2
> mkdir build
> cd build
> cmake ..
> make
> sudo -E make install
If you do this after GNUstep Make, then GNUstep Make won't be correctly
configured. You should do it first.
> cat > blocktest.m << EOF
> #include <stdio.h>
>
> int main() {
> void (^hello)(void) = ^(void) {
> printf("Hello, block!\n");
> };
> hello();
> return 0;
> }
> EOF
>
> clang `gnustep-config --objc-flags` `gnustep-config --objc-libs` -fobj-arc
> -fobjc-nonfragile-abi -fblocks -lobjc blocktest.m
-fobjc-nonfragile-abi is deprecated. You should use -fobjc-runtime=gnustep
instead. For testing experimental features in the current svn version of the
runtime, use -fobjc-runtime=gnustep-1.7 (this will be the default for gnustep
in clang 3.3. In clang 3.2, it defaults to 1.6).
-fblocks should be implied by the non-fragile ABI, please let me know if it
isn't.
David
-- Send from my Jacquard Loom