우분투 18.04 에 CommonAPI 를 설치하려고 한다.


Franca IDL 툴을 이용하여 생성한 인터페이스 소스를, CommonAPI 를 통해 연결할수 있다. 


CommonAPI 는 dbus 라이브러리와 연관되어 있으며  , 기능을 적용하기 위해서 dbus 라이브러리에 관련 패치들이 추가되어야 한다.



먼저 사용하는 Ubuntu  버전의 dbus 버전 정보를 확인한다.


dpkg -l |grep dbus


 ii  at-spi2-core                               2.28.0-1                            amd64        Assistive Technology Service Provider Interface (dbus core)

ii  dbus                                       1.12.2-1ubuntu1                     amd64        simple interprocess messaging system (daemon and utilities)

ii  dbus-user-session                          1.12.2-1ubuntu1                     amd64        simple interprocess messaging system (systemd --user integration)

ii  dbus-x11                                   1.12.2-1ubuntu1                     amd64        simple interprocess messaging system (X11 deps)

ii  gir1.2-dbusmenu-glib-0.4:amd64             16.04.1+18.04.20171206-0ubuntu1     amd64        typelib file for libdbusmenu-glib4

ii  libdbus-1-3:amd64                          1.12.2-1ubuntu1                     amd64        simple interprocess messaging system (library)

ii  libdbus-1-dev:amd64                        1.12.2-1ubuntu1                     amd64        simple interprocess messaging system (development headers)

ii  libdbus-glib-1-2:amd64                     0.110-2                             amd64        deprecated library for D-Bus IPC

ii  libdbusmenu-glib4:amd64                    16.04.1+18.04.20171206-0ubuntu1     amd64        library for passing menus over DBus

ii  libdbusmenu-gtk3-4:amd64                   16.04.1+18.04.20171206-0ubuntu1     amd64        library for passing menus over DBus - GTK+ version

ii  libdbusmenu-gtk4:amd64                     16.04.1+18.04.20171206-0ubuntu1     amd64        library for passing menus over DBus - GTK+ version

ii  libnet-dbus-perl                           1.1.0-4build2                       amd64        Perl extension for the DBus bindings

ii  libqt5dbus5:amd64                          5.9.5+dfsg-0ubuntu1                 amd64        Qt 5 D-Bus module

ii  python3-dbus                               1.2.6-1                             amd64        simple interprocess messaging system (Python 3 interface)



대충  1.12.2-1ubuntu1을 사용하는 것으로 추측된다.



구글 검색 : 1.12.2-1ubuntu1 dbus

다음 우분투 서버의 패키지 정보가 보여진다.

 https://launchpad.net/ubuntu/+source/dbus/1.12.2-1ubuntu1


dbus_1.12.2.orig.tar.gz2.0 MiB272bb5091770b047c8188b926d5e6038fa4fe6745488b2add96b23e2d9a83d88
dbus_1.12.2-1ubuntu1.debian.tar.xz61.0 KiB7c968a77cc7f8512229f190b51a619cf7b5901db0cf43fcae6c367eff1ede78c


위 두파일을 다운로드한다.


Common API 호출 방식 



CommonAPI C++ Overview



Common API 구조

CommonAPI C++ Overview



Download Source 


  • capicxx-core-runtime

$ git clone https://github.com/GENIVI/capicxx-core-runtime.git

$ cd capicxx-core-runtime/

$ git checkout 3.1.12.4


  • capicxx-dbus-runtime (dbus-patch 파일이 존재한다. src/dbus-patches)

$ git clone https://github.com/GENIVI/capicxx-dbus-runtime.git

$ cd capicxx-dbus-runtime

$ git checkout 3.1.12.4



설치순서 dbus Ubuntu Source Download -> capicxx-dbus-runtime 패치 적용 (dbus) -> dbus 라이브러리 설치이후 관련 라이브러리들을 설치한다.

 dbus 설치 -> dlt-daemon 설치-> capicxx-core-runtime -> capicxx-dbus-runtime 설치순으로 진행


특정 폴더에 dbus_1.12.2.orig.tar.gz , dbus_1.12.2-1ubuntu1.debian.tar.xz 압축을 해제한다.

1. ubuntu 용 패치를 적용한다.


$ cd  debian/patches/ubuntu

$ cp * ../../../dbus-1.12.2/

$ patch -p1 < aa-get-connection-apparmor-security-context.patch

patching file bus/apparmor.c

