.. title: Vivado 2018.3 and DocNav on Debian 10 (Buster)
.. slug: vivado-2018-3-buster
.. date: 2019-02-12 20:38:15 UTC+01:00
.. updated: 2020-05-21 22:35:46 UTC+01:00
.. tags: vivado, xilinx, debian
.. category: 
.. link: 
.. description: 
.. type: text

Late last year the ageing effects of my old GNU/Linux desktop system
became so severe that ignoring them would soon not be an option
anymore.  One of the hard disks developed problems a while ago and
although I was able to fix it so that finally the extended `SMART
<https://en.wikipedia.org/wiki/S.M.A.R.T.>`_ test passed again without
errors, it still continued to report errors in the form of "unreadable
(pending) sectors".  The on-board USB controller also complains about
one of the internal USB ports for a long time and one DDR3 ram module
had to be replaced as diagnosed by the wonderful `Memtest86
<https://en.wikipedia.org/wiki/Memtest86>`_.

On top of all this, the `Club 3D Radeon X1300PRO
<https://icecat.biz/en/p/club3d/cgax-hp136/graphics+cards-radeon+x1300pro+256mb-443229.html>`_
dual DVI graphics card started to occasionally hang the whole system a
few seconds after waking up from suspend.  Or at least that is what I
suspect as the system never recorded error messages in the log files.
The display however did visibly degrade and I think I saw some drm
error message flash by at some point.

Be that as it will, I was glad that I got the chance to replace the
system in time and gradually move stuff off a functioning system
instead of attaching disassembled hard disks to a new system. The `AMD
Ryzen 5 2400G system
<http://www.arlt.com/PC/fluesterleise-Silent-PCs/Whisper-Serie/ARLT-Mr-Whisper-AMD-Ryzen-5-8GB-SSD-Radeon-Vega-11-arlt-1.html>`_
from ARLT Computer, available without Windows, looked like very good
value for money. Together with an HDMI to DVI adapter it should also
easily power my two DVI monitor setup and so it did not take long
until one of them stood beside my desk for installation.  As the Ryzen
CPU was introduced early in 2018 and the Linux 4.9 kernel at the core
of Debian Stretch was released end of 2016, it was clear that I needed
to go for the yet unreleased Debian Buster based on Linux 4.19.
  
.. image:: /images/toy-story-buster.jpg
   :width: 200
   :align: center
   :alt: Buster from Toy Story

All in all things went smoothly until I turned to the Xilinx tool
chain that already gave me minor problems described in my previous
post :doc:`docnav-2017-04-debian-stretch`.

.. TEASER_END

In this new combination, already the installation of the `2018.3
edition of SDSoC
<https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/sdx-development-environments/2018-3.html>`_
got stuck nearly at the end of the installation:

.. image:: /images/sdsoc-2018.3-installation-hang.png
   :width: 600
   :alt: Installation Hang
   :align: center

Luckily enough, the installation writes a verbose log file and so it
was easy to find the reason what the installer tried last:

.. code-block:: console

  dzu@krikkit:~$ tail -3 ~/.Xilinx/xinstall/xinstall_1550052636842.log
  2019-02-13 11:25:19,348 DEBUG: o.p:? - Executing script Run setupLibTinfo: /opt/Xilinx/.xinstall/SDx_2018.
  3/scripts/setupLibTinfo.sh [/opt/Xilinx/Vivado/2018.3]
  2019-02-13 11:25:19,351 DEBUG: o.p:? - Executing script Run setupLibNCurses: /opt/Xilinx/.xinstall/SDx_201
  8.3/scripts/setupLibNCurses.sh [/opt/Xilinx/Vivado/2018.3]
  2019-02-13 11:25:19,440 DEBUG: o.p:? - Executing script Generating installed device list: /opt/Xilinx/Viva
  do/2018.3/bin/vivado [-nolog, -nojournal, -mode, batch, -source, /opt/Xilinx/.xinstall/SDx_2018.3/scripts/
  xlpartinfo.tcl, -tclargs, /opt/Xilinx/Vivado/2018.3/data/parts/installed_devices.txt]
  dzu@krikkit:~$
  
So let's see the ouput of this command when run interactively:

.. code-block:: console

  dzu@krikkit:~/.Xilinx$ /opt/Xilinx/Vivado/2018.3/bin/vivado -nolog -nojournal -mode batch -source /opt/Xilinx/.xinstall/SDx_2018.3/scripts/xlpartinfo.tcl -tclargs /opt/Xilinx/Vivado/2018.3/data/parts/installed_devices.txt-foo
  application-specific initialization failed: couldn't load file "librdi_commontasks.so": libtinfo.so.5: cannot open shared object file: No such file or directory
  %
  dzu@krikkit:~/.Xilinx$

