JJ's blog

[GENIVI] CommonAPI 설치 하기 본문

Technology/LINUX

[GENIVI] CommonAPI 설치 하기

Jayden_Ji 2019. 6. 14. 17:27

본 포스팅은 CommonAPI 설치부터 Code Generate까지의 설명이 포함되어있습니다. 

 

아래 GENIVI 튜토리얼을 참고하여 Step by Step으로 진행하였으며, 발생 에러 수정은 하단에 적어두었습니다.

참고 : https://at.projects.genivi.org/wiki/pages/viewpage.action?pageId=5472316&src=contextnavpagetreemode

 

Step 1: Preparation / Prerequisites

The following description is based on CommonAPI 3.1.3 and assumes that you use a standard Linux distribution (I tested it with Xubuntu 14.04) and that you have installed git and (CMake >=2.8).

$ sudo apt-get install build-essential

Step 2: Build the CommonAPI Runtime Library

$ cd ~
$ mkdir CommonAPI
$ cd CommonAPI
Clone CommonAPI Repositories
~/CommonAPI$ git clone https://github.com/GENIVI/capicxx-core-runtime.git
~/CommonAPIcd capicxx-core-runtime/
Build CommonAPI
~/CommonAPI/capicxx-core-runtimemkdir build
~/CommonAPI/capicxx-core-runtimecd build/
~/CommonAPI/capicxx-core-runtime/buildcmake ..
~/CommonAPI/capicxx-core-runtime/build$ make

Step 3: Build the CommonAPI D-Bus Runtime Library

Clone CommonAPI D-Bus
~/CommonAPI$ git clone https://github.com/GENIVI/capicxx-dbus-runtime

Get libdbus
~/CommonAPI$ wget http://dbus.freedesktop.org/releases/dbus/dbus-1.13.12.tar.gz

최신 버전 확인 : https://dbus.freedesktop.org/releases/dbus/

~/CommonAPI$ tar -xvf dbus-1.13.12.tar.xz
~/CommonAPI$ cd dbus-1.13.12/

Patch libdbus
~/CommonAPI/dbus-1.13.12$ patch -p1 < ../capicxx-dbus-runtime/src/dbus-patches/capi-dbus-add-send-with-reply-set-notify.patch
~/CommonAPI/dbus-1.13.12$ patch -p1 < ../capicxx-dbus-runtime/src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch
~/CommonAPI/dbus-1.13.12$ patch -p1 < ../capicxx-dbus-runtime/src/dbus-patches/capi-dbus-correct-dbus-connection-block-pending-call.patch   >> Reversed version으로 수행하지 않음. 

Build libdbus
~/CommonAPI/dbus-1.13.12$  ./configure >> 에러 발생 후 해결.
~/CommonAPI/dbus-1.13.12$ make
~/CommonAPI/dbus-1.13.12$ ls dbus/.libs/libdbus-1.so*
> 확인 > dbus/.libs/libdbus-1.so  dbus/.libs/libdbus-1.so.3  dbus/.libs/libdbus-1.so.3.26.1

Create Build Directory for CommonAPI D-Bus
~/CommonAPI/dbus-1.13.12$ cd ../capicxx-dbus-runtime/
~/CommonAPI/dbus-1.13.12$ mkdir build
~/CommonAPI/dbus-1.13.12$ cd build

Build CommonAPI D-Bus
~/CommonAPI/capicxx-dbus-runtime/build$ export PKG_CONFIG_PATH="/home/CommonAPI/dbus-1.13.12"
~/CommonAPI/capicxx-dbus-runtime/build$ cmake -D USE_INSTALLED_COMMONAPI=OFF -D USE_INSTALLED_DBUS=OFF ..
~/CommonAPI/capicxx-dbus-runtime/build$ make
> 에러 발생 :: /CommonAPI/capicxx-dbus-runtime/src/CommonAPI/DBus/ DBusConnection.cpp:881:32: error: ‘dbus_connection_send_with_reply_set_notify’ was not declared in this scope
> dbus 소스를 1.10.10으로 돌리고 runtime 재설치후  성공.

Step 4: Write the Franca file and generate code

Create Project Directories
~/$  mkdir project-fidl-gen-test
~/project-fidl-gen-test$  cd project-fidl-gen-test/
~/project-fidl-gen-test mkdir fidl
~/project-fidl-gen-test$  cd fidl
HelloWorld.fidl
~/project-fidl-gen-test/fidl$  vi HelloWorld.fidl
> 코드 작성 >

HelloWorld.fidl

