1

Can anyone help solve the make error I received whilst installing Netgen 5.3.1. NETGEN is an automatic 3d tetrahedral mesh generator. The error message summary is:

collect2: error: ld returned 1 exit status
Makefile:414: recipe for target 'netgen' failed
make[2]: *** [netgen] Error 1
make[2]: Leaving directory '/home/bjd/netgen-5.3.1/ng'
Makefile:354: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/bjd/netgen-5.3.1'
Makefile:285: recipe for target 'all' failed
make: *** [all] Error 2

Netgen mesher installation instructions are @ Netgen Mesh Generator wiki

The output of configure and the end of make:

bjd@brendan:~/netgen-5.3.1$ ls
aclocal.m4    config.sub                         install-sh   mkinstalldirs
ar-lib        configure                          libsrc       NEWS
AUTHORS       configure.ac                       ltmain.sh    ng
ChangeLog     depcomp                            m4           nglib
config.guess  doc                                Makefile.am  TODO
config.h.in   INSTALL                            Makefile.in  tutorials
config.log    installing netgen-5.3.1 notes.txt  missing      windows
bjd@brendan:~/netgen-5.3.1$ ./configure --with-sysroot=/usr/lib/ --with-tcl=/usr/lib/tcl8.5/ --with-tk=/usr/lib/tk8.5/ --with-togl=/usr/lib/ --with-metis=/usr/lib/x86_64-linux-gnu/ --enable-nglib
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for g++ option to support OpenMP... -fopenmp
checking for ar... ar
checking the archiver (ar) interface... ar
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... /usr/lib/
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking how to run the C++ preprocessor... g++ -E
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... (cached) GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking for correct TEA configuration... ok (TEA 3.9)
configure: configuring netgen 5.3.1
checking for Tcl configuration... found /usr/lib/tcl8.5/tclConfig.sh
checking for existence of /usr/lib/tcl8.5/tclConfig.sh... loading
checking for Tk configuration... found /usr/lib/tk8.5/tkConfig.sh
checking for existence of /usr/lib/tk8.5/tkConfig.sh... loading
checking for Tcl public headers... /usr/include/tcl8.5
checking for Tk public headers... /usr/include/tcl8.5
checking GL/gl.h usability... yes
checking GL/gl.h presence... yes
checking for GL/gl.h... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libsrc/Makefile
config.status: creating libsrc/csg/Makefile
config.status: creating libsrc/general/Makefile
config.status: creating libsrc/geom2d/Makefile
config.status: creating libsrc/gprim/Makefile
config.status: creating libsrc/include/Makefile
config.status: creating libsrc/interface/Makefile
config.status: creating libsrc/linalg/Makefile
config.status: creating libsrc/meshing/Makefile
config.status: creating libsrc/occ/Makefile
config.status: creating libsrc/stlgeom/Makefile
config.status: creating libsrc/visualization/Makefile
config.status: creating ng/Makefile
config.status: creating nglib/Makefile
config.status: creating tutorials/Makefile
config.status: creating doc/Makefile
config.status: creating windows/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands

------------------------------------------------------------------------
  netgen 5.3.1:  Automatic configuration OK.

  Enabled functionality:

    OCC: ............... false
    JPEGlib: ........... false
    FFMPEG: ............ false
    NGLIB: ............. true
    GUI: ............... true


  Building:

    Type 'make' to compile netgen.

    Type 'make install' to install netgen.

  Example programs will be built but not installed.
------------------------------------------------------------------------

bjd@brendan:~/netgen-5.3.1$ make
make  all-recursive
make[1]: Entering directory '/home/bjd/netgen-5.3.1'
Making all in libsrc
make[2]: Entering directory '/home/bjd/netgen-5.3.1/libsrc'
Making all in general
make[3]: Entering directory '/home/bjd/netgen-5.3.1/libsrc/general'
/bin/bash ../../libtool --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H 
...
...

I../libsrc/interface -DOPENGL -DTOGL_X11 -I"/usr/include/tcl8.5"       -g -O2 -fopenmp -MT ngpkg.o -MD -MP -MF .deps/ngpkg.Tpo -c -o ngpkg.o ngpkg.cpp
mv -f .deps/ngpkg.Tpo .deps/ngpkg.Po
/bin/bash ../libtool --tag=CXX   --mode=link g++  -g -O2 -fopenmp -export-dynamic  -o netgen demoview.o ngappinit.o onetcl.o parallelfunc.o ngpkg.o ../libsrc/visualization/libvisual.la ../libsrc/csg/libcsgvis.la ../libsrc/csg/libcsg.la ../libsrc/interface/libinterface.la ../libsrc/meshing/libmesh.la -L/usr/lib/tk8.5/Togl1.7 -L/usr/lib/ -lTogl -lGLU -L/usr/lib/x86_64-linux-gnu -ltk8.5 -L/usr/lib/x86_64-linux-gnu -ltcl8.5    -lGL -lXmu -lX11   
libtool: link: g++ -g -O2 -fopenmp -o .libs/netgen demoview.o ngappinit.o onetcl.o parallelfunc.o ngpkg.o -Wl,--export-dynamic  ../libsrc/visualization/.libs/libvisual.a ../libsrc/csg/.libs/libcsgvis.so ../libsrc/csg/.libs/libcsg.so ../libsrc/interface/.libs/libinterface.so ../libsrc/meshing/.libs/libmesh.so -L/usr/lib/tk8.5/Togl1.7 -L/usr/lib/ -lTogl -lGLU -L/usr/lib/x86_64-linux-gnu -ltk8.5 -ltcl8.5 -lGL -lXmu -lX11 -fopenmp -Wl,-rpath -Wl,/opt/netgen/lib
/usr/bin/ld: cannot find -lXmu
collect2: error: ld returned 1 exit status
Makefile:414: recipe for target 'netgen' failed
make[2]: *** [netgen] Error 1
make[2]: Leaving directory '/home/bjd/netgen-5.3.1/ng'
Makefile:354: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/bjd/netgen-5.3.1'
Makefile:285: recipe for target 'all' failed
make: *** [all] Error 2
bjd@brendan:~/netgen-5.3.1$
1
  • 3
    cannot find -lXmu suggests you need to install the libxmu-dev package – steeldriver Jun 14 '18 at 15:14
3

Netgen 4.9.13 is packaged in Ubuntu 16.04 LTS.

So more straightforward way would be get its build-dependencies with

sudo apt-get build-dep netgen

and then proceed as you do

tar -xf netgen-5.3.1.tar.gz
cd netgen-5.3.1
./configure --with-sysroot=/usr/lib/ --with-tcl=/usr/lib/tcl8.5/ --with-tk=/usr/lib/tk8.5/ --with-togl=/usr/lib/ --with-metis=/usr/lib/x86_64-linux-gnu/ --enable-nglib
make -j5
sudo make install
0

The above answer from NOrbert solved the issue with make; and sudo make install worked as well. sudo apt-get build-dep netgen requires selecting "Source code" in "Ubuntu Software".

It turns out there was a bug in the Netgen code which can be solved @ "Major opcode of failed request: 155 (GLX)" Netgen 5.3.1 and Netgen 4.9.13 on Ubuntu:

Therefore, edit file /opt/netgen/bin/drawing.tcl at 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

This requires accessing source code with permissions, use:

sudo nano /opt/netgen/bin/drawing.tcl

Netgen started to load but required updates to certain packages:

Netgen still didn't run in the command line with netgen &!, so I found netgen not starting on Ubuntu 14.04 LTS, to run it in directory:

/opt/netgen/bin using ./netgen . This then successfully ran Netgen!

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.