HOW-TO Build a Tizen distribution for x64 arch

From Tizen Wiki
Jump to: navigation, search

This wiki is for Tizen v2.0 alpha 64bits

Status Tizen Api

Here the status of Tizen API for PC distribution For more details about API see : https://developer.tizen.org/documentation

Tizen API Status
API Type API Name Explanation Status component
Tizen Device API Alarm Alarm API provides functionality for setting and unsetting alarms. Taken
Application This API provides a way to launch other applications and access application management Taken capi-appfw-application
Bluetooth This specification defines a Bluetooth API for applications. With this API, applications can access device Bluetooth functionality. Taken capi-network-bluetooth
Calendar This API provides interfaces and methods for users to manage their schedule. Separate calendars can be implemented for group related events or tasks NOT Taken
Call TThis API provides interfaces and methods for retrieving information for Circuit Switched Telephony and Voice Over IP. NOT Taken capi-social-call-log capi-telephony-call capi-telephony-sim
Contact A contact is a set of information that describes a contact. The contact contains information, such as phone numbers, e-mail addresses, etc. NOT Taken
Filesystem This API provides access to a device's filesystem Taken
Geocoder This API provides an interface and methods for transforming an address to a coordinate, and vice-versa. Taken? capi-location-geocoder capi-location-poi capi-location-manager
LBS The API provides the basic definitions that are used in all location-based service APIs. Taken ?
MediaContent This API provides functionality to discover multimedia contents (such as images, videos, or music) that are available on the device Taken
Messaging The messaging API provides access SMS MMS etc... NOT Taken capi-messaging-email
NFC Near Field Communication (NFC) is an international standard (ISO/IEC 18092) that specifies an interface and protocol for simple wireless interconnection of closely coupled devices operating at 13.56 MHz NOT Taken capi-network-nfc
SystemInfo This API provides interfaces and methods for users to get hardware devices status. Partial Taken ( depending of hardware devices supported) capi-system-info
Time This API can be used to get TZDate objects with full timezone support, convert them between timezones, retrieve available timezones. Taken
Power This API provides support for requesting power management related resource states. Taken
Download This API provides support for requesting download management Taken capi-web-url-download
Notification This specification defines a Notification API for applications. Taken

Known Issues

This part explains all issue noticed during the build of the distribution

All issue are described by category.

Known Issues related to SPEC Files

Spec file management

The information on spec file syntax could be found here : http://fedoraproject.org/wiki/How_to_create_an_RPM_package

Before read this wiki, it's better to read this one

The defects concern mainly

  • the package information
  • %file and %file devel

General package information section

This parts talk about the issue due to the mistackes done in the header section


This issues that we had to deals with concerns for this part the missing dependencies


During a prep excution, if you have this kind of message below, this means that a or some depedancies of your package aren't found or a dependency isn't set properly

nothing provides pkgconfig(location-appman)


For this message , there are 3 possible root cause

  • If The location-appman package is provided by the repo, that means in spec file there no line into the %file or %file-devel section
Provides : pkgconfig(location-appman)

In fact, only the Provides : name_of_package is implicit.


  • if there no package location-appman package is provided by the repo, it migth be better to check if an other package with a different name provide here location-appm (without pkgconfig).

To check it, download the primary file for each repository that you use to build the distro

This file contains many information about package avaible in the repo. THe information by package looks like

<package type="rpm">
  <name>capi-base-common-devel</name>
  <arch>x86_64</arch>
  <version epoch="0" ver="0.1.0" rel="8"/>
  <checksum type="sha256" pkgid="YES">85f4d1128b087db157fa129f7528cdca315354e1f1ac66dd515865abb814cc0d</checksum>
  <summary>Common header files of Tizen Native API (Development)</summary>
  <description>Common header files of Tizen Native API</description>
  <packager>http://bugs.opensuse.org</packager>
  <url/>
  <time file="1350996941" build="1350996941"/>
  <size package="6054" installed="12285" archive="12980"/>