patching file bus/apparmor.h

patching file bus/driver.c

patching file dbus/dbus-protocol.h


$ patch -p1 < dont-stop-dbus.patch
patching file bus/dbus.service.in
$ rm aa-get-connection-apparmor-security-context.patch dont-stop-dbus.patch


2. capicxx-dbus-runtime 폴더에 존재하는 패치를 적용한다.


capi-dbus-1-pc.patch

capi-dbus-add-send-with-reply-set-notify.patch

capi-dbus-add-support-for-custom-marshalling.patch

capi-dbus-block-acquire-io-path-on-send.patch

capi-dbus-correct-dbus-connection-block-pending-call.patch

capi-dbus-send-with-reply-and-block-delete-reply-on-error.patch


$ cd  capicxx-dbus-runtime/src/dbus-patches

$ cp * /home/kj/GENIVI/CommonAPI/dbus/dbus-1.12.2

$ patch -p1 < capi-dbus-1-pc.patch
patching file dbus-1.pc.in
Hunk #1 succeeded at 19 (offset 1 line).

$ patch -p1 < 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
Hunk #1 succeeded at 230 (offset 1 line).

$ patch -p1 < capi-dbus-add-support-for-custom-marshalling.patch
patching file dbus/dbus-message.c
Hunk #1 succeeded at 3746 (offset 301 lines).
Hunk #2 succeeded at 5050 (offset 377 lines).
patching file dbus/dbus-message.h
Hunk #1 succeeded at 170 (offset 32 lines).
Hunk #2 succeeded at 302 with fuzz 1 (offset 37 lines).
patching file dbus/dbus-string.c
Hunk #1 succeeded at 744 (offset 14 lines).
patching file dbus/dbus-string.h

$ patch -p1 < capi-dbus-block-acquire-io-path-on-send.patch
patching file dbus/dbus-connection.c

$ patch -p1 < capi-dbus-correct-dbus-connection-block-pending-call.patch
patching file dbus/dbus-connection.c
Hunk #1 succeeded at 2526 (offset 1 line).

$ patch -p1 < capi-dbus-send-with-reply-and-block-delete-reply-on-error.patch
patching file dbus/dbus-connection.c
Hunk #1 succeeded at 3736 (offset 27 lines).
Hunk #2 succeeded at 6527 (offset 84 lines).


3. dbus Library Build


 sudo  mkdir -p /opt/GENIVI

 sudo chmod 777 /opt/GENIVI/

cd /home/kj/GENIVI/CommonAPI/dbus/dbus-1.12.2

$ ./configure --prefix=/opt/GENIVI/


No package 'expat' found

$ sudo apt-get install expat
$ sudo apt-get install libexpat1-dev
다시설치
$ ./configure --prefix=/opt/GENIVI/
$ make -C dbus -j8
$ make -C dbus install
$ make install-pkgconfigDATA
$ export PKG_CONFIG_PATH="/opt/GENIVI/lib/pkgconfig:$PKG_CONFIG_PATH"


configure 결과

  D-Bus 1.12.2

                  ==============


prefix:                   /opt/GENIVI

exec_prefix:              ${prefix}

        libdir:                   /opt/GENIVI/lib

        libexecdir:               /opt/GENIVI/libexec

        bindir:                   /opt/GENIVI/bin

        sysconfdir:               /opt/GENIVI/etc

        localstatedir:            /opt/GENIVI/var

        runstatedir:              /opt/GENIVI/var/run

datadir:                  /opt/GENIVI/share

source code location:   .

compiler:   gcc

cflags:           -fno-strict-aliasing -fno-common -Wall -Wextra -Wundef -Wnested-externs -Wwrite-strings -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wno-unused-parameter -Wno-missing-field-initializers -Wdeclaration-after-statement -Wformat=2 -Wold-style-definition -Wcast-align -Wformat-nonliteral -Wformat-security -Wsign-compare -Wstrict-aliasing -Wshadow -Winline -Wpacked -Wmissing-format-attribute -Wmissing-noreturn -Winit-self -Wmissing-include-dirs -Wunused-but-set-variable -Warray-bounds -Wimplicit-function-declaration -Wreturn-type -Wswitch-enum -Wswitch-default -Wchar-subscripts -Wfloat-equal -Wpointer-sign -Wno-deprecated-declarations -Wno-unused-label -Wno-error=unused-parameter -Wno-error=missing-field-initializers -Wno-error=deprecated-declarations -Wno-error=unused-label 

