system76 / cuda

Packaging for NVIDIA's CUDA Toolkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

findgllib.mk does not work in pop for cuda programs that use GL

fcaballerop opened this issue · comments

The findgllib.mk file is executed by 'make' in all sample codes that use GL for visualization. This file tries to find the files libGL.so and libGLU.so in the system but only does so for supported distros (Ubuntu, Fedora, Rhel, CentOS and SUSE). If this programs are compiled in Pop the make command tells us it cannot find those libraries and fails.

This can be fixed by changing the default findgllib.mk file that ships with this repository, either adding an option for PopOs, which would look as follows. For the version that ships with cuda-11.2, after line 62 add:

POP   = $(shell echo $(DISTRO) | grep -i 'pop' >/dev/null 2>&1; echo $$?)
ifeq ("(POP)", "0")
      GLPATH    ?= /usr/lib
      GLLINK    ?= -L/usr/lib
      DFLT_PATH ?= /usr/lib
endif

This works since these files are installed with the cuda toolkit on /usr/lib/cuda/.

Alternatively, and a much simpler solution, is that line 89 (DFLT_PATH ?= /usr/lib) can be moved at the end of all if statements that check for distributions, right before lines 114 and 115 that actually try to find libGL.so and libGLU.so. I believe this last solution is actually what whoever wrote this file actually intended, since it's the last place to look for if a distribution cannot be recognized. This is how it then goes to find the header files, which works because it starts by setting a default distribution-independent path of search.