<location href="x86_64/capi-base-common-devel-0.1.0-8.x86_64.rpm"/>
  <format>
    <rpm:license>Apache-2.0</rpm:license>
    <rpm:vendor>openSUSE</rpm:vendor>
    <rpm:group>TO_BE/FILLED_IN</rpm:group>
    <rpm:buildhost>intel03</rpm:buildhost>
    <rpm:sourcerpm>capi-base-common-0.1.0-8.src.rpm</rpm:sourcerpm>
    <rpm:header-range start="280" end="2316"/>
    <rpm:provides>
      <rpm:entry name="capi-base-common-devel" flags="EQ" epoch="0" ver="0.1.0" rel="8"/>
      <rpm:entry name="capi-base-common-devel(x86-64)" flags="EQ" epoch="0" ver="0.1.0" rel="8"/>
    </rpm:provides>
    <rpm:requires>
      <rpm:entry name="capi-base-common" flags="EQ" epoch="0" ver="0.1.0" rel="8"/>
    </rpm:requires>
  </format>
</package>


As you can see, the information tagged by rpm:provides / rpm:requires permits to know which things is provided or required by a package.


So to check if one package provides your dependency search into this file.

%file / %file devel section

This parts talk about the issue due to the mistackes done in %file section

Missing files in %file/%file devel section

If the %file section process fails with this kind of output message

Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/abuild/eet/rpmbuild/BUILDROOT/eet-1.6.0+svn.74530slp2+build01-1.x86_64
RPM build errors:
error: Installed (but unpackaged) file(s) found:
/usr/lib64/libeet.la
File listed twice: eet-1.6.0+svn.74530slp2+build01.tar.gz
Installed (but unpackaged) file(s) found:
/usr/lib64/libeet.la
+ RPMBUILD_RETURN_CODE=1
+ '[' 1 -eq 0 ']'
+ rm -rf /home/abuild/eet/obslightbuild_TMP/TMP
+ rm -f /home/abuild/eet/rpmbuild
+ ln -s /home/abuild/eet/obslightbuild /home/abuild/eet/rpmbuild
+ exit 1


it means that a reference to a file is missing.

You have two choice for fixing it

  • add a line with the path of the file to indicate that the file need to be installed.
  • add a line with the path of the file prefixed of the keyword  %exclude to indicate that the file is unsued

For example, the %file section,of the package eet

%files
%defattr(-,root,root,-)
%{_libdir}/libeet.so.*


%files devel
%defattr(-,root,root,-)
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/eet.pc


to illustrate the different solutions For the first :

%files
%defattr(-,root,root,-)
%{_libdir}/libeet.so.*


%files devel
%defattr(-,root,root,-)
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/eet.pc
%{_libdir}/libeet.la

for the second :

%files
%defattr(-,root,root,-)
%{_libdir}/libeet.so.*


%files devel
%defattr(-,root,root,-)
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/eet.pc
%exclude %{_libdir}/libeet.la

Absolute path for the file in %file/%file devel section

