0
votes

I'm installing gtkada-2018 (Adacore) on my Ubuntu 18.04.1 Desktop (clean installed), but it causes libxcb-xlib.so.0 warning while linking. Would anyone help me to fix this issue?

  1. I installed GNAT Community at first

    sudo ./gnat-community-2018-20180528-x86_64-linux-bin Set directry as /usr/gnat Here, Ada with GPS work fine.

  2. And next, gtkada-community-community-2018-x86_64-linux-bin

    Command is $sudo ./doinstall

-----long build messages----

Bind
[gprbind]    testgtk.bexch
[Ada]        testgtk.ali
[gprbind]    test_rtree.bexch
[Ada]        test_rtree.ali
Link
[link]       testgtk.adb
[link]       test_rtree.adb
/usr/gnat/bin/../libexec/gcc/x86_64-pc-linux-gnu/7.3.1/ld: **warning: libxcb-xlib.so.0, needed by /usr/gnat/lib/libgtk-3.so, not found (try using -rpath or -rpath-link)**
/usr/gnat/bin/../libexec/gcc/x86_64-pc-linux-gnu/7.3.1/ld: **warning: libxcb-xlib.so.0, needed by /usr/gnat/lib/libgtk-3.so, not found (try using -rpath or -rpath-link)**
-----follow long link messages ------
  1. And, the sample program testgtk is not linked and the exec file is not created.

  2. After the installation, when creating a very simple gtkada program with GPS Wizard, and build, then these same message is displayed:

Link [link] main.adb /usr/gnat/bin/../libexec/gcc/x86_64-pc-linux-gnu/7.3.1/ld: warning: libxcb-xlib.so.0, needed by /usr/gnat/lib/libgtk-3.so, not found (try using -rpath or -rpath-link) [2018-11-15 20:43:28] process terminated successfully, elapsed time: 01.00s

  1. 100% reproducible above symptom.
  2. gtkada-2017 did not happen the issue.
5

5 Answers

3
votes

I found the solution.
I write all the story to install gnat-2018 and gtkada-2018 (Adacore) in Ubuntu 18.04.1 from scratch.

Preparation

#1--#8 are just for my memory.

  1. Install Ubuntu 18.04.1 from scratch
  2. Install google-chrome
  3. sudo apt install chromium-browser
  4. sudo apt install synaptic
  5. gsettings set org.gnome.desktop.session idle-delay 1800
  6. sudo apt update
  7. sudo apt upgrade
  8. Reboot OS

  9. sudo apt install make

  10. sudo apt install gcc
  11. sudo apt install gprbuild
  12. sudo apt update
  13. sudo apt upgrade

Now, preparations were done.

GNAT Installation

  1. Download file from https://www.adacore.com/download/more Gnat-community-2018-20180528-x86_64-linux-bin
  2. Set the file executable +x or tick property-permission-Execute in Nautilus.
  3. Execute Gnat-community-2018-20180528-x86_64-linux-bin without sudo

    sudo causes a warning in the installation process, then do without sudo in terminal, or just double-click the file in Nautilus.

  4. Installation directory is required soon, enter e.g. /usr/gnat

  5. After a few minutes, installation Wizard finishes.
  6. Set PATH.
    e.g. export PATH=/usr/gnat/bin:$PATH e.g. in ~/.bashrc

Now, GPS works and you can use all of Ada functionalities except gtkada.

  1. Close Terminal

gtkada Preparation

If you want to install in the same directory, e.g. /usr/gnat, then skip next #21.

  1. gtkada in another directory

    If you want to install gtkada in another directory (e.g. /usr/gtkada), do in Terminal:
    sudo visudo

    Add the same PATH in the "Default" line as below (e.g. /usr/gnat/bin):
    Defaults secure_path="/usr/gnat/bin:/usr/local/sbin:...

    To save and quit in visudo are tricky, do as follows:
    ^o BS BS BS BS Enter Y Y ^x
    Enter to check again to make sure, sudo visudo, then exit with ^x
    after the checking.

