Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Replace git.projects with GitHub and replace old names with new names

...

Code Block
languagebash
themeEmacs
titleClone CommonAPI Repositories
x@ubuntu:~/work$ git clone httphttps://git.projects.genivi.org/ipc/common-apigithub.com/GENIVI/capicxx-core-runtime.git
Cloning into 'common-api-runtime'...
remote: Counting objects: 984, done.
remote: Compressing objects: 100% (798/798), done.
remote: Total 984 (delta 550), reused 322 (delta 151)
Receiving objects: 100% (984/984), 520.00 KiB | 299.00 KiB/s, done.
Resolving deltas: 100% (550/550), done.
Checking connectivity... done. 
x@ubuntu:~/work$ ls
commoncapicxx-apicore-runtime

The CommonAPI runtime library can now be built without any other dependencies:

Code Block
languagebash
themeEmacs
titleBuild CommonAPI
x@ubuntu:~/work$ cd commoncapicxx-apicore-runtime/
x@ubuntu:~/work/commoncapicxx-apicore-runtime$ ls
AUTHORS  cmake  CMakeLists.txt  commonapi.spec.in  docx  doxygen.in  include  INSTALL  LICENSE  README  src
x@ubuntu:~/work/commoncapicxx-apicore-runtime$ mkdir build
x@ubuntu:~/work/commoncapicxx-apicore-runtime$ cd build/
x@ubuntu:~/work/commoncapicxx-apicore-runtime$ cmake ..
-- The C compiler identification is GNU 4.8.2
-- The CXX compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info 
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Project name: libcommonapi
-- This is CMake for Common API C++ Version 3.1.3.
-- CMAKE_INSTALL_PREFIX set to: /usr/local
-- BUILD_SHARED_LIBS is set to value: ON
-- MAX_LOG_LEVEL is set to value: DEBUG
-- RPM packet version set to r0
-- Build type: Debug
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26")
-- checking for module 'automotive-dlt >= 2.11'
--   package 'automotive-dlt >= 2.11' not found
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.6")
 -- asciidoc found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/x/work/commoncapicxx-apicore-runtime/build
x@ubuntu:~/work/commoncapicxx-apicore-runtime/build$ make
Scanning dependencies of target CommonAPI
[ 11%] Building CXX object CMakeFiles/CommonAPI.dir/src/CommonAPI/ProxyManager.cpp.o
[ 22%] Building CXX object CMakeFiles/CommonAPI.dir/src/CommonAPI/Logger.cpp.o
[ 33%] Building CXX object CMakeFiles/CommonAPI.dir/src/CommonAPI/MainLoopContext.cpp.o
[ 44%] Building CXX object CMakeFiles/CommonAPI.dir/src/CommonAPI/Runtime.cpp.o
[ 55%] Building CXX object CMakeFiles/CommonAPI.dir/src/CommonAPI/Utils.cpp.o
[ 66%] Building CXX object CMakeFiles/CommonAPI.dir/src/CommonAPI/Address.cpp.o
[ 77%] Building CXX object CMakeFiles/CommonAPI.dir/src/CommonAPI/Proxy.cpp.o
[ 88%] Building CXX object CMakeFiles/CommonAPI.dir/src/CommonAPI/ContainerUtils.cpp.o
[100%] Building CXX object CMakeFiles/CommonAPI.dir/src/CommonAPI/IniFileReader.cpp.o
Linking C shared library libCommonAPI.so
[100%] Built target CommonAPI
x@ubuntu:~/work/commoncapicxx-apicore-runtime/build$ ls
CMakeCache.txt  cmake_install.cmake    CommonAPIConfigVersion.cmake  CommonAPITargets.cmake  libCommonAPI.so    libCommonAPI.so.3.1.3
CMakeFiles      CommonAPIConfig.cmake  commonapi.spec                Doxyfile                libCommonAPI.so.3  Makefile

...

Code Block
languagebash
themeEmacs
titleClone CommonAPI D-Bus
x@ubuntu:~/work$ git clone httphttps://git.projects.genivi.org/ipc/common-api-github.com/GENIVI/capicxx-dbus-runtime.git
Cloning into 'common-api-dbus-runtime'...
remote: Counting objects: 4085, done.
remote: Compressing objects: 100% (1905/1905), done.
remote: Total 4085 (delta 2821), reused 3100 (delta 1914)
Receiving objects: 100% (4085/4085), 1.57 MiB | 741.00 KiB/s, done.
Resolving deltas: 100% (2821/2821), done.
Checking connectivity... done. 
x@ubuntu:~/work$ ls
commoncapicxx-api-dbus-runtime  commoncapicxx-apicore-runtime

