makeのエラー対処[/usr/lib/x86_64-linux-gnu/libGL.so needed by named]

## はじめに
これまでは動いていたプログラムのcmakeは普段通り実行されたが、makeの時点で

```sh:error
[100%] make   (略) /usr/lib/x86_64-linux-gnu/libGL.so needed by named (略)
```

というエラーが発生した。

原因は定かではないが、`NVIDIAドライバのインストールによる影響`と予想しています。

## 状況・解決方法

libGL.soがないということみたいなので、

```sh:
$ apt search libgl | grep libgl
```

でそれらしいものを探すことにしました。

```sh:result_of_search_libgl

  command-line interface to libglyr
  Guile bindings for GTK+, libglade, Pango and ATK
libgl-gst/bionic 3.2.5-1.1 amd64
libgl1/bionic-updates,now 1.0.0-2ubuntu2.3 amd64 [installed]
libgl1-mesa-dev/bionic-updates,now 19.0.2-1ubuntu1.1~18.04.2 amd64 [installed]
libgl1-mesa-dri/bionic-updates,now 19.0.2-1ubuntu1.1~18.04.2 amd64 [installed,automatic]
libgl1-mesa-glx/bionic-updates,now 19.0.2-1ubuntu1.1~18.04.2 amd64 [installed,automatic]
libgl2ps-dev/bionic,now 1.4.0+dfsg1-1 amd64 [installed,automatic]
libgl2ps-doc/bionic,bionic 1.4.0+dfsg1-1 all
libgl2ps1.4/bionic,now 1.4.0+dfsg1-1 amd64 [installed,automatic]
libglade2-0/bionic 1:2.6.4-2 amd64
libglade2-dev/bionic 1:2.6.4-2 amd64
  development files for libglade
libglade2.0-cil/bionic 2.12.40-2 amd64
libglade2.0-cil-dev/bionic 2.12.40-2 amd64
libglademm-2.4-1v5/bionic 2.6.7-5 amd64
  C++ wrappers for libglade2 (shared library)
libglademm-2.4-dbg/bionic 2.6.7-5 amd64
  C++ wrappers for libglade2 (debug symbols)
libglademm-2.4-dev/bionic 2.6.7-5 amd64
  C++ wrappers for libglade2 (development files)
libglademm-2.4-doc/bionic,bionic 2.6.7-5 all
  C++ wrappers for libglade2 (documentation)
libgladeui-2-6/bionic 3.22.1-1 amd64
libgladeui-common/bionic,bionic 3.22.1-1 all
libgladeui-dev/bionic 3.22.1-1 amd64
libgladeui-doc/bionic,bionic 3.22.1-1 all
libglapi-mesa/bionic-updates,now 19.0.2-1ubuntu1.1~18.04.2 amd64 [installed,automatic]
libglazedlists-java/bionic,bionic 1.9.1-2 all
libglazedlists-java-doc/bionic,bionic 1.9.1-2 all
libglbinding-dev/bionic 2.1.1-1 amd64
libglbinding2/bionic 2.1.1-1 amd64
libglbsp-dev/bionic 2.24-3 amd64
libglbsp3/bionic 2.24-3 amd64
libglc-dev/bionic 0.7.2-5ubuntu4 amd64
libglc0/bionic 0.7.2-5ubuntu4 amd64
libgle3/bionic 3.1.0-7.2 amd64
libgle3-dev/bionic 3.1.0-7.2 amd64
libglee0d1/bionic 5.4.0-2 amd64
libglee0d1-dbg/bionic 5.4.0-2 amd64
libgles1/bionic-updates,now 1.0.0-2ubuntu2.3 amd64 [installed,automatic]
libgles2/bionic-updates,now 1.0.0-2ubuntu2.3 amd64 [installed,automatic]
libgles2-mesa/bionic-updates 19.0.2-1ubuntu1.1~18.04.2 amd64
libgles2-mesa-dev/bionic-updates,now 19.0.2-1ubuntu1.1~18.04.2 amd64 [installed,automatic]
libglew-dev/bionic 2.0.0-5 amd64
libglew2.0/bionic 2.0.0-5 amd64
libglewmx-dev/bionic-updates 1.13.0-4ubuntu0.18.04.1 amd64
libglewmx1.13/bionic-updates 1.13.0-4ubuntu0.18.04.1 amd64
libglfw3/bionic 3.2.1-1 amd64
libglfw3-dev/bionic 3.2.1-1 amd64
libglfw3-doc/bionic,bionic 3.2.1-1 all
libglfw3-wayland/bionic 3.2.1-1 amd64
libglib-object-introspection-perl/bionic,now 0.044-2 amd64 [installed,automatic]
libglib-perl/bionic,now 3:1.326-1build1 amd64 [installed,automatic]
libglib2.0-0/bionic-updates,bionic-security,now 2.56.4-0ubuntu0.18.04.4 amd64 [installed]
libglib2.0-bin/bionic-updates,bionic-security,now 2.56.4-0ubuntu0.18.04.4 amd64 [installed,automatic]
libglib2.0-cil/bionic 2.12.40-2 amd64
libglib2.0-cil-dev/bionic 2.12.40-2 amd64
libglib2.0-data/bionic-updates,bionic-updates,bionic-security,bionic-security,now 2.56.4-0ubuntu0.18.04.4 all [installed,automatic]
libglib2.0-dev/bionic-updates,bionic-security,now 2.56.4-0ubuntu0.18.04.4 amd64 [installed,automatic]
libglib2.0-dev-bin/bionic-updates,bionic-security,now 2.56.4-0ubuntu0.18.04.4 amd64 [installed,automatic]
libglib2.0-doc/bionic-updates,bionic-updates,bionic-security,bionic-security 2.56.4-0ubuntu0.18.04.4 all
libglib2.0-tests/bionic-updates,bionic-security 2.56.4-0ubuntu0.18.04.4 amd64
libglib3.0-cil/bionic 2.99.3-2 amd64
libglib3.0-cil-dev/bionic 2.99.3-2 amd64
libglibmm-2.4-1v5/bionic 2.56.0-1 amd64
libglibmm-2.4-dev/bionic 2.56.0-1 amd64
libglibmm-2.4-doc/bionic,bionic 2.56.0-1 all
libglide2/bionic 2002.04.10ds1-13 i386
libglide2-dev/bionic 2002.04.10ds1-13 i386
libglide3/bionic 2002.04.10ds1-13 amd64
libglide3-dev/bionic 2002.04.10ds1-13 amd64
libglm-dev/bionic,bionic 0.9.9~a2-2 all
libglm-doc/bionic,bionic 0.9.9~a2-2 all
libglobalarrays-dev/bionic 5.4~beta~r10636+dfsg-5.1 amd64
libglobjects-dev/bionic 1.1.0-2 amd64
libglobjects1/bionic 1.1.0-2 amd64
libglobus-authz-callout-error-dev/bionic 3.6-2 amd64
libglobus-authz-callout-error-doc/bionic,bionic 3.6-2 all
libglobus-authz-callout-error0/bionic 3.6-2 amd64
libglobus-authz-dev/bionic 3.15-2 amd64
libglobus-authz-doc/bionic,bionic 3.15-2 all
libglobus-authz0/bionic 3.15-2 amd64
libglobus-callout-dev/bionic 3.15-2 amd64
libglobus-callout-doc/bionic,bionic 3.15-2 all
libglobus-callout0/bionic 3.15-2 amd64
libglobus-common-dev/bionic 17.2-1 amd64
libglobus-common-doc/bionic,bionic 17.2-1 all
libglobus-common0/bionic 17.2-1 amd64
libglobus-ftp-client-dev/bionic 8.36-2build1 amd64
libglobus-ftp-client-doc/bionic,bionic 8.36-2build1 all
libglobus-ftp-client2/bionic 8.36-2build1 amd64
libglobus-ftp-control-dev/bionic 8.2-1 amd64
libglobus-ftp-control-doc/bionic,bionic 8.2-1 all
libglobus-ftp-control1/bionic 8.2-1 amd64
libglobus-gass-cache-dev/bionic 9.10-2build1 amd64
libglobus-gass-cache-doc/bionic,bionic 9.10-2build1 all
libglobus-gass-cache5/bionic 9.10-2build1 amd64
libglobus-gass-copy-dev/bionic 9.28-1build1 amd64
libglobus-gass-copy-doc/bionic,bionic 9.28-1build1 all
libglobus-gass-copy2/bionic 9.28-1build1 amd64
libglobus-gass-server-ez-dev/bionic 5.8-2 amd64
libglobus-gass-server-ez2/bionic 5.8-2 amd64
libglobus-gass-transfer-dev/bionic 8.10-2 amd64
libglobus-gass-transfer-doc/bionic,bionic 8.10-2 all
libglobus-gass-transfer2/bionic 8.10-2 amd64
libglobus-gfork-dev/bionic 4.9-2 amd64
libglobus-gfork0/bionic 4.9-2 amd64
libglobus-gram-client-dev/bionic 13.19-1 amd64
libglobus-gram-client-doc/bionic,bionic 13.19-1 all
libglobus-gram-client3/bionic 13.19-1 amd64
libglobus-gram-job-manager-callout-error-dev/bionic 3.6-2 amd64
libglobus-gram-job-manager-callout-error-doc/bionic,bionic 3.6-2 all
libglobus-gram-job-manager-callout-error0/bionic 3.6-2 amd64
libglobus-gram-protocol-dev/bionic 12.15-2 amd64
libglobus-gram-protocol-doc/bionic,bionic 12.15-2 all
libglobus-gram-protocol3/bionic 12.15-2 amd64
libglobus-gridftp-server-control-dev/bionic 6.0-3 amd64
libglobus-gridftp-server-control0/bionic 6.0-3 amd64
libglobus-gridftp-server-dev/bionic 12.2-2 amd64
libglobus-gridftp-server6/bionic 12.2-2 amd64
libglobus-gridmap-callout-error-dev/bionic 2.5-2 amd64
libglobus-gridmap-callout-error-doc/bionic,bionic 2.5-2 all
libglobus-gridmap-callout-error0/bionic 2.5-2 amd64
libglobus-gridmap-eppn-callout/bionic 1.13-2build1 amd64
libglobus-gridmap-verify-myproxy-callout/bionic 2.9-2build1 amd64
libglobus-gsi-callback-dev/bionic 5.13-2build1 amd64
libglobus-gsi-callback-doc/bionic,bionic 5.13-2build1 all
libglobus-gsi-callback0/bionic 5.13-2build1 amd64
libglobus-gsi-cert-utils-dev/bionic 9.16-2build1 amd64
libglobus-gsi-cert-utils-doc/bionic,bionic 9.16-2build1 all
libglobus-gsi-cert-utils0/bionic 9.16-2build1 amd64
libglobus-gsi-credential-dev/bionic 7.14-1build1 amd64
libglobus-gsi-credential-doc/bionic,bionic 7.14-1build1 all
libglobus-gsi-credential1/bionic 7.14-1build1 amd64
libglobus-gsi-openssl-error-dev/bionic 3.8-2build1 amd64
libglobus-gsi-openssl-error-doc/bionic,bionic 3.8-2build1 all
libglobus-gsi-openssl-error0/bionic 3.8-2build1 amd64
libglobus-gsi-proxy-core-dev/bionic 8.6-2build1 amd64
libglobus-gsi-proxy-core-doc/bionic,bionic 8.6-2build1 all
libglobus-gsi-proxy-core0/bionic 8.6-2build1 amd64
libglobus-gsi-proxy-ssl-dev/bionic 5.10-2build1 amd64
libglobus-gsi-proxy-ssl-doc/bionic,bionic 5.10-2build1 all
libglobus-gsi-proxy-ssl1/bionic 5.10-2build1 amd64
libglobus-gsi-sysconfig-dev/bionic 8.0-1build1 amd64
libglobus-gsi-sysconfig-doc/bionic,bionic 8.0-1build1 all
libglobus-gsi-sysconfig1/bionic 8.0-1build1 amd64
libglobus-gss-assist-dev/bionic 11.1-1 amd64
libglobus-gss-assist-doc/bionic,bionic 11.1-1 all
libglobus-gss-assist3/bionic 11.1-1 amd64
libglobus-gssapi-error-dev/bionic 5.5-2 amd64
libglobus-gssapi-error-doc/bionic,bionic 5.5-2 all
libglobus-gssapi-error2/bionic 5.5-2 amd64
libglobus-gssapi-gsi-dev/bionic 13.4-1build1 amd64
libglobus-gssapi-gsi-doc/bionic,bionic 13.4-1build1 all
libglobus-gssapi-gsi4/bionic 13.4-1build1 amd64
libglobus-io-dev/bionic 11.9-2 amd64
libglobus-io3/bionic 11.9-2 amd64
libglobus-net-manager-dev/bionic 0.17-2 amd64
libglobus-net-manager-doc/bionic,bionic 0.17-2 all
libglobus-net-manager0/bionic 0.17-2 amd64
libglobus-openssl-module-dev/bionic 4.8-2build1 amd64
libglobus-openssl-module-doc/bionic,bionic 4.8-2build1 all
libglobus-openssl-module0/bionic 4.8-2build1 amd64
libglobus-rsl-dev/bionic 10.11-2 amd64
libglobus-rsl-doc/bionic,bionic 10.11-2 all
libglobus-rsl2/bionic 10.11-2 amd64
libglobus-scheduler-event-generator-dev/bionic 5.12-2 amd64
libglobus-scheduler-event-generator-doc/bionic,bionic 5.12-2 all
libglobus-scheduler-event-generator0/bionic 5.12-2 amd64
libglobus-usage-dev/bionic 4.5-2 amd64
libglobus-usage0/bionic 4.5-2 amd64
libglobus-xio-dev/bionic 5.16-2 amd64
libglobus-xio-doc/bionic,bionic 5.16-2 all
libglobus-xio-gridftp-driver/bionic 2.17-2 amd64
libglobus-xio-gridftp-driver-dev/bionic 2.17-2 amd64
libglobus-xio-gridftp-driver-doc/bionic,bionic 2.17-2 all
libglobus-xio-gridftp-multicast/bionic 1.7-2 amd64
libglobus-xio-gridftp-multicast-dev/bionic 1.7-2 amd64
libglobus-xio-gsi-driver/bionic 4.1-1 amd64
libglobus-xio-gsi-driver-dev/bionic 4.1-1 amd64
libglobus-xio-gsi-driver-doc/bionic,bionic 4.1-1 all
libglobus-xio-net-manager-driver/bionic 0.17-2 amd64
libglobus-xio-net-manager-driver-dev/bionic 0.17-2 amd64
libglobus-xio-pipe-driver/bionic 3.10-2 amd64
libglobus-xio-pipe-driver-dev/bionic 3.10-2 amd64
libglobus-xio-popen-driver/bionic 3.6-2 amd64
libglobus-xio-popen-driver-dev/bionic 3.6-2 amd64
libglobus-xio-rate-driver/bionic 1.8-2 amd64
libglobus-xio-rate-driver-dev/bionic 1.8-2 amd64
libglobus-xio-udt-driver/bionic 1.28-2 amd64
libglobus-xio-udt-driver-dev/bionic 1.28-2 amd64
libglobus-xio0/bionic 5.16-2 amd64
libglom-1.30-0/bionic 1.30.4-0ubuntu12 amd64
libglom-1.30-dev/bionic 1.30.4-0ubuntu12 amd64
libgloox-dbg/bionic 1.0.18-1 amd64
libgloox-dev/bionic 1.0.18-1 amd64
libgloox-doc/bionic,bionic 1.0.18-1 all
libgloox15/bionic 1.0.18-1 amd64
libglpk-dev/bionic 4.65-1 amd64
libglpk-java/bionic 1.11.0-1 amd64
libglpk40/bionic 4.65-1 amd64
libgltf-0.1-1/bionic 0.1.0-3 amd64
libgltf-dev/bionic 0.1.0-3 amd64
libglu1-mesa/bionic,now 9.0.0-2.1build1 amd64 [installed,automatic]
libglu1-mesa-dev/bionic,now 9.0.0-2.1build1 amd64 [installed,automatic]
libgluegen2-build-java/bionic-updates,bionic-updates,bionic-security,bionic-security 2.3.2-7~18.04 all
libgluegen2-doc/bionic-updates,bionic-updates,bionic-security,bionic-security 2.3.2-7~18.04 all
libgluegen2-jni/bionic-updates,bionic-security 2.3.2-7~18.04 amd64
libgluegen2-rt-java/bionic-updates,bionic-updates,bionic-security,bionic-security 2.3.2-7~18.04 all
libglvnd-core-dev/bionic-updates,now 1.0.0-2ubuntu2.3 amd64 [installed,automatic]
libglvnd-dev/bionic-updates,now 1.0.0-2ubuntu2.3 amd64 [installed]
libglvnd0/bionic-updates,now 1.0.0-2ubuntu2.3 amd64 [installed,automatic]
libglw1-mesa/bionic 8.0.0-1.1 amd64
libglw1-mesa-dev/bionic 8.0.0-1.1 amd64
libglx-mesa0/bionic-updates,now 19.0.2-1ubuntu1.1~18.04.2 amd64 [installed,automatic]
libglx0/bionic-updates,now 1.0.0-2ubuntu2.3 amd64 [installed,automatic]
libglyr-dev/bionic 1.0.9-1 amd64
libglyr-doc/bionic,bionic 1.0.9-1 all
libglyr1/bionic 1.0.9-1 amd64
libglyr1-dbg/bionic 1.0.9-1 amd64
libgtkdatabox-0.9.3-0-libglade/bionic 1:0.9.3.0+dfsg-3 amd64
```

