Skip to content

For MacOsX Eclipse g

jano42 edited this page Jan 18, 2016 · 1 revision

Build with G++

Prerequisites

Check you have a compatible GCC version

    gcc --version

To compile yadoms a minimum version 4.5 is needed.

The use of CLANG is not recommanded. Because its attached debugger is not gdb but lldb which is not compatible with Eclipse

Upgrade GCC

Install MacPorts

After install, check your system is up to date

    sudo port upgrade outdated

If you want to install a newer gcc List avaible version for your system:

    port list gcc*
    
    gcc42                          @4.2.4          lang/gcc42
    gcc43                          @4.3.6          lang/gcc43
    gcc44                          @4.4.7          lang/gcc44
    gcc45                          @4.5.4          lang/gcc45
    gcc46                          @4.6.4          lang/gcc46
    gcc47                          @4.7.3          lang/gcc47
    gcc48                          @4.8.2          lang/gcc48

Choose a version >= 4.5 (tested succesfully with 4.7 and 4.8)

    sudo port install gcc48

When a newer version is installed, you must configure system to use it with gcc_select tool

    sudo port install gcc_select

List avaible gcc installed on the system

    port select --list gcc
    
    Available versions for gcc:
            gcc40
            gcc42 (active)
            llvm-gcc42
            mp-gcc48
            none

In the list I want to use mp-gcc48 (don't really know what is "mp-")

sudo port select gcc mp-gcc48
hash gcc

Check the GCC version

    gcc --version
    
    gcc (MacPorts gcc48 4.8.2_0) 4.8.2
    Copyright (C) 2013 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Boost

Download boost_1_55_0.tar.bz2 Extract it

    tar xvjf boost_1_55_0.tar.bz2

Create bootstrap

    cd boost_1_55_0
    ./bootstrap

Build boost

    ./b2 --with-atomic --with-chrono --with-date_time --with-filesystem --with-regex --with-thread --with-system link=shared

CMake

Install CMake

	sudo apt-get install cmake

Optional CMake-gui if you want to debug cmake

	sudo apt-get install cmake-qt-gui

Yadoms

Configure repo

Create the sources/CMakeListsUserConfig.txt (from the .sample.txt) ans edit the boost root configuration (don't forget to remove #) set(BOOST_ROOT "/path/to/boost/boost_1_55_0")

Generate makefile

	cd yadoms/
	chmod +x cmake_linux.sh
	./cmake_linux.sh

Build Yadoms

	cd yadoms
	cd projects
	make

Run Yadoms

	cd yadoms
	cd build
	./yadoms

Debug with Eclipse on MacOSX Maverick

To enable debugging with Eclipse, you need to use gcc (not clang) and install gdb. After gdb is installed, you need to sign gdb, to make it runnable by Eclipse

After it successfully installed GDB you need to sign a certificate to make Eclipse able to use GDB otherwise it will show up the error:

Unable to find Mach task port for process-id 28885: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8))

This means Eclipse can find the GDB now but cannot run it because of the Apple certificates issue.

To sign the GDB application and make it possible that Eclipse runs it follow the guide here:

https://sourceware.org/gdb/wiki/BuildingOnDarwin

which can be summarized in:

Start Keychain Access application (/Applications/Utilities/Keychain Access.app) Open menu /Keychain Access/Certificate Assistant/Create a Certificate (TOP MENU BAR)

Choose a name (gdb-cert in the example) 3.1 Set "Identity Type" to "Self Signed Root" 3.2 Set "Certificate Type" to "Code Signing" 3.3 Check the flag "Let me override defaults" 3.4 Click several times on "Continue" until you get to the "Specify a Location For The Certificate screen" then set Keychain to "System" 3.5 If you can't store the certificate in the "System" keychain, create it in the "login" keychain, then export it. You can then import it into the "System" keychain. 3.6 Make sure you have the "gdb-cert" in your "System" (left top window)

Select "Get Info" by pressing twice on the fresh made certificate (gdb-cert),

Open the "Trus"t item, and set "Code Signing to Always Trust" Close Keychain Access application Restart "taskgated" application from activity monitor Now you need to sign the Certificated by doing from terminal

$ codesign -s gdb-cert ../path of GDB Example:

$ codesign -s gdb-cert /usr/local/bin/gdb You are all set now.... ready to debug you C/C++ application on Eclipse on MacOSX Mavericks

Make sure you have all set properly once again double check on Eclipse Menu Run->Debug Configuration->Debugger the line : GDB Debugger -> /usr/local/bin/gdb (or your local path, check it with "$ which gdb" to get the correct path) GDB Command file-> .gdbinit

Clone this wiki locally