Following instructions to run static library on linux (ver. 05-09-2021) produces errors

2,978 views
Skip to first unread message

Arvind D

unread,
Sep 17, 2021, 9:04:49 PM9/17/21
to sparselizardforum

Hello Group,

I work on a windows machine and have installed ubuntu 20.04 as a dual boot. I am following the instructions in the tutorial video as is.

I am also using gmsh 3.0.6 and the static library with last modified date 05-09-2021 (http://www.sparselizard.org/staticlibs/linux64/)


When i copy paste the following compile command in the website,

g++ -O3 -fopenmp -std=c++11 -Wno-return-type -fPIC -no-pie main.cpp -L ./ -l sparselizard -pthread -l dl -I headers -o slexe;


I expected it to compile but instead got a host of errors. I have put some lines below,

usr/bin/ld: .//libsparselizard.a(sl.o): in function `std::vector<std::shared_ptr<operation>, std::allocator<std::shared_ptr<operation> > >::operator=(std::vector<std::shared_ptr<operation>, std::allocator<std::shared_ptr<operation> > > const&) [clone .isra.0]':
sl.cpp:(.text+0x34b): undefined reference to `__libc_single_threaded'
/usr/bin/ld: sl.cpp:(.text+0x3aa): undefined reference to `__libc_single_threaded'
/usr/bin/ld: sl.cpp:(.text+0x4a4): undefined reference to `__libc_single_threaded'
/usr/bin/ld: sl.cpp:(.text+0x4e5): undefined reference to `__libc_single_threaded'
/usr/bin/ld: sl.cpp:(.text+0x5b3): undefined reference to `__libc_single_threaded'
/usr/bin/ld: .//libsparselizard.a(sl.o):sl.cpp:(.text+0x613): more undefined references to `__libc_single_threaded' follow
/usr/bin/ld: .//libsparselizard.a(sl.o): in function `std::vector<std::shared_ptr<operation>, std::allocator<std::shared_ptr<operation> > >::operator=(std::vector<std::shared_ptr<operation>, std::allocator<std::shared_ptr<operation> > > const&) [clone .isra.0]':
sl.cpp:(.text+0x84e): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: .//libsparselizard.a(sl.o): in function `std::vector<vec, std::allocator<vec> >::operator=(std::vector<vec, std::allocator<vec> > const&) [clone .isra.0]':
sl.cpp:(.text+0x8cb): undefined reference to `__libc_single_threaded'
/usr/bin/ld: sl.cpp:(.text+0x92a): undefined reference to `__libc_single_threaded'
/usr/bin/ld: sl.cpp:(.text+0xa24): undefined reference to `__libc_single_threaded'
/usr/bin/ld: sl.cpp:(.text+0xa65): undefined reference to `__libc_single_threaded'
/usr/bin/ld: sl.cpp:(.text+0xb33): undefined reference to `__libc_single_threaded'
/usr/bin/ld: .//libsparselizard.a(sl.o):sl.cpp:(.text+0xb93): more undefined references to `__libc_single_threaded' follow
/usr/bin/ld: .//libsparselizard.a(sl.o): in function `std::vector<vec, std::allocator<vec> >::operator=(std::vector<vec, std::allocator<vec> > const&) [clone .isra.0]':
sl.cpp:(.text+0xdce): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: .//libsparselizard.a(sl.o): in function `sl::exchange(std::vector<int, std::allocator<int> >, std::vector<densemat, std::allocator<densemat> >, std::vector<densemat, std::allocator<densemat> >)':
sl.cpp:(.text+0x2030): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: sl.cpp:(.text+0x206a): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: sl.cpp:(.text+0x2074): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: sl.cpp:(.text+0x207e): undefined reference to `std::__throw_bad_array_new_length()'
/usr/bin/ld: .//libsparselizard.a(sl.o):sl.cpp:(.text+0x2088): more undefined references to `std::__throw_bad_array_new_length()' follow
/usr/bin/ld: .//libsparselizard.a(sl.o): in function `sl::t()':
sl.cpp:(.text+0x3165): undefined reference to `__libc_single_threaded'


See attachment for entire list of errors.

Is there any prerequisite to use the static library? I took the library from here,

Linux - Static library (TUTORIAL VIDEO)
  • Watch the tutorial video
  • Download the static library here and open the folder in a terminal.
  • Run 'g++ -O3 -fopenmp -std=c++11 -Wno-return-type -fPIC -no-pie main.cpp -L ./ -l sparselizard -pthread -l dl -I headers -o slexe;'
  • Run './slexe'
  • Visualise the output .vtk file with ParaView

I have installed g++ , cmake, gfortran, gcc since i was trying to compile the source code earlier (which also i failed to do so)

Awaiting feedback!

- Arvind



Compiling error

alexandr...@gmail.com

unread,
Sep 20, 2021, 2:18:28 AM9/20/21
to sparselizardforum
Hi Arvind,

This is because a recent enough version of gcc is needed (this __libc_single_threaded was added in 2020 to gcc).

Solution:

1. Use an older version of the static library: http://www.sparselizard.org/staticlibs/linux64/sparselizard_linux64_staticlib_v202012.0.zip (from May this year)
2. Update your system

Could you please let me know if that older version works for you?

Alex

Arvind D

unread,
Sep 22, 2021, 1:14:04 PM9/22/21
to sparselizardforum
Hi Alex,

thanks for the solution. It indeed worked.

Arvind
Reply all
Reply to author
Forward
0 new messages