From next, get the missing file libxcb-xlib-so.0.
The file is not available directly, then get the RPM file which includes it, and convert to the deb file format to install Ubuntu to get it out.

  1. Go to http://rpm.pbone.net/index.php3/stat/3/limit/9/srodzaj/1/dl/40/search/libxcb.so.1/field[]/1/field[]/2
  2. Find PCLinuxOS and go to the link www.pclinuxos.com/pclinuxos/apt/pclinuxos/64bit/RPMS.x86_64/libxcb-1.12-4pclos2017.x86_64.rpm
  3. Download ftp.ntua.gr libxcb-1.12-4pclos2017.x86_64.rpm
  4. Set the file executable:
    libxcb-1.12-4pclos2017.x86_64.rpm (159.9kB).
  5. Install alien which can convert the RPM file to the DEB file.

    sudo apt install alien

  6. Convert from RPM to DEB

    sudo alien libxcb-1.12-4pclos2017.x86_64.rpm

    libxcb_1.12-5_amd64.deb was generated.
    Now, 2 files are here: mori@envy:~/Downloads$ ls -al lib*
    -rwxrwxr-x 1 mori mori 159903 Dec 27 18:12 libxcb-1.12-4pclos2017.x86_64.rpm
    -rw-r--r-- 1 root root 152024 Jan 1 12:43 libxcb_1.12-5_amd64.deb

  7. Install DEB package: sudo dpkg -i libxcb_1.12-5_amd64.deb
  8. The target file is created in /usr/lib64 directory (not in /usr/lib)
    mori@VB:/usr/lib64$ ls -al libxcb-xlib*
    lrwxrwxrwx 1 root root 31 Dec 25 16:22 libxcb-xlib.so.0 -> ../../usr/lib64/libxcb.so.1.1.0
    lrwxrwxrwx 1 root root 31 Dec 25 16:22 libxcb-xlib.so.0.0.0 -> ../../usr/lib64/libxcb.so.1.1.0
    The real file is libxcb.so.1.1.0, and libxcb-xlib.so.0 is just the sym-link.
    Now, save only libxcb.so.1.1.0 to another safety place, I used a USB drive.
  9. Uninstall the deb package:

    sudo dpkg -r libxcb

Now, you got the missing file, and set the file into the gtkada installer next.

  1. Download gtkada-2018 (choose the platform and year) gtkada-community-2018-20180523-x86_64-linux-bin.tar.gz  136.9 MiB May 24 2018
  2. Set it executable
  3. Extract file
  4. Copy the fie libxcb.so.1.1.0 into gtk-bin/lib64 directory:
    Downloads/gtkada-community-community-2018-x86_64-linux-bin/gtk-bin/lib64
  5. Set libxcb.so.1.1.0 executable
  6. Set sym-link
    gtk-bin/lib64$ sudo ln -s ./libxcb.so.1.1.0 ./libxcb-xlib.so.0
  7. Check if the sym-link is created
    /Downloads/gtkada-community-community-2018-x86_64-linux-bin/gtk-bin/lib64$ ls -al libxcb*
    -rwxr-xr-x 1 mori mori 154424 Aug 16 2017 libxcb.so.1.1.0
    lrwxrwxrwx 1 root root 17 Dec 25 22:18 libxcb-xlib.so.0 -> ./libxcb.so.1.1.0
  8. Copy once more libxcb.so.1.1.0 into gtk-bin/lib directory:
    Downloads/gtkada-community-community-2018-x86_64-linux-bin/gtk-bin/lib
  9. Set libxcb.so.1.1.0 executable
  10. Set sym-link
    gtk-bin/lib$ sudo ln -s ./libxcb.so.1.1.0 ./libxcb-xlib.so.0
  11. Check if the sym-link is created
    /Downloads/gtkada-community-community-2018-x86_64-linux-bin/gtk-bin/lib$ ls -al libxcb*
    -rwxr-xr-x 1 mori mori 154424 Aug 16 2017 libxcb.so.1.1.0
    lrwxrwxrwx 1 root root 17 Dec 25 22:18 libxcb-xlib.so.0 -> ./libxcb.so.1.1.0

Now you got prepared all the settings.

gtkada Installation

  1. Downloads/gtkada-community-community-2018-x86_64-linux-bin$ sudo ./doinstall
    Set installation directory /usr/gnat (same) or /usr/gtkada or else.
    After a few minutes, installation finishes.

Set gtkada Environments

Do not follow the installer's comments, they are for some other OS's.
Now, the bottom of ~/.bashrc is:

