Can anyone help solve the runtime error for Netgen 5.3.1. NETGEN is an automatic 3d tetrahedral mesh generator. The error message is:

:/opt/netgen/bin$ ./netgen
Developed by Joachim Schoeberl at
2010-xxxx Vienna University of Technology
2006-2010 RWTH Aachen University
1996-2006 Johannes Kepler University Linz
optfile ./ng.opt does not exist - using default values
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  154 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  558
  Current serial number in output stream:  559

Instructions on installing netgen-5.3.1 are given here.

The software seems to have followed ./configure , make and sudo make install correctly.

I followed the instructions from a web page with a similar error message, but it did not resolve the problem. I.e. installing Togl-1.7 .

The end output of sudo make install gave:

libtool: relink: g++  -fPIC -DPIC -shared -nostdlib /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbeginS.o  .libs/nglib.o   -Wl,-rpath -Wl,/opt/netgen/lib -L/opt/netgen/lib -linterface -lgeom2d -lcsg -lstl -locc -lmesh -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. -lstdc++ -lm -lgomp -lpthread -lc -lgcc_s /usr/lib/gcc/x86_64-linux-gnu/5/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crtn.o  -O2 -fopenmp   -fopenmp -Wl,-soname -Wl,libnglib.so -o .libs/libnglib.so
libtool: install: /usr/bin/install -c .libs/libnglib.soT /opt/netgen/lib/libnglib.so
libtool: install: /usr/bin/install -c .libs/libnglib.lai /opt/netgen/lib/libnglib.la
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin" ldconfig -n /opt/netgen/lib
Libraries have been installed in:

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
test -z "/opt/netgen/bin" || /bin/mkdir -p "/opt/netgen/bin"
  /bin/bash ../libtool   --mode=install /usr/bin/install -c ng_vol ng_stl '/opt/netgen/bin'
libtool: install: /usr/bin/install -c .libs/ng_vol /opt/netgen/bin/ng_vol
libtool: install: /usr/bin/install -c .libs/ng_stl /opt/netgen/bin/ng_stl
test -z "/opt/netgen/share/netgen" || /bin/mkdir -p "/opt/netgen/share/netgen"
 /usr/bin/install -c -m 644 cube.surf '/opt/netgen/share/netgen'
test -z "/opt/netgen/include" || /bin/mkdir -p "/opt/netgen/include"
 /usr/bin/install -c -m 644 nglib.h '/opt/netgen/include'
make[2]: Leaving directory '/home/brendan/Documents/hpfem-mpt/netgen-5.3.1/nglib'
make[1]: Leaving directory '/home/brendan/Documents/hpfem-mpt/netgen-5.3.1/nglib'
make[1]: Entering directory '/home/brendan/Documents/hpfem-mpt/netgen-5.3.1'
make[2]: Entering directory '/home/brendan/Documents/hpfem-mpt/netgen-5.3.1'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/home/brendan/Documents/hpfem-mpt/netgen-5.3.1'
make[1]: Leaving directory '/home/brendan/Documents/hpfem-mpt/netgen-5.3.1'
  • 1
    Try LD_PRELOAD='/usr/$LIB/libstdc++.so.6' ./netgen – Amith KK Jul 10 '18 at 14:26
  • I tried this, adding it to ~/.profile as: export LD_PRELOAD='/usr/$LIB/libstdc++.so.6' ./netgen ---- however it gives the same error. – Brendan Darrer Jul 10 '18 at 14:47
  • One option could be to follow the example of hangkongwang @ askubuntu.com/questions/893922/… ---- who has a similar error message. Not sure how to do that? I'll try it out. – Brendan Darrer Jul 10 '18 at 14:58
  • 1
    I got the same with netgen version 4.9.13 from official repository (Intel built-in video). But it works on VirtualBox. – N0rbert Jul 10 '18 at 21:43

It seems to be a known bug 1556445.

If you use version 4.9.13 from official repository (installed with sudo apt-get install netgen) you can "patch" it by running the following command manually:

sudo sed -i "s/\-indirect\ true\ \}/\-indirect\ false\ \}/g" \

This method came from Netgen SourceForge Maillist:

Joachim Schoeberl - 2016-02-04

edit file ng/drawing.tcl line 14:

if {[catch {togl .ndraw -width 400 -height 300 -rgba true -double true -depth true -privatecmap false -stereo false -indirect true }] } { ....

change "-indirect true" to "-indirect false"


May work with manually compiled version too (need changes in filepath - /opt/netgen/bin/drawing.tcl).


I found I needed to follow my previous method, editing file /opt/netgen/bin/drawing.tcl at line 14

changing -indirect true to -indirect false

& executing at /opt/netgen/bin using ./netgen was successful!

I found that executing it with netgen &! produced the same error message.

The error was that at /opt/netgen/bin/drawing.tcl:

# use this one for Togl 2.0
# if {[catch {togl .ndraw -width 400 -height 300  -rgba true -double true -depth true -privatecmap false -stereo false -indirect false -create init  -display draw -reshape reshape  }] } {    

if {[catch {togl .ndraw -width 400 -height 300  -rgba true -double true -depth true -privatecmap false -stereo false -indirect true }] } {    puts "no OpenGL" 
} {

I had altered the commented code at line 12 instead of line 14, as both lines look similar.

  • 1
    I did exactly the same but using sed - stream editor for filtering and transforming text. So I can't find differences between you solution and mine :) – N0rbert Jul 11 '18 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.