Aha.  So at least the first problem should be easy to fix:

.. code-block:: console

  dzu@krikkit:~$ apt-file search libtinfo.so.5
  libtinfo5: /lib/x86_64-linux-gnu/libtinfo.so.5
  libtinfo5: /lib/x86_64-linux-gnu/libtinfo.so.5.9
  dzu@krikkit:~$ sudo apt install libtinfo5
  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  The following NEW packages will be installed:
    libtinfo5
  0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  Need to get 320 kB of archives.
  After this operation, 518 kB of additional disk space will be used.
  Get:1 http://deb.debian.org/debian buster/main amd64 libtinfo5 amd64 6.1+20181013-1 [320 kB]
  Fetched 320 kB in 0s (2190 kB/s)
  Selecting previously unselected package libtinfo5:amd64.
  (Reading database ... 193637 files and directories currently installed.)
  Preparing to unpack .../libtinfo5_6.1+20181013-1_amd64.deb ...
  Unpacking libtinfo5:amd64 (6.1+20181013-1) ...
  Setting up libtinfo5:amd64 (6.1+20181013-1) ...
  Processing triggers for libc-bin (2.28-6) ...
  dzu@krikkit:~$

As retrying the Vivado invocation now succeeded, I cancelled the
installation making sure not to delete all the downloaded files.
Running the installer once more gets me a working tool chain:

.. code-block:: console

  dzu@krikkit:~$ . /opt/Xilinx/SDx/2018.3/settings64.sh
  dzu@krikkit:~$ vivado
  
  ****** Vivado v2018.3 (64-bit)
    **** SW Build 2405991 on Thu Dec  6 23:36:41 MST 2018
    **** IP Build 2404404 on Fri Dec  7 01:43:56 MST 2018
      ** Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.
  
  start_gui

DocNav, however, again refuses to cooperate with the known symptoms:

.. code-block:: console

  dzu@krikkit:~$ docnav
  docnav: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory
  dzu@krikkit:~$ 

The workaround from my post :doc:`docnav-2017-04-debian-stretch` does
not apply in the new context.  As one comment points out, the Wheezy
version of libpng12-0 is not available anymore and even the Jessie
version referenced in the comment again yields the same problem (also
one needs to install the dummy package "multiarch-support"):

.. code-block:: console

  dzu@krikkit:~$ sudo dpkg -i ~/Downloads/libpng12-0_1.2.50-2+deb8u3_amd64.deb 
  (Reading database ... 193649 files and directories currently installed.)
  Preparing to unpack .../libpng12-0_1.2.50-2+deb8u3_amd64.deb ...
  Unpacking libpng12-0:amd64 (1.2.50-2+deb8u3) ...
  dpkg: error processing archive /home/dzu/Downloads/libpng12-0_1.2.50-2+deb8u3_amd64.deb (--install):
   unable to install new version of '/usr/lib/x86_64-linux-gnu/libpng12.so.0': No such file or directory
  Errors were encountered while processing:
   /home/dzu/Downloads/libpng12-0_1.2.50-2+deb8u3_amd64.deb
  dzu@krikkit:~$

So what next?  If all the binaries do not work, then maybe we have to
go back to the source and fix the problem ourselves.  Although the
error message is confusing it seems that the package tries to create a
link to the shared object file which ultimately leads to the error.
Let's see if we can circumvent this somehow.

Having installed the required packages for building Debian packages
(at least "debuild", "debhelper" and "devscripts") we can commence
building the package in question on our own system.  The first thing
is to find the source links for the Debian package `here
<https://packages.debian.org/jessie/libpng12-0>`_.  Downloading and
unpacking them is a simple task:

.. code-block:: console

  dzu@krikkit:~$ mkdir -p src/debian/libpng12-0
  dzu@krikkit:~$ cd src/debian/libpng12-0
  dzu@krikkit:~/src/debian/libpng12-0$ wget http://deb.debian.org/debian/pool/main/libp/libpng/libpng_1.2.50-2+deb8u3.dsc
  --2019-02-13 16:45:25--  http://deb.debian.org/debian/pool/main/libp/libpng/libpng_1.2.50-2+deb8u3.dsc
  Resolving deb.debian.org (deb.debian.org)... 130.89.148.14, 5.153.231.4, 149.20.4.15, ...
  Connecting to deb.debian.org (deb.debian.org)|130.89.148.14|:80... connected.
  HTTP request sent, awaiting response... 302 Found
  Location: http://cdn-fastly.deb.debian.org/debian/pool/main/libp/libpng/libpng_1.2.50-2+deb8u3.dsc [following]
  --2019-02-13 16:45:25--  http://cdn-fastly.deb.debian.org/debian/pool/main/libp/libpng/libpng_1.2.50-2+deb8u3.dsc
  Resolving cdn-fastly.deb.debian.org (cdn-fastly.deb.debian.org)... 151.101.112.204, 2a04:4e42:1b::204
  Connecting to cdn-fastly.deb.debian.org (cdn-fastly.deb.debian.org)|151.101.112.204|:80... connected.
  HTTP request sent, awaiting response... 200 OK
  Length: 2036 (2.0K)
  Saving to: 'libpng_1.2.50-2+deb8u3.dsc'
  
  libpng_1.2.50-2+deb8u3.dsc 100%[======================================>]   1.99K  --.-KB/s    in 0s      
  
  2019-02-13 16:45:25 (265 MB/s) - 'libpng_1.2.50-2+deb8u3.dsc' saved [2036/2036]
  
  dzu@krikkit:~/src/debian/libpng12-0$ wget http://deb.debian.org/debian/pool/main/libp/libpng/libpng_1.2.50.orig.tar.xz
  --2019-02-13 16:45:34--  http://deb.debian.org/debian/pool/main/libp/libpng/libpng_1.2.50.orig.tar.xz
  Resolving deb.debian.org (deb.debian.org)... 130.89.148.14, 5.153.231.4, 149.20.4.15, ...
  Connecting to deb.debian.org (deb.debian.org)|130.89.148.14|:80... connected.
  HTTP request sent, awaiting response... 302 Found
  Location: http://cdn-fastly.deb.debian.org/debian/pool/main/libp/libpng/libpng_1.2.50.orig.tar.xz [following]
  --2019-02-13 16:45:34--  http://cdn-fastly.deb.debian.org/debian/pool/main/libp/libpng/libpng_1.2.50.orig.tar.xz
  Resolving cdn-fastly.deb.debian.org (cdn-fastly.deb.debian.org)... 151.101.112.204, 2a04:4e42:1b::204
  Connecting to cdn-fastly.deb.debian.org (cdn-fastly.deb.debian.org)|151.101.112.204|:80... connected.
  HTTP request sent, awaiting response... 200 OK
  Length: 539152 (527K) [application/x-xz]
  Saving to: 'libpng_1.2.50.orig.tar.xz'
  
  libpng_1.2.50.orig.tar.xz  100%[======================================>] 526.52K  --.-KB/s    in 0.08s   
  
  2019-02-13 16:45:34 (6.40 MB/s) - 'libpng_1.2.50.orig.tar.xz' saved [539152/539152]
  
  dzu@krikkit:~/src/debian/libpng12-0$ wget http://deb.debian.org/debian/pool/main/libp/libpng/libpng_1.2.50-2+deb8u3.debian.tar.xz
  --2019-02-13 16:45:42--  http://deb.debian.org/debian/pool/main/libp/libpng/libpng_1.2.50-2+deb8u3.debian.tar.xz
  Resolving deb.debian.org (deb.debian.org)... 130.89.148.14, 5.153.231.4, 149.20.4.15, ...
  Connecting to deb.debian.org (deb.debian.org)|130.89.148.14|:80... connected.
  HTTP request sent, awaiting response... 302 Found
  Location: http://cdn-fastly.deb.debian.org/debian/pool/main/libp/libpng/libpng_1.2.50-2+deb8u3.debian.tar.xz [following]
  --2019-02-13 16:45:42--  http://cdn-fastly.deb.debian.org/debian/pool/main/libp/libpng/libpng_1.2.50-2+deb8u3.debian.tar.xz
  Resolving cdn-fastly.deb.debian.org (cdn-fastly.deb.debian.org)... 151.101.12.204, 2a04:4e42:1b::204
  Connecting to cdn-fastly.deb.debian.org (cdn-fastly.deb.debian.org)|151.101.12.204|:80... connected.
  HTTP request sent, awaiting response... 200 OK
  Length: 21788 (21K) [application/x-xz]
  Saving to: 'libpng_1.2.50-2+deb8u3.debian.tar.xz'
  
  libpng_1.2.50-2+deb8u3.deb 100%[======================================>]  21.28K  --.-KB/s    in 0.02s   
  
  2019-02-13 16:45:42 (1.35 MB/s) - 'libpng_1.2.50-2+deb8u3.debian.tar.xz' saved [21788/21788]
  
  dzu@krikkit:~/src/debian/libpng12-0$ dpkg-source -x libpng_1.2.50-2+deb8u3.dsc 
  dpkg-source: info: extracting libpng in libpng-1.2.50
  dpkg-source: info: unpacking libpng_1.2.50.orig.tar.xz
  dpkg-source: info: unpacking libpng_1.2.50-2+deb8u3.debian.tar.xz
  dpkg-source: info: using patch list from debian/patches/series
  dpkg-source: info: applying 01-legacy.patch
  dpkg-source: info: applying 02-required-space.patch
  dpkg-source: info: applying libpng-config.diff
  dpkg-source: info: applying CVE-2015-7981.patch
  dpkg-source: info: applying Prevent-writing-over-length-PLTE-chunk-Cosm.patch
  dpkg-source: info: applying Fixed-new-bug-with-CRC-error-after-reading-.patch
  dpkg-source: info: applying CVE-2015-8472/0001-Avoid-potential-pointer-overflow-in-png_han.patch
  dpkg-source: info: applying CVE-2015-8472/0002-Use-unsigned-constants-in-buffer-length-com.patch
  dpkg-source: info: applying CVE-2015-8472/0003-Fixed-bug-recently-introduced-in-png_set_PL.patch
  dpkg-source: info: applying CVE-2015-8540.patch
  dpkg-source: info: applying CVE-2016-10087.patch
  dzu@krikkit:~/src/debian/libpng12-0$
    