export PATH=/usr/gnat/bin:$PATH
  1. Add one more line like this
    . ./gtkada-env.sh (Note: dot-space-dot)

  2. Create a text file ~/gtkada-env.sh with the following text:

    prefix="/usr/gnat"
    LD_LIBRARY_PATH_64=$prefix/lib:$LD_LIBRARY_PATH_64
    PKG_CONFIG_PATH=$prefix/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
    GDK_PIXBUF_MODULE_FILE=$prefix/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
    GDK_PIXBUF_MODULEDIR=$prefix/lib/gdk-pixbuf-2.0/2.10.0/loaders/
    FONTCONFIG_FILE=/etc/fonts/fonts.conf
    XDG_DATA_DIRS=$prefix/share:$XDG_DATA_DIRS
    XDG_CONFIG_DIRS=$prefix/etc:$XDG_CONFIG_DIRS
    GSETTINGS_BACKEND=memory
    GLADE_BASE_DIR=$prefix
    GPR_PROJECT_PATH=$prefix/lib/gnat:$GPR_PROJECT_PATH
    export LD_LIBRARY_PATH_64
    export PKG_CONFIG_PATH
    export GDK_PIXBUF_MODULE_FILE
    export GDK_PIXBUF_MODULEDIR
    export FONTCONFIG_FILE
    export XDG_DATA_DIRS
    export XDG_CONFIG_DIRS
    export GSETTINGS_BACKEND
    export GLADE_BASE_DIR
    export GPR_PROJECT_PATH

NOTE1: The first line should be changed if you installed into another directory,
e.g. /usr/gtkada then change prefix="/usr/gtkada"
NOTE2: 1/05/2019 FONTCONFIG_FILE was changed.

  1. Close Terminal

Test Build Functionalities

  1. The easiest way is to use GPS Wizard

    • Create a test directory and run gps
    • ~/ada/simplegtkada$ gps
    • "create new project", "GtkAda", "Simple Window" can make a simple Hello world.
    • Build and Run can check the functionality.
    • Check if the Terminal application execution doesn't output any errors:
    • ~/ada/simplegtkada/obj$ ./main
  2. Full build test using testgtk

    • Copy all the install files with -a option to another directory.
    • ~/Downloads$ cp -a gtkada-community-community-2018-x86_64-linux-bin gtkada-test
    • Delete all files in ~/Downloads/gtkada-test/testgtk/obj
    • Delete 2 files testgtk and test_rtree in ~/Downloads/gtkada-test/testgtk
    • ~/Downloads/gtkada-test/testgtk$ gprbuild
    • All testgtk files should be compiled and linked again.
    • Try ./testgtk and check the functionalities.
    • ~/Downloads/gtkada-test/testgtk$ ./testgtk

Known Issue

  1. gedit issue
    gedit from Terminal can't startup, though Nautilus can start it up. The environment settings should affect it, but I couldn't fix it. Let me know if anyone know the solution.

  2. Compiler reference warnings
    These warnings are displayed at both static and static-pic compilings, but I think we can ignore them (they did not happen at 2017):
    gtkada-canvas_view.ads:590:07: warning: formal parameter "At_Point" is not referenced
    gtkada-canvas_view.ads:591:07: warning: formal parameter "Context" is not referenced
    gtkada-canvas_view.ads:792:07: warning: formal parameter "Item" is not referenced
    gtkada-canvas_view.ads:1984:07: warning: formal parameter "At_Point" is not referenced
    gtkada-canvas_view.ads:1985:07: warning: formal parameter "Context" is not referenced
    gtkada-canvas_view.ads:1992:07: warning: formal parameter "View" is not referenced

A Benefit of gtkada 2018 Version

It doesn't display the error messages anymore which were usually in 2016 and 2017 versions such as:
Gtk-Message: Failed to load module "unity-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"
when starting up GPS and gtkada applications. It makes me feel better.

0
votes

Thanks, I tried it, but the installation quit early as follows:

  1. GNAT installation in /usr/gnat/
  2. This command: sudo apt install libxcb-composite0
  3. Gtkada installaion in /usr/gtkada/ The messages are:

    Directory /usr/gtkada does not exist. Do you want to create it [Y/n] ? y Are you now ready to proceed with the installation [Y/n] ? y

    Copying the Gtk+ binaries Setting up the environment Compiling GtkAda checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking target system type... x86_64-unknown-linux-gnu checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes

    checking for gcc option to accept ISO C89... none needed

    checking for gprbuild... /usr/bin/gprbuild

    checking for gprinstall... /usr/bin/gprinstall

    checking that your gnat compiler works with a simple example... Error: no native compiler found for language 'ada', default runtime conftest.gpr:1:09: no languages defined for this project gprbuild: "conftest.gpr" processing failed

    no

    configure: error: /usr/bin/gprbuild test failed at compile time! Check your configuration.

    An error occurred. Please see install.log.

  4. I tried GPS and tested Ada with a very simple program, it built and worked as normally.

0
votes

I deleted /usr/gtkada directory, but libxcb-composite0 remains now. Re-installed gtkada in the same directory /usr/gnat.

The installation went to the final, but when the sample program testgtk was linking, error happened and the sample's exectable file was not created. The messages were:

 [index]        libgtkada_gl.a
 Bind
 [gprbind]      testgtk.bexch
 [Ada]          testgtk.ali
 [gprbind]      test_rtree.bexch
 [Ada]          test_rtree.ali
