# Libglut.so.3 not found

**URL:** <https://community.freefem.org/t/libglut-so-3-not-found/2637>\
**Category:** FreeFEM installation\
**Created:** [August 3, 2023, 4:31pm UTC](https://community.freefem.org/t/libglut-so-3-not-found/2637 "2023-08-03T16:31:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![durable\_oreo](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@durable\_oreo](https://community.freefem.org/u/durable_oreo)\
**Post date:** [August 3, 2023, 4:31pm UTC](https://community.freefem.org/t/libglut-so-3-not-found/2637/1 "2023-08-03T16:31:51Z")

</div>

I recently installed FreeFEM on an Ubuntu 23.04 box. The numerical part seems to work (see example below) but ffglut can’t find the libglut shared library so no graphics.

Obviously this is a system problem not an issue with FreeFEM per se. However, I’d appreciate any help you can give.

> # FreeFem++ circle.edp
> 
> – FreeFem++ v4.13 (Fri 07 Jul 2023 10:49:44 AM CEST - git v4.13)  
> file : circle.edp  
> Load: lg\_fem lg\_mesh lg\_mesh3 eigenvalue  
> 1 : // Define mesh boundary  
> 2 : border C(t=0, 2_pi){x=cos(t); y=sin(t);}  
> 3 :  
> 4 : // The triangulated domain Th is on the left side of its boundary  
> 5 : mesh Th = buildmesh(C(50));  
> 6 :  
> 7 : // The finite element space defined over Th is called here Vh  
> 8 : fespace Vh(Th, P1);  
> 9 : Vh u, v;// Define u and v as piecewise-P1 continuous functions  
> 10 :  
> 11 : // Define a function f  
> 12 : func f= x_y;  
> 13 :  
> 14 : // Get the clock in second  
> 15 : real cpu=clock();  
> 16 :  
> 17 : // Define the PDE  
> 18 : solve Poisson(u, v, solver=LU)  
> 19 : = int2d(Th)( // The bilinear part  
> 20 : dx(u)\*dx(v)  
> 21 : + dy(u)_dy(v)  
> 22 : )  
> 23 : - int2d(Th)( // The right hand side  
> 24 : f_v  
> 25 : )  
> 26 : + on(C, u=0); // The Dirichlet boundary condition  
> 27 :  
> 28 : // Plot the result  
> 29 : plot(u);  
> 30 :  
> 31 : // Display the total computational time  
> 32 : cout \<\< "CPU time = " \<\< (clock()-cpu) \<\< endl;  
> 33 : sizestack + 1024 =1920 ( 896 )
> 
> – mesh: Nb of Triangles = 434, Nb of Vertices 243  
> SkyLineMatrix: size pL/pU: 243 3732 3732 moy=15.358  
> – Solve :  
> min -0.0103244 max 0.0102905  
> CPU time = 0.014076  
> times: compile 0.023038s, execution 0.02644s, mpirank:0  
> ffglut: error while loading shared libraries: libglut.so.3: cannot open shared object file: No such file or directory  
> CodeAlloc : nb ptr 3819, size :512928 mpirank: 0  
> Ok: Normal End
> 
> #

When I check the libraries ffglut wants, it’s clear that the

> # ldd `which ffglut`
> 
> linux-vdso.so.1 (0x00007ffff4f03000)  
> libglut.so.3 =\> not found  
> libGLU.so.1 =\> /lib/x86\_64-linux-gnu/libGLU.so.1 (0x00007f36fce4f000)  
> libGL.so.1 =\> /lib/x86\_64-linux-gnu/libGL.so.1 (0x00007f36fcdc8000)  
> libpthread.so.0 =\> /lib/x86\_64-linux-gnu/libpthread.so.0 (0x00007f36fcdc3000)  
> libstdc++.so.6 =\> /lib/x86\_64-linux-gnu/libstdc++.so.6 (0x00007f36fca00000)  
> libm.so.6 =\> /lib/x86\_64-linux-gnu/libm.so.6 (0x00007f36fccd8000)  
> libgcc\_s.so.1 =\> /lib/x86\_64-linux-gnu/libgcc\_s.so.1 (0x00007f36fccb4000)  
> libc.so.6 =\> /lib/x86\_64-linux-gnu/libc.so.6 (0x00007f36fc600000)  
> libOpenGL.so.0 =\> /lib/x86\_64-linux-gnu/libOpenGL.so.0 (0x00007f36fcc89000)  
> libGLdispatch.so.0 =\> /lib/x86\_64-linux-gnu/libGLdispatch.so.0 (0x00007f36fc948000)  
> libGLX.so.0 =\> /lib/x86\_64-linux-gnu/libGLX.so.0 (0x00007f36fc916000)  
> /lib64/ld-linux-x86-64.so.2 (0x00007f36fcfb4000)  
> libX11.so.6 =\> /lib/x86\_64-linux-gnu/libX11.so.6 (0x00007f36fc4c2000)  
> libxcb.so.1 =\> /lib/x86\_64-linux-gnu/libxcb.so.1 (0x00007f36fc8ec000)  
> libXau.so.6 =\> /lib/x86\_64-linux-gnu/libXau.so.6 (0x00007f36fcc81000)  
> libXdmcp.so.6 =\> /lib/x86\_64-linux-gnu/libXdmcp.so.6 (0x00007f36fcc79000)  
> libbsd.so.0 =\> /lib/x86\_64-linux-gnu/libbsd.so.0 (0x00007f36fc8d7000)  
> libmd.so.0 =\> /lib/x86\_64-linux-gnu/libmd.so.0 (0x00007f36fc8ca000)

The library is present in /lib/x86\_64-linux-gnu/ and I installed in the usual way with sudo apt install libglut3-dev (below)

> # file libglut.so
> 
> libglut.so: symbolic link to libglut.so.3.12
> 
> # file libglut.so.3.12
> 
> libglut.so.3.12: symbolic link to libglut.so.3.12.0
> 
> # file libglut.so.3.12.0
> 
> libglut.so.3.12.0: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=1e0834454deb9f0c288de8a2bfef4d469880cb3a, stripped

> # sudo apt install freeglut3
> 
> Reading package lists… Done  
> Building dependency tree… Done  
> Reading state information… Done  
> E: Unable to locate package freeglut3
> 
> # sudo apt install freeglut3-dev
> 
> Reading package lists… Done  
> Building dependency tree… Done  
> Reading state information… Done  
> freeglut3-dev is already the newest version (3.4.0-1).  
> 0 upgraded, 0 newly installed, 0 to remove and 28 not upgraded.
> 
> #

I thought the library might not be in one of the expected locations but

> # ls /etc/ld.so.conf.d/
> 
> fakeroot-x86\_64-linux-gnu.conf libc.conf x86\_64-linux-gnu.conf zz\_i386-biarch-compat.conf
> 
> # cat /etc/ld.so.conf.d/x86\_64-linux-gnu.conf
> 
> # Multiarch support
> 
> /usr/local/lib/x86\_64-linux-gnu  
> /lib/x86\_64-linux-gnu  
> /usr/lib/x86\_64-linux-gnu

I’ve run sudo ldconfig, updated all packages, tried the binary, and compiled from source (with successful ‘make -j4 check’).

Any idea what I should to resolve this problem of a shared library that’s not found at runtime?

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [August 3, 2023, 5:25pm UTC](https://community.freefem.org/t/libglut-so-3-not-found/2637/2 "2023-08-03T17:25:01Z")

</div>

You could try adding the path to the library using the environment variable `LD_LIBRARY_PATH`.

---

<div class="post-metadata">

**Author:** ![durable\_oreo](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@durable\_oreo](https://community.freefem.org/u/durable_oreo)\
**Post date:** [August 3, 2023, 6:28pm UTC](https://community.freefem.org/t/libglut-so-3-not-found/2637/3 "2023-08-03T18:28:02Z")

</div>

That’s a good suggestion. It should work but I don’t see any effect.

# . ~/.bashrc

# echo $LD\_LIBRARY\_PATH

/lib/x86\_64-linux-gnu/

# ls $LD\_LIBRARY\_PATH/libglut\*

/lib/x86\_64-linux-gnu//libglut.a /lib/x86\_64-linux-gnu//libglut.so.3.12  
/lib/x86\_64-linux-gnu//libglut.so /lib/x86\_64-linux-gnu//libglut.so.3.12.0

# 

# FreeFem++ circle.edp

– FreeFem++ v4.13 (Fri 07 Jul 2023 10:49:44 AM CEST - git v4.13)  
file : circle.edp  
Load: lg\_fem lg\_mesh lg\_mesh3 eigenvalue  
1 : // Define mesh boundary  
2 : border C(t=0, 2\*pi){x=cos(t); y=sin(t);}  
…  
ffglut: error while loading shared libraries: libglut.so.3: cannot open shared object file: No such file or directory  
CPU time = 0.011335  
times: compile 0.040346s, execution 0.025853s, mpirank:0  
CodeAlloc : nb ptr 3819, size :512928 mpirank: 0  
Ok: Normal End

Here’s a thread of a similar issue in which the LD\_LIBRARY\_PATH idea worked. My situation mirrors this problem but I haven’t been able to get their solution to work.

> <https://stackoverflow.com/questions/62839157/how-do-i-diagnose-why-a-shared-library-is-not-found>

---

<div class="post-metadata">

**Author:** ![durable\_oreo](https://avatars.discourse-cdn.com/v4/letter/d/858c86/32.png) [@durable\_oreo](https://community.freefem.org/u/durable_oreo)\
**Post date:** [August 3, 2023, 9:09pm UTC](https://community.freefem.org/t/libglut-so-3-not-found/2637/4 "2023-08-03T21:09:35Z")

</div>

I downloaded the source for freeglut (link below), make, make install, ldconfig and it works now.

I couldn’t install the freeglut3 package (via apt) this whole time but freeglut3-dev was no problem. I added universe and a few other repositories but I just couldn’t get apt to install the package.

[https://freeglut.sourceforge.net/docs/install.php](https://freeglut.sourceforge.net/docs/install.php)