Now that we have the sources and the build instructions, checking the
debian sub-directory we quickly see candidates for the problem we want
to fix.  So let's remove the "debian/libpng12-0.links" and
"debian/libpng12-0.links.in" file and remove the handling in the
"debian/rules" file.  Here is a diff of these small changes:

.. code-block:: console

  dzu@krikkit:~/src/debian/libpng12-0$ diff -ur libpng-1.2.50.ORIG libpng-1.2.50
  Only in libpng-1.2.50.ORIG/debian: libpng12-0.links
  Only in libpng-1.2.50.ORIG/debian: libpng12-0.links.in
  diff -ur libpng-1.2.50.ORIG/debian/rules libpng-1.2.50/debian/rules
  --- libpng-1.2.50.ORIG/debian/rules	2016-01-07 20:39:14.000000000 +0100
  +++ libpng-1.2.50/debian/rules	2019-02-13 16:49:32.092738884 +0100
  @@ -46,7 +46,7 @@
   	dh_testdir
   	dh_testroot
   	dh_prep
  -	set -e; for file in libpng12-0.install libpng12-0.links libpng12-dev.links libpng3.links; \
  +	set -e; for file in libpng12-0.install libpng12-dev.links libpng3.links; \
   	do \
   		sed -e"s,\$${DEB_HOST_MULTIARCH},${DEB_HOST_MULTIARCH},g" \
   			debian/$${file}.in > debian/$$file; \
  dzu@krikkit:~/src/debian/libpng12-0$

Before building the package, we differentiate it from the upstream
release by adding a local build suffix "dzu":
  