If the %file section process fails with this kind of output message

Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/abuild/efreet/rpmbuild/BUILDROOT/efreet-1.6.0+svn.74618slp2+build02-1.x86_64
error: File not found by glob: /home/abuild/efreet/rpmbuild/BUILDROOT/efreet-1.6.0+svn.74618slp2+build02-1.x86_64/usr/lib/*.so.*
error: File not found by glob: /home/abuild/efreet/rpmbuild/BUILDROOT/efreet-1.6.0+svn.74618slp2+build02-1.x86_64/usr/lib/efreet/*
RPM build errors:
error: Installed (but unpackaged) file(s) found:
/usr/include/efreet-1/Efreet.h
..............
/usr/lib64/efreet/efreet_desktop_cache_create
/usr/lib64/efreet/efreet_icon_cache_create
/usr/lib64/libefreet.la
/usr/lib64/libefreet.so
/usr/lib64/libefreet.so.1
/usr/lib64/libefreet.so.1.6.99



In this example, we can see that the RPM check fails because the libraries installed into /usr/lib64/ aren't define in the spec file.


See below the %file section of the efreet spec file

%files
%defattr(-,root,root,-)
/usr/lib/*.so.*
/usr/bin/*
/usr/lib/efreet/*


%files devel
%defattr(-,root,root,-)
/usr/include/*
/usr/lib/*.so
/usr/share/*
/usr/lib/pkgconfig/efreet-mime.pc
/usr/lib/pkgconfig/efreet-trash.pc
/usr/lib/pkgconfig/efreet.pc


To be compatible with the x32 and x64, you must use the macros %{_libdir} for the lib path. In fact if you build a library for a x32 Architecture, it should installed in /usr/lib/ and if you do it for x64 architecture it should installed in /usr/lib64/ the macro %{_libdir} permits to obtain the library path according to the architecture There is the same possibility for /usr/bin /usr/include ... etc...


So we should replace

  • /usr/lib by %{_libdir}
  • /usr/bin by %{_bindir}
  • /usr/include by %{_includedir}
  • /usr/share by {%_datadir}
  • etc...


The main macros are defined in macros file (/usr/lib/rpm/macros) See below an extract of it that describe the macros about the path

#==============================================================================
# ---- configure macros.
#	Macro(s) slavishly copied from autoconf's config.status.
#
%_prefix		/usr
%_exec_prefix		%{_prefix}
%_bindir		%{_exec_prefix}/bin
%_sbindir		%{_exec_prefix}/sbin
%_libexecdir		%{_exec_prefix}/libexec
%_datadir		%{_prefix}/share
%_sysconfdir		/etc
%_sharedstatedir	%{_prefix}/com
%_localstatedir		%{_prefix}/var 
%_lib			lib
%_libdir		%{_exec_prefix}/%{_lib}
%_includedir		%{_prefix}/include
%_infodir		%{_datadir}/info
%_mandir		%{_datadir}/man

Warning If there are some other macros defined in other subdirectory in /etc/lib/rpm Some Env variable could be overrided in relation to platform for example

Here there is an example for libexecdir

platform/amd64-linux/macros:%_libexecdir		%{_exec_prefix}/lib
platform/athlon-linux/macros:%_libexecdir		%{_exec_prefix}/lib
platform/geode-linux/macros:%_libexecdir		%{_exec_prefix}/lib
platform/i386-linux/macros:%_libexecdir		%{_exec_prefix}/lib
platform/i486-linux/macros:%_libexecdir		%{_exec_prefix}/lib
platform/i586-linux/macros:%_libexecdir		%{_exec_prefix}/lib
platform/i686-linux/macros:%_libexecdir		%{_exec_prefix}/lib
platform/ia32e-linux/macros:%_libexecdir		%{_exec_prefix}/lib
platform/noarch-linux/macros:%_libexecdir		%{_exec_prefix}/lib
platform/pentium3-linux/macros:%_libexecdir		%{_exec_prefix}/lib
platform/pentium4-linux/macros:%_libexecdir		%{_exec_prefix}/lib
platform/x86_64-linux/macros:%_libexecdir		%{_exec_prefix}/lib

Known Issue related to CMake package

Before read this wiki, it's better to take a look to the cmake wiki : http://www.cmake.org/Wiki/CMake


remind : The libraries and pc file are installed

  • in /usr/lib and /usr/lib/pkgconfig for x32 arch
  • in /usr/lib64 and /usr/lib64/pkgconfig for x64 arch


The build for CMake type package is mainly based on CMakeList.txt.


The problem here is that the path for pc file and libraries are hardcoded.

Here it's an example of ail package:

# AIL build script

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(ail C) 

SET(LIBNAME "lib${PROJECT_NAME}")
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(BINDIR "${PREFIX}/bin")
SET(LIBDIR "${PREFIX}/lib")
SET(INCLUDEDIR "${PREFIX}/include")
SET(VERSION_MAJOR 0)
SET(VERSION "${VERSION_MAJOR}.1.0")

# Add definitions
ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"")
ADD_DEFINITIONS("-DPKGTYPE=\"${BUILD_PKGTYPE}\"") 

EXECUTE_PROCESS(COMMAND ../build_util/code_gen.sh)

SET(SRCS 
	src/ail_db.c
	src/ail_filter.c
	src/ail_sql.c
	src/ail_package.c
	src/ail_desktop.c
	src/ail_convert.c
) 

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)

INCLUDE(FindPkgConfig)

pkg_check_modules(LPKGS REQUIRED glib-2.0 sqlite3 dlog db-util xdgmime vconf)
STRING(REPLACE ";" " " EXTRA_CFLAGS "${LPKGS_CFLAGS}")
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden")

# Make libraries
ADD_LIBRARY(${LIBNAME} SHARED ${SRCS})
TARGET_LINK_LIBRARIES(${LIBNAME} ${LPKGS_LIBRARIES})
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS}")
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "")
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES VERSION ${VERSION})
SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES SOVERSION ${VERSION_MAJOR}) 

# PC file
CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY) 

# Install
INSTALL(TARGETS ${LIBNAME} DESTINATION lib)
INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/ail.h DESTINATION include)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/desktop.conf DESTINATION share/install-info) 


# AIL init database
ADD_SUBDIRECTORY(initdb)



To solve it properly (keeping the compatibily with x32) we need to update the spec file and patch CMakeList.txt file

The idea is to use the macros avaibles about libdir and include dir


--- a/CMakeLists.txt_ori	2012-10-24 16:43:51.831222865 +0200
+++ a/CMakeLists.txt	2012-10-24 16:47:24.013939854 +0200
@@ -6,8 +6,6 @@
 SET(LIBNAME "lib${PROJECT_NAME}")
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(BINDIR "${PREFIX}/bin")
-SET(LIBDIR "${PREFIX}/lib")
-SET(INCLUDEDIR "${PREFIX}/include")
 SET(VERSION_MAJOR 0)
 SET(VERSION "${VERSION_MAJOR}.1.0")
 
@@ -46,9 +44,9 @@
 CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY)
 
 # Install
-INSTALL(TARGETS ${LIBNAME} DESTINATION lib)
-INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION lib/pkgconfig)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/ail.h DESTINATION include)
+INSTALL(TARGETS ${LIBNAME} DESTINATION ${LIBDIR})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIBDIR}/pkgconfig)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/include/ail.h DESTINATION ${INCLUDEDIR})
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/desktop.conf DESTINATION share/install-info)
 
 # AIL init database


Here we remove the initialization of LIBDIR and INCLUDEDIR variable to permits to set them in the spec file by this way:

%build
CFLAGS+=" -fpic"
cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DBUILD_PKGTYPE=rpm -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir}


Warning : Sometimes the cmake command called into %prep section, if you made a patch with OBSLIGHT please check if it add '%patchX' command BEFORE cmake instruction


Known Issue related to Generique/Autotools package

remind : The libraries and pc file are installed

  • in /usr/lib and /usr/lib/pkgconfig for x32 arch
  • in /usr/lib64 and /usr/lib64/pkgconfig for x64 arch


The problem here is that the path for librairies is set by default to /usr/lib.


In fact when we make ./configure ---help we see that:


./configure --help
`configure' configures Location 0.1 to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking ...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..'] 

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX] 

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'. 

For better control, use the options below. 

Fine tuning of the installation directories:
  --bindir=DIR            user executables [EPREFIX/bin]
  --sbindir=DIR           system admin executables [EPREFIX/sbin]
  --libexecdir=DIR        program executables [EPREFIX/libexec]
  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
 --libdir=DIR            object code libraries [EPREFIX/lib]
  --includedir=DIR        C header files [PREFIX/include]
  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
  --infodir=DIR           info documentation [DATAROOTDIR/info]
  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
  --mandir=DIR            man documentation [DATAROOTDIR/man]
  --docdir=DIR            documentation root [DATAROOTDIR/doc/location]
  --htmldir=DIR           html documentation [DOCDIR]
  --dvidir=DIR            dvi documentation [DOCDIR]
  --pdfdir=DIR            pdf documentation [DOCDIR]
  --psdir=DIR             ps documentation [DOCDIR] 

Program names:
  --program-prefix=PREFIX            prepend PREFIX to installed program names
  --program-suffix=SUFFIX            append SUFFIX to installed program names
  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names 

System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD] 

Optional Features:
  --disable-option-checking  ignore unrecognized --enable/--with options
  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
  --enable-dependency-tracking
                          do not reject slow dependency extractors
  --disable-dependency-tracking
                          speeds up one-time build
  --enable-shared[=PKGS]  build shared libraries [default=yes]
  --enable-static[=PKGS]  build static libraries [default=yes]
  --enable-fast-install[=PKGS]
                          optimize for fast installation [default=yes]
  --disable-libtool-lock  avoid locking (might break parallel builds)
  --enable-debug          turn on debugging [default=no]
  --enable-dlog           show dlog message [default=no] 

Optional Packages:
  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
  --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
                          both]
  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
  --with-sysroot=DIR Search for dependent libraries within DIR
                        (or the compiler's sysroot if not specified). 

Some influential environment variables:
  CC          C compiler command
  CFLAGS      C compiler flags
  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
              nonstandard directory <lib dir>
  LIBS        libraries to pass to the linker, e.g. -l<library>
  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
              you have headers in a nonstandard directory <include dir>
  CPP         C preprocessor
  PKG_CONFIG  path to pkg-config utility
  PKG_CONFIG_PATH
              directories to add to pkg-config's search path
  PKG_CONFIG_LIBDIR
              path overriding pkg-config's built-in search path
  LOCATION_CFLAGS
              C compiler flags for LOCATION, overriding pkg-config
  LOCATION_LIBS
              linker flags for LOCATION, overriding pkg-config
  DLOG_CFLAGS C compiler flags for DLOG, overriding pkg-config
  DLOG_LIBS   linker flags for DLOG, overriding pkg-config 

Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations. 

Report bugs to <sena06.kim@samsung.com>.


As indicate in the spec file we need to add :

 ...
%build

./autogen.sh
./configure --prefix=%{_prefix} --enable-dlog --enable-debug --libdir=%{_libdir}

# Call make instruction with smp support
make %{?jobs:-j%jobs}

%install



Known Issue related to Autotools package

During the compilation of an autotools package: The compilation could fails and You could have this output:

undefined reference to symbol 'g_object_unref'
/usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: note: 'g_object_unref' is defined in DSO /usr/lib64/libgobject-2.0.so.0 so try adding it to the linker command line
/usr/lib64/libgobject-2.0.so.0: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status
make[3]: *** [gconf-helper] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: Leaving directory `/home/abuild/pulseaudio/obslightbuild/BUILD/pulseaudio-Tizen-0.9.21/src'


This means that ld command is malformed or an link option is missing, this is a case here.

In fact we need to add -lgobject-2.0 into the ld command.

If the package is an autotools package: You need t modification in configure.ac to get the LDFlags and CFlags for the librairy (here: libgobject-2.0) You need to add :

PKG_CHECK_MODULES(DXXXX, librariesXXX)
AC_SUBST(DXXXX_CFLAGS)
AC_SUBST(DXXXX_LIBS)


By this way : $DXXXX_LIBS contains the libraries argument for LD command $DXXXX_CFLAGS contains the libraries argument for gcc command

For our case add :

PKG_CHECK_MODULES(DGOBJECT, gobject-2.0)
AC_SUBST(DGOBJECT_CFLAGS)
AC_SUBST(DGOBJECT_LIBS)


We need to add this variable in the Makefile.am : For our case the error pointed the gconf-helper modules So you should add it

gconf_helper_LDADD = $(AM_LDADD) $(GCONF_LIBS) libpulsecommon-@PA_MAJORMINORMICRO@.la libpulse.la libpulsecore-@PA_MAJORMINORMICRO@.la $(DGOBJECT_LIBS)