Link
 [link]         testgtk.adb
 [link]         test_rtree.adb
/usr/gnat/bin/../libexec/gcc/x86_64-pc-linux-gnu/7.3.1/ld: 
warning: libxcb-xlib.so.0, needed by /usr/gnat/lib/libgtk-3.so, 
not found (try using -rpath or -rpath-link)
/usr/gnat/bin/../libexec/gcc/x86_64-pc-linux-gnu/7.3.1/ld: 
warning: libxcb-xlib.so.0, needed by /usr/gnat/lib/libgtk-3.so, 
not found (try using -rpath or -rpath-link)
/usr/gnat/bin/gprinstall  -p -f --project-subdir=lib/gnat 
--build-var=GTKADA_BUILD,LIBRARY_TYPE --install-name=gtkada --prefix=/usr/gnat
-XGTK_PREFIX=/usr/gnat -XLIBRARY_TYPE=static --build-name=static \
--sources-subdir=include/gtkada/gtkada.static \
--lib-subdir=lib/gtkada/gtkada.static \ -Psrc/gtkada.gpr
Install project GtkAda - static
/usr/gnat/bin/gprinstall  -p -f --project-subdir=lib/gnat
--build-      var=GTKADA_BUILD,LIBRARY_TYPE --install-name=gtkada
--prefix=/usr/gnat
-XGTK_PREFIX=/usr/gnat -XLIBRARY_TYPE=static-pic --build-name=static-pic \
--sources-subdir=include/gtkada/gtkada.static-pic \
--lib-subdir=lib/gtkada/gtkada.static-pic \
-Psrc/gtkada.gpr
 Install project GtkAda - static-pic
 /usr/gnat/bin/gprinstall  -p -f --project-subdir=lib/gnat 
--build-var=GTKADA_BUILD,LIBRARY_TYPE --install-name=gtkada --prefix=/usr/gnat
XGTK_PREFIX=/usr/gnat -XLIBRARY_TYPE=relocatable --build-name=relocatable \
--sources-subdir=include/gtkada/gtkada.relocatable \
--lib-subdir=lib/gtkada/gtkada.relocatable \
-Psrc/gtkada.gpr
Install project GtkAda - relocatable
/usr/gnat/bin/gprinstall  -p -f --project-subdir=lib/gnat --build-
var=GTKADA_BUILD,LIBRARY_TYPE --install-name=gtkada --prefix=/usr/gnat
-XGTK_PREFIX=/usr/gnat -XLIBRARY_TYPE=static \
--mode=usage -Psrc/tools/tools.gpr
Install project Tools
cd testgtk; /usr/gnat/bin/gprinstall  -p -f --project-subdir=lib/gnat --build-  
var=GTKADA_BUILD,LIBRARY_TYPE --install-name=gtkada --prefix=/usr/gnat 
-XGTK_PREFIX=/usr/gnat -XLIBRARY_TYPE=static \
--mode=usage --exec-subdir=/usr/gnat/share/examples/gtkada/testgtk \
-Ptestgtk.gpr -aP ../src

Install project TestGtk

GtkAda has now been installed.                                   --

-- To use the library, you may need to update LD_LIBRARY_PATH -- -- or to run ldconfig. You may also need to update GPR_PROJECT_PATH -- -- to include --

-- /usr/gnat/lib/gnat

GtkAda has now been installed on your machine. You can enter the GtkAda environment by doing: "/usr/gnat/bin/gtkada-env.sh"

0
votes

It seems that you miss a package. Try to install:

sudo apt install libxcb-composite0

I'm editing my answer per your new post:

It is probably just a matter of configuration, where GtkAda does not find the Ada compiler. I found this post where it is suggested to run gprbuild with -v , then gprconfig with -v to check the configuration.

One more thing: I understand that you installed GNAT from a downloaded file. Why not trying to install it from Ubuntu repository instead?

0
votes

I confirmed that the latest Adacore GNAT-2019 and GTKADA-2019 on Ubuntu 18.04.02 fixed most of the installation issues.

GNAT-2019 is just easy double clicking it as same as 2018.

Add /usr/gnat/bin: to the top of the PATH

sudo visudo may need here if GTKADA is installed in different directory, but it does not matter if both in same directory (e.g. /usr/gnat).

GTKADA-2019 is just sudo ./doinstall

There are some warnings in the log, but they seem minor.

Above #43 and #44 should be done. The default environment settings are not for Ubuntu (use above gtkada-env.sh).