cppflags:   

cxxflags:   -fno-strict-aliasing -Wall -Wextra -Wundef -Wwrite-strings -Wpointer-arith -Wmissing-declarations -Wredundant-decls -Wno-unused-parameter -Wno-missing-field-initializers -Wformat=2 -Wcast-align -Wformat-nonliteral -Wformat-security -Wsign-compare -Wstrict-aliasing -Wshadow -Winline -Wpacked -Wmissing-format-attribute -Wmissing-noreturn -Winit-self -Wmissing-include-dirs -Wunused-but-set-variable -Warray-bounds -Wreturn-type -Wno-overloaded-virtual -Wswitch-enum -Wswitch-default -Wchar-subscripts -Wfloat-equal -Wno-deprecated-declarations -Wno-unused-label -Wno-error=unused-parameter -Wno-error=missing-field-initializers -Wno-error=overloaded-virtual -Wno-error=deprecated-declarations -Wno-error=unused-label 

ldflags:   -Wl,--no-as-needed 

64-bit int:   long

32-bit int:   int

16-bit int:   short

        Doxygen:                  no

        xmlto:                    no

        ducktype:                 no

        yelp-build:               no


        Rebuilding generated files: yes

        gcc coverage profiling:   no

        Building embedded tests:  no

        Building modular tests:   auto

            - with GLib:          yes

        Installing tests:         no

        Building verbose mode:    no

        Building assertions:      no

        Building checks:          yes

        Building bus stats API:   yes

        Building SELinux support: no

        Building AppArmor support: no

        Building inotify support: yes

        Building kqueue support:  no

        Building systemd support: no

        Building X11 code:        yes

        Building Doxygen docs:    no

        Building Ducktype docs:   no

        Building XML docs:        no

        Building launchd support: no

        System bus socket:        /opt/GENIVI/var/run/dbus/system_bus_socket

        System bus address:       unix:path=/opt/GENIVI/var/run/dbus/system_bus_socket

        System bus PID file:      /opt/GENIVI/var/run/dbus/pid

        Session bus listens on:   unix:tmpdir=/tmp

        Session clients connect to: autolaunch:

        pam_console auth dir:     (none)

        Console owner file:       no

        Console owner file path:  

System bus user:          messagebus

Session bus services dir: /opt/GENIVI/share/dbus-1/services

        'make check' socket dir:  /tmp


dlt-daemon 설치

 git clone https://github.com/GENIVI/dlt-daemon.git

 cd dlt-daemon

 git log

commit da6eefe5cac244421c5af413c54e420717e11c9e (HEAD -> master, origin/master, origin/HEAD)

Author: ManikandanChockalingam <manikandan.chockalingam@in.bosch.com>

Date:   Fri May 18 11:17:31 2018 +0530


    IPC: Unix socket added (#43)

    

    * IPC: Unix socket added

mkdir build
cd build/
cmake -DCMAKE_INSTALL_PREFIX=/opt/GENIVI ..
make -j8
make install


오류시 

/usr/bin/x86_64-linux-gnu-ld: cannot find -ldbus-1

$ sudo apt-get install libdbus-1-dev




capicxx-core-runtime 설치


$ cd common-api-runtime

$ mkdir build

$ cd build

$ cmake -D CMAKE_INSTALL_PREFIX=/opt/GENIVI ..

sudo cp -apr dlt/ /usr/include/  <-- dlt include 패스를 잡지못하여 root 경로에 임의로 복사하였음.

$ make

$ make install



capicxx-dbus-runtime 설치


cd  capicxx-dbus-runtime

mkdir build

cd build

sudo apt-get install cmake

$ cmake -D USE_INSTALLED_COMMONAPI=ON -D CMAKE_INSTALL_PREFIX=/opt/GENIVI ..

$ make -j8

$ make install


설치완료 /opt/GENIVI/lib/pkgconfig 해당폴더에 dlt 관련 라이브러리 설정정보가 있다.

automotive-dlt.pc  CommonAPI-DBus.pc  CommonAPI.pc  dbus-1.pc




참고사이트

CommonAPI C++ :  https://genivi.github.io/capicxx-core-tools/


'Yocto > GENIVI' 카테고리의 다른 글

[eclipse]Franca IDL 설치  (0) 2018.05.23
[Yocto] meta-ivi 분석  (0) 2018.05.23

+ Recent posts