package commonapi
  
interface HelloWorld {
  version {major 1 minor 0}
  method sayHello {
    in {
      String name
    }
    out {
      String message
    }
  }
} 


Get Code Generators
~/project-fidl-gen-test$  mkdir cgen
~/project-fidl-gen-test$  cd cgen
~/project-fidl-gen-test/cgen$  wget http://docs.projects.genivi.org/yamaica-update-site/CommonAPI/generator/3.1/3.1.3/commonapi-generator.zip
~/project-fidl-gen-test/cgen$  wget http://docs.projects.genivi.org/yamaica-update-site/CommonAPI/generator/3.1/3.1.3/commonapi_dbus_generator.zip
~/project-fidl-gen-test/cgen$  unzip commonapi-generator.zip -d commonapi-generator
~/project-fidl-gen-test/cgen unzip commonapi_dbus_generator.zip -d commonapi_dbus_generator
~/project-fidl-gen-test$  chmod +x cgen/commonapi-generator/commonapi-generator-linux-x86
~/project-fidl-gen-test$  chmod +x cgen/commonapi_dbus_generator/commonapi-dbus-generator-linux-x86
Generate Code
~/project-fidl-gen-test$ ./cgen/commonapi-generator/commonapi-generator-linux-x86 -sk ./fidl/HelloWorld.fidl
~/project-fidl-gen-test$ ./cgen/commonapi_dbus_generator/commonapi-dbus-generator-linux-x86 ./fidl/HelloWorld.fidl
~/project-fidl-gen-test$ l src-gen/v1_0/commonapi/   >> 아래 결과처럼 코드 생성된 것 확인 가능.
HelloWorld.hpp           HelloWorldProxy.hpp        HelloWorldStubDefault.hpp
HelloWorldProxyBase.hpp  HelloWorldStubDefault.cpp  HelloWorldStub.hpp


* Trouble Shooting

$ cmake ..
 > No CMAKE_CXX_COMPILER could be found

You can install the g++ compiler under Ubuntu by opening your terminal window and typing

$ sudo apt-get install build-essential

Or you can also install g++ directly with

$ sudo apt-get install g++


~/CommonAPI/dbus-1.13.12$  ./configure 
 >> checking for EXPAT... configure: error: in `/home/jj/CommonAPI/dbus-1.13.12':
$ sudo apt-get install expat > 해결 안됨.
$ sudo apt-get install libexpat1-dev > 해결 안됨.
> 에라 모르겠다 몽땅 설치로 해결..
$ sudo apt-get install gettext expat vim libtool autoconf libudev-dev libgstreamer-plugins-base1.0-dev \
libdbus-1-dev libgl1-mesa-dev libbluetooth-dev libjpeg-dev libpng++-dev


# Build Common API C++ Runtime
git clone https://github.com/GENIVI/capicxx-core-runtime.git
cd capicxx-core-runtime
git checkout 3.1.10
mkdir build
cd build
cmake ..
make

# Build Common API C++ DBus Runtime
git clone https://github.com/GENIVI/capicxx-dbus-runtime.git
wget -c http://dbus.freedesktop.org/releases/dbus/dbus-1.10.10.tar.gz
tar -xzf dbus-1.10.10.tar.gz
cd dbus-1.10.10
patch -p1 < ../capicxx-dbus-runtime/src/dbus-patches/capi-dbus-add-send-with-reply-set-notify.patch
patch -p1 < ../capicxx-dbus-runtime/src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch
patch -p1 < ../capicxx-dbus-runtime/src/dbus-patches/capi-dbus-correct-dbus-connection-block-pending-call.patch
./configure
make

# Common API DBus Runtime
cd capicxx-dbus-runtime
git checkout 3.1.10
mkdir build
cd build
export PKG_CONFIG_PATH="/data5/home/jsm8318/CommonAPI/dbus-1.13.12“
export PKG_CONFIG_PATH=“/home/jj/CommonAPI/dbus-1.13.12”
cmake -DUSE_INSTALLED_COMMONAPI=OFF -DUSE_INSTALLED_DBUS=OFF -DBUILD_SHARED_LIBS=OFF  ..
make


 

'Technology > LINUX' 카테고리의 다른 글

Git 설정  (0) 2019.06.18
리눅스 $JAVA_HOME 환경변수 설정  (0) 2019.06.18
Ubuntu One account  (0) 2019.06.12
ELF - Excutable and Linkable Format  (0) 2019.04.25
linux library 제작(static, shared, dynamic)  (0) 2019.04.25
Comments