.. code-block:: console

  dzu@krikkit:~/src/debian/libpng12-0$ cd libpng-1.2.50
  dzu@krikkit:~/src/debian/libpng12-0/libpng-1.2.50$ DEBEMAIL="Detlev Zundel <dzu@member.fsf.org>" dch -l dzu 'Quick hack'
  dzu@krikkit:~/src/debian/libpng12-0/libpng-1.2.50$ debuild -us -uc
  dpkg-buildpackage -us -uc -ui
  dpkg-buildpackage: info: source package libpng
  dpkg-buildpackage: info: source version 1.2.50-2+deb8u3dzu1
  dpkg-buildpackage: info: source distribution UNRELEASED
  dpkg-buildpackage: info: source changed by Detlev Zundel <dzu@member.fsf.org>
   dpkg-source --before-build .
  dpkg-buildpackage: info: host architecture amd64
   fakeroot debian/rules clean
  dh_testdir
    
  [.....]
  
   dpkg-source --after-build .
  dpkg-buildpackage: info: binary and diff upload (original source NOT included)
  Now running lintian libpng_1.2.50-2+deb8u3dzu1_amd64.changes ...
  W: libpng source: package-uses-deprecated-debhelper-compat-version 7
  W: libpng source: changelog-should-mention-nmu
  W: libpng source: source-nmu-has-incorrect-version-number 1.2.50-2+deb8u3dzu1
  W: libpng source: ancient-standards-version 3.9.5 (released 2013-10-28) (current is 4.3.0)
  W: libpng12-0-udeb udeb: priority-extra-is-replaced-by-priority-optional
  Finished running lintian.
  dzu@krikkit:~/src/debian/libpng12-0/libpng-1.2.50$ ls ../*deb
  ../libpng12-0-dbgsym_1.2.50-2+deb8u3dzu1_amd64.deb  ../libpng12-dev_1.2.50-2+deb8u3dzu1_amd64.deb
  ../libpng12-0-udeb_1.2.50-2+deb8u3dzu1_amd64.udeb   ../libpng3_1.2.50-2+deb8u3dzu1_amd64.deb
  ../libpng12-0_1.2.50-2+deb8u3dzu1_amd64.deb
  dzu@krikkit:~/src/debian/libpng12-0/libpng-1.2.50$
    
So if all went well, we should now be able to install the libpng12-0
Debian package and finally run DocNav:

.. code-block:: console

  dzu@krikkit:~/src/debian/libpng12-0/libpng-1.2.50$ sudo dpkg -i ../libpng12-0_1.2.50-2+deb8u3dzu1_amd64.deb 
  (Reading database ... 193645 files and directories currently installed.)
  Preparing to unpack .../libpng12-0_1.2.50-2+deb8u3dzu1_amd64.deb ...
  Unpacking libpng12-0:amd64 (1.2.50-2+deb8u3dzu1) ...
  Setting up libpng12-0:amd64 (1.2.50-2+deb8u3dzu1) ...
  Processing triggers for libc-bin (2.28-6) ...
  dzu@krikkit:~/src/debian/libpng12-0/libpng-1.2.50$ . /opt/Xilinx/SDx/2018.3/settings64.sh
  dzu@krikkit:~/src/debian/libpng12-0/libpng-1.2.50$ docnav
  QSslSocket: cannot resolve CRYPTO_num_locks
  QSslSocket: cannot resolve CRYPTO_set_id_callback
  QSslSocket: cannot resolve CRYPTO_set_locking_callback
  QSslSocket: cannot resolve sk_free
  QSslSocket: cannot resolve sk_num
  QSslSocket: cannot resolve sk_pop_free
  QSslSocket: cannot resolve sk_value
  QSslSocket: cannot resolve SSL_library_init
  QSslSocket: cannot resolve SSL_load_error_strings
  QSslSocket: cannot resolve SSLv2_client_method
  QSslSocket: cannot resolve SSLv3_client_method
  QSslSocket: cannot resolve SSLv23_client_method
  QSslSocket: cannot resolve SSLv2_server_method
  QSslSocket: cannot resolve SSLv3_server_method
  QSslSocket: cannot resolve SSLv23_server_method
  QSslSocket: cannot resolve X509_STORE_CTX_get_chain
  QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
  QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
  QSslSocket: cannot resolve SSLeay
  QSslSocket: cannot call unresolved function CRYPTO_num_locks
  QSslSocket: cannot call unresolved function CRYPTO_set_id_callback
  QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback
  QSslSocket: cannot call unresolved function SSL_library_init
  QSslSocket: cannot call unresolved function SSLv23_client_method
  QSslSocket: cannot call unresolved function sk_num
  
  [DocNav GUI pops up]

Phew, finally.  If you are not brave enough to go through all of this
yourself and if you trust my changes, you can download a `copy of the
Debian package </data/libpng12-0_1.2.50-2+deb8u3dzu1_amd64.deb>`_
directly from this web site.  You should expect to see this hash:

.. code-block:: console

  dzu@krikkit:~/src/debian/libpng12-0/libpng-1.2.50$ sha256sum ../libpng12-0_1.2.50-2+deb8u3dzu1_amd64.deb 
  8e7de461d318cde75fe4016739bdbf9092e20e224e40b95f8a5f502cec113546  ../libpng12-0_1.2.50-2+deb8u3dzu1_amd64.deb
  dzu@krikkit:~/src/debian/libpng12-0/libpng-1.2.50$


Update 2020-01-21
-----------------

Added sha256 output to enable verification of download.

Update 2020-05-21
-----------------

Added syntax coloring.  See my new post :doc:`syntax-colors-nikola`
for more details.