The D-Bus runtime library cannot be built without further preparations. The reason is that CommonAPI-D-Bus doesn't use the standard libdbus library and needs a patched version. That means that you must first download, patch and build libdbus before the CommonAPI D-Bus runtime can be built. Let's start (3 of 10 minutes have already passed (smile)). Get and unpack the actual libdbus library:

Code Block
languagebash
themeEmacs
titleGet libdbus
x@ubuntu:~/work$ wget http://dbus.freedesktop.org/releases/dbus/dbus-1.8.20.tar.gz
x@ubuntu:~/work$ tar -xzf dbus-1.8.20.tar.gz
x@ubuntu:~/work$ ls
commoncapicxx-api-dbus-runtime  commoncapicxx-apicore-runtime  dbus-1.8.20  dbus-1.8.20.tar.gz
x@ubuntu:~/work$ cd dbus-1.8.20/

...

Code Block
languagebash
themeEmacs
titlePatch libdbus
x@ubuntu:~/work/dbus-1.8.20$ patch -p1 < ../commoncapicxx-api-dbus-runtime/src/dbus-patches/capi-dbus-add-send-with-reply-set-notify.patch
patching file dbus/dbus-connection.c
Hunk #1 succeeded at 3500 (offset 18 lines).
patching file dbus/dbus-connection.h 
x@ubuntu:~/work/dbus-1.8.20$ patch -p1 < ../commoncapicxx-api-dbus-runtime/src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch
patching file dbus/dbus-message.c
Hunk #1 succeeded at 3522 (offset 77 lines).
Hunk #2 succeeded at 4747 (offset 74 lines).
patching file dbus/dbus-message.h
patching file dbus/dbus-string.c
Hunk #1 succeeded at 727 (offset -3 lines).
patching file dbus/dbus-string.h 
x@ubuntu:~/work/dbus-1.8.20$ patch -p1 < ../commoncapicxx-api-dbus-runtime/src/dbus-patches/capi-dbus-correct-dbus-connection-block-pending-call.patch
patching file dbus/dbus-connection.c

...

Code Block
languagebash
themeEmacs
titleCreate Build Directory for CommonAPI D-Bus
x@ubuntu:~/work/dbus-1.8.20$ cd ../commoncapicxx-api-dbus-runtime/
x@ubuntu:~/work/commoncapicxx-api-dbus-runtime$ mkdir build
x@ubuntu:~/work/commoncapicxx-api-dbus-runtime$ cd build
x@ubuntu:~/work/commoncapicxx-api-dbus-runtime/build$

 For the next step add the path to your D-Bus directory to the actual PKG_CONFIG_PATH environment variable, start CMake and call make as usual:

Code Block
languagebash
themeEmacs
titleBuild CommonAPI D-Bus
x@ubuntu:~/work/commoncapicxx-api-dbus-runtime/build$ export PKG_CONFIG_PATH="/home/x/work/dbus-1.8.20"
x@ubuntu:~/work/commoncapicxx-api-dbus-runtime/build$ cmake -DUSE_INSTALLED_COMMONAPI=OFF -DUSE_INSTALLED_DBUS=OFF ..
x@ubuntu:~/work/commoncapicxx-api-dbus-runtime/build$ make

If everything was successful (it should be!) you should find libCommonAPI-DBus.so in your build directory. Make sure that there are no empty spaces in the path of your working directory.

...

Code Block
languagebash
titleCMakeLists.txt
linenumberstrue
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++0x")

include_directories(
    src-gen
    ../commoncapicxx-apicore-runtime/include
    ../commoncapicxx-api-dbus-runtime/include
    ../dbus-1.8.20
)
 
link_directories(
    /home/x/work/commoncapicxx-apicore-runtime/build
    /home/x/work/commoncapicxx-api-dbus-runtime/build
    /home/x/work/dbus-1.8.20/dbus/.libs
)

add_executable(HelloWorldClient
    src/HelloWorldClient.cpp
    src-gen/v1_0/commonapi/HelloWorldDBusProxy.cpp
    src-gen/v1_0/commonapi/HelloWorldDBusDeployment.cpp
)
target_link_libraries(HelloWorldClient CommonAPI CommonAPI-DBus dbus-1)

add_executable(HelloWorldService
    src/HelloWorldService.cpp
    src/HelloWorldStubImpl.cpp
    src-gen/v1_0/commonapi/HelloWorldDBusStubAdapter.cpp
    src-gen/v1_0/commonapi/HelloWorldStubDefault.cpp
    src-gen/v1_0/commonapi/HelloWorldDBusDeployment.cpp
)
target_link_libraries(HelloWorldService CommonAPI CommonAPI-DBus dbus-1)

...