IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changes between Initial Version and Version 1 of Ubuntu_1804_Install


Ignore:
Timestamp:
Oct 22, 2018, 8:50:41 AM (8 years ago)
Author:
eugene
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Ubuntu_1804_Install

    v1 v1  
     1
     2== Building IPP on Ubuntu 18.0 : 2018.10.22 ==
     3
     4When building on Ubuntu systems, it is necessary to install some packages at the system level (to provide the compiler, etc):
     5
     6 * need to make sure you have the 'build-essential' package, which supplies libc, standard headers, as well as gcc:
     7 {{{ apt-get install build-essential }}}
     8
     9 * It is also necessary to install the following libraries and build-related tools:
     10{{{
     11  apt-get install libx11-dev libncurses-dev pkg-config automake libtool libmysqlclient-dev subversion
     12}}}
     13
     14
     15If you encounter build problems related to some of the necessary libraries, it can be helpful to install the 'developer' versions of the libraries via apt-get as well.  This installs the C header files needed to build against those libraries.  In the past, I have had a problem in which installing the IPP version of libz broke my Ubuntu installation of evince (by providing a version of libz which did not have gzopen64 included).  If you encounter trouble, it might be safest to install the developer version of libz as well.  Here is a list of packages to consider:
     16
     17{{{
     18apt-get install libjpeg-dev
     19apt-get install libgsl-dev
     20apt-get install libpng-dev
     21apt-get install zlib1g-dev
     22}}}
     23
     24
     25When building on Ubuntu (since 12.04), it is necessary to supply the `-no-as-needed` option to psbuild.  Note: when building on Gentoo, it is now necessary to specify the IPP tagset since the Ubuntu build is currently picked up by psbuild as the default.  Here are the two commands to use:
     26
     27 * Ubuntu: psbuild -extbuild -clean -rebuild -dev -optimize -no-as-needed
     28 * Gentoo: psbuild -extbuild -clean -rebuild -dev -optimize ipp-3.1
     29
     30=== gcc and the --as-needed option ===
     31
     32The version of gcc supplied with Ubuntu since 12.04 (gcc version >= 4.5) includes a build-time option which forces gcc to pass the option `--as-needed` to the linker (ldd).  This was initially introduced in development versions of Ubuntu 11.04, then disabled as the change caused too much grief for the Ubuntu developers, then finally turned on for real in Ubuntu 11.10.  Some links related to this change are given below.  The purpose of this change was to allow the linker to skip symbols which were not needed (eg, a function defined in some library but not actually called by any of the code).  The change has three effects: 
     33
     34First, programs cannot rely on indirect linking.  That is to say reliance on libraries which link against other libraries.  It is now necessary to explicitly list all required libraries.  This issue was the primary driver of the change by Ubuntu and Debian, but it is not a problem with IPP code (we always explicitly link already). 
     35
     36Second, shared libraries now need to be listed in the correct order: if a program requires symbols from libA and that in turn requires symbols from libB, it is necessary to link in the order `gcc -o main main.c -lA -lB`.  This is because linking is done in a single pass.  If libA were listed second (after libB), then the needed symbols from B would not be loaded because the linker would not realize they were needed by another library.  This is the reason the Ubuntu 11.04 release did not include the change to gcc before it shipped: the developers had not resolved all such link order problems.
     37
     38The third problem is, I believe, a bug in the linker.  I do not have a definitive test case, but the following case was observed:  A program (`addstar_client`) does not use symbols from `libmysql` or `libpng`, but it uses symbols from `libm`.  Running the link without `-lmysql` or `-lpng` succeeds.  Running the link with `-lpng -lm` claims missing symbols from `libm` are needed, while linking `-lm -lpng` works.  This is backwards, as the linker should be able to find all needed symbols from `libm` since it is last on the list.  Similar behavior is seen with `-lmysql`.  Installing a local version of `libmysql` avoids this error, but a local version of `libpng` does not.
     39
     40The --as-needed option can be overruled by using the gcc option --no-as-needed.  This is best done by setting LDFLAGS to include `-Wl,--no-as-needed`.
     41
     42In the IPP build system, this issue is addressed by the following steps:
     43 * psconfig checks for the gcc version >4.6.3 from Ubuntu (`gcc --version` reports both a version >= 4.5 and Ubuntu).  In this case, it adds `-Wl,--no-as-needed` to LDFLAGS for the user.
     44 * psbuild now has the option `-no-as-needed`, which is tells psbuild to pass `--enable-no-as-needed` to the configure scripts.  This in turn sets the LDFLAGS in the build via autogen scripts.  This option should be used if --no-as-needed is required but the case is not caught by psconfig.
     45
     46Here are links describing the --as-needed option and issues:
     47 * https://lists.ubuntu.com/archives/ubuntu-devel-announce/2010-October/000772.html
     48 * https://lists.ubuntu.com/archives/ubuntu-devel/2010-November/031991.html
     49 * https://lists.ubuntu.com/archives/ubuntu-devel/2011-March/032632.html
     50 * http://wiki.debian.org/ToolChain/DSOLinking
     51
     52(see [wiki:Ubuntu_1204_Build_Issues] for other issues affecting the build)