と出力された。この中からそれらしい部分を抽出したものが以下。

```sh:kokokana
libgl1/bionic-updates,now 1.0.0-2ubuntu2.3 amd64 [installed]
libgl1-mesa-dev/bionic-updates,now 19.0.2-1ubuntu1.1~18.04.2 amd64 [installed]
libgl1-mesa-dri/bionic-updates,now 19.0.2-1ubuntu1.1~18.04.2 amd64 [installed,automatic]
libgl1-mesa-glx/bionic-updates,now 19.0.2-1ubuntu1.1~18.04.2 amd64 [installed,automatic]
```

ここらへんだと思った。インストールされていたので、エラーで指定されていた場所を確認することにした。

とりあえず、再インストールを試す。

```sh:command
sudo apt install --reinstall libgl1 libgl1-mesa-*
```

これでは解決しなかったので、指定された場所を見に行った。

```sh:command
cd /usr/lib/x86_64-linux-gnu/
ls | grep libGL
```

```sh:result
libGL.la
libGL.so.1
libGL.so.1.0.0
```

ここに`libGL.so`が無いようであった。

https://www.blender.org/forum/viewtopic.php?t=21867
https://github.com/RobotLocomotion/drake/issues/2087
https://github.com/start-jsk/hrpsys/issues/67

ここらへんを参考にして、


```sh:command
sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 /usr/lib/libGL.so
```

としたら、makeできるようになった。

# おわりに
今回はゴリ押しでエラーに対処したのですが、手動で`lib`をいじるのは良くないらしいので、心と時間に余裕のある人はNVIDIADRIVERをpurgeしてインストールし直したほうが良いかもしれません。