Fatal error on #include <vector>

1658 views
Skip to first unread message

Alexand...@uni.lu

unread,
Jan 12, 2018, 11:54:25 AM1/12/18
to linbox-use
Dear Linbox team,

After many unsucessful installation attempts (2 days, 4 machines with different versions of Linux Ubuntu), I finally found one where everything was compiled:

installing libopenblas-dev and libgmp6-dev beforehand, and then installing Givaro, Fflas-ffpack, Linbox versions of the same date (November 2017) as superuser into /usr/local/

However, when I want to load the library det.h mentioned in the linbox tutorial, I run into the fatal error
_________________________________________________________________________

In file included from /usr/local/include/linbox/blackbox/diagonal.h:47:0,
                 from /usr/local/include/linbox/solutions/det.h:33,

/usr/local/include/linbox/vector/vector-traits.h:49:33: fatal error: vector: No such file or directory
 #include <vector> // STL vectors
______________________________________________________________________     

Is this an installation error?

Best wishes,

Alexander Rahm

--
Dr. Alexander D. Rahm
Scientific researcher at Université du Luxembourg,
Mathematics Research Unit
http://math.uni.lu/~rahm

Riccardo Murri

unread,
Jan 12, 2018, 5:35:50 PM1/12/18
to linbo...@googlegroups.com
Dear Alexander,

> I run into the fatal error
> _________________________________________________________________________
>
> In file included from /usr/local/include/linbox/blackbox/diagonal.h:47:0,
> from /usr/local/include/linbox/solutions/det.h:33,
>
> /usr/local/include/linbox/vector/vector-traits.h:49:33: fatal error:
> vector: No such file or directory
> #include <vector> // STL vectors
> ______________________________________________________________________
>
> Is this an installation error?

No (at least, not an installation error of LinBox): the include file
`vector` is part of the C++ standard library, which usually is installed
alongside the C++ compiler.

If you're using Ubuntu or Debian GNU/Linux, make sure the package
`libstdc++-N-dev` is installed; the exact value of N should match the
major release number of the C++ compiler: e.g., if you're using GCC 7.x,
pick N=7.

Hope this helps,
Riccardo

--
Riccardo Murri / Email: riccard...@gmail.com / Tel.: +41 77 458 98 32

Alexand...@uni.lu

unread,
Jan 16, 2018, 4:22:53 AM1/16/18
to linbox-use
Dear Ricardo,

Thank you for this hint! It was very helpful.
Now I can read in the <vector> file, and all others (no more fatal errors).

This makes me arrive at a problem with Givaro: I get a magnitude of errors when trying to load the "det.h" header from the Linbox solutions library.
Feeding the following script "test1.c" into g++-7,
______________________________
#include <linbox/solutions/det.h>
#include <iostream>

int main()
{
  std::cout << "Hello World!" << std::endl;
  return 0;
}_______________________________

which now works fine when <linbox/solutions/det.h> is replaced by <vector>,
then after a few seconds of silence, I get a long error output which starts as follows:

 g++-7 -I /usr/local/linbox-1.5.1/  test1.c
/tmp/ccBTkrxW.o: In function `LinBox::BlasVector<Givaro::ZRing<Givaro::Integer>, std::vector<Givaro::Integer, std::allocator<Givaro::Integer> > >::magnitude() const':
test1.c:(.text+0x1e): undefined reference to `Givaro::Integer::Integer(int)'

Then it doesn't produce any compiled file.
Is this a known issue?

Best wishes,

Alexander

Riccardo Murri

unread,
Jan 18, 2018, 3:33:03 PM1/18/18
to linbo...@googlegroups.com
Dear Alexander,

> I get a long error output which starts
> as follows:
>
> g++-7 -I /usr/local/linbox-1.5.1/ test1.c
> /tmp/ccBTkrxW.o: In function
> `LinBox::BlasVector<Givaro::ZRing<Givaro::Integer>,
> std::vector<Givaro::Integer, std::allocator<Givaro::Integer> >
> >::magnitude() const':
> test1.c:(.text+0x1e): undefined reference to `Givaro::Integer::Integer(int)'
>
> Then it doesn't produce any compiled file.
> Is this a known issue?

You're missing the paths to the include files on the compiler command
line. GCC has a built-in list of directories where it looks for include
files (`/usr/include` and a few others which are
architecture-dependent), anything addition to that list must be given
with a `-I` option. I see you have added `/usr/local/linbox-1.5.1` but
perhaps Givaro is not installed there? Maybe you need to add
`-I/usr/local/givaro-X.Y.Z`?

Also, same goes for the linked-in libraries (one step after compiling):
you need to specify path and names of the needed libraries with options
`-L` and `-l` -- otherwise compilation will fail with an "unresolved
symbol" error.

Luckily, there is a small utility called `pkg-config` to help with this:
both Givaro and LinBox come with support files for `pkg-config` so (if
they're both correctly installed)) you can get the correct -I/-L/-l
incantations by running::

pkg-config --cflags --libs givaro
pkg-config --cflags --libs linbox

Hope this helps!

Alexand...@uni.lu

unread,
Jan 21, 2018, 6:21:18 AM1/21/18
to linbox-use
Dear Ricardo,

Thank you for this explanation!

Yes, in fact the pkg-config commands that you have given me, display the -I path and the -L path. Removing and re-installing givaro, fflas-ffpack and linbox into what was the -I path (namely, the /usr/local/include directory) does allow me to load them more easily.


My problem with givaro however persists:
With g++ version 6.3.0 and libstdc++6 version 7.2.0-1ubuntu1~16.04,

as well as with g++ version 5.4.0 and libstdc++5 version 1:3.3.6-28ubuntu1,

with g++ 4.8.5

or with g++-7 version 7.2.0-1ubuntu1~14.04 and libstdc++-7-dev,

also with all the options from the pkg-config output, namely compilation with the command
______________________________________

g++ -O2 -Wall -g -DNDEBUG -U_LB_DEBUG -DDISABLE_COMMENTATOR -fopenmp -std=gnu++11 -fabi-version=6 -std=gnu++11 -fabi-version=6 -I/usr/local/include -L/usr/local/lib -llinbox -fopenmp -lopenblas -lgivaro -lgmp -lgmpxx test1.c
______________________________________

as well as when I shorten this to
______________________________________

g++  -std=gnu++11 -I/usr/local/include -L/usr/local/lib  test1.c
______________________________________

in both cases, I get the the following output (after some seconds of processing each time)
______________________________________

/tmp/ccrsynD3.o: In function `LinBox::BlasVector<Givaro::ZRing<Givaro::Integer>, std::vector<Givaro::Integer, std::allocator<Givaro::Integer> > >::magnitude() const':
/usr/local/include/linbox/vector/blas-vector.h:646: undefined reference to `Givaro::Integer::Integer(int)'
/usr/local/include/linbox/vector/blas-vector.h:648: undefined reference to `Givaro::abs(Givaro::Integer const&)'

[... many more error messages like this ...]

/usr/local/include/givaro/modular-integer.inl:78: undefined reference to `Givaro::Integer::sub(Givaro::Integer&, Givaro::Integer const&, Givaro::Integer const&)'
collect2: error: ld returned 1 exit status
_____________________________________

Is there any linux distribution under which the linbox-auto-install.sh script is known to work?
I would then try to use that linux version rather than continuing my manual installation attempts.

Best wishes,

Alexander

Jean-Guillaume Dumas

unread,
Jan 22, 2018, 12:24:43 PM1/22/18
to linbo...@googlegroups.com
Alexand...@uni.lu wrote:
>
> _____________________________________
>
> Is there any linux distribution under which the linbox-auto-install.sh
> script is known to work?
> I would then try to use that linux version rather than continuing my
> manual installation attempts.

Hello, on many systems where gmp is installed (for instance debian-like), the following auto
install is working:

|./linbox-auto-install.sh --stable=yes |||--enable-openblas=yes| |

Can you try it and report the problems ?
Thank you, regards,


--
Jean-Guillaume Dumas.
____________________________________________________________________
Jean-Guill...@univ-grenoble-alpes.fr Tél.: +33 457 421 732
Professeur, Université Grenoble Alpes. Fax.: +33 457 421 828
Laboratoire Jean Kuntzmann, Mathématiques Appliquées et Informatique
700 avenue centrale, IMAG - CS 40700, 38058 GRENOBLE cedex 9, FRANCE
http://ljk.imag.fr/membres/Jean-Guillaume.Dumas
____________________________________________________________________

Alexand...@uni.lu

unread,
Jan 22, 2018, 2:27:15 PM1/22/18
to linbox-use
Dear Jean-Guillaume,

Thank you for these parameters for the script linbox-auto-install.sh.

Under Linux Ubuntu, the first issue of the script is the function decompress, because the shell does not accept the definition of functions. I can easily fix this error by deleting the function and replacing every instance of "decompress" by "tar -xzvf". Then the script apparently runs well, and concludes with the lines
_____________________________________

+ chmod +x ./autogen.status
+ autoreconf -vif .
./autogen.sh: 23: ./autogen.sh: autoreconf: not found
-e  * building LinBox...
make  CXXFLAGS+="" LDFLAGS+="-Wl,-rpath,/tmp"
make: *** No targets specified and no makefile found. Stop.
-e  * installing LinBox...
make: *** No rule to make target `install'. Stop.
-e  done !
 
-e  * Don't forget to run something like
-e  *   'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/lib'
-e  * to ensure you don't get undefined symbols !

-e  * Happy LinBoxing ! (installed in /tmp)
 
-e  done !
____________________________

I don't know how to constitute such a library path export command, already because linbox did not get installed in /tmp, but in /usr/local, from where I have run the script, and in the linbox directory, there is no folder lib anywhere in its subfolders. So I have used

 export LD_LIBRARY_PATH=/usr/local/lib

because that directory exists. But then even pkg-config does not know where linbox has been installed. Having deleted all linbox, givaro and fflas-ffpack files from /usr/local/lib, /usr/local/bin, /usr/local/include before running the auto-install script, pkg-config still displays me the parameters from my old installation, and then g++ does not find the linbox library files.
I can get them in with the option -I /usr/local/linbox, but then g++ still crashes on loading the fflas-ffpack library. It outputs
______________________________

/usr/local/linbox/linbox/linbox-config.h:30:46: fatal error: fflas-ffpack/fflas-ffpack-config.h: No such file or directory
 #include <fflas-ffpack/fflas-ffpack-config.h>
__________________________________

and this output only changes to
___________________________________

/usr/local/linbox/build/fflas-ffpack/fflas-ffpack/fflas-ffpack-config.h:89:33: fatal error: fflas-ffpack/config.h: No such file or directory
 #include "fflas-ffpack/config.h"
____________________________________

when I include -I /usr/local/linbox/build/fflas-ffpack, which is the only suitable path that my filesystem has.

Best,

Alexander

Jean-Guillaume Dumas

unread,
Jan 22, 2018, 4:48:28 PM1/22/18
to linbo...@googlegroups.com
Alexand...@uni.lu wrote:
> Dear Jean-Guillaume,
>
> Thank you for these parameters for the script linbox-auto-install.sh.
>
> Under Linux Ubuntu, the first issue of the script is the function
> decompress, because the shell does not accept the definition of
> functions. I can easily fix this error by deleting the function and
> replacing every instance of "decompress" by "tar -xzvf". Then the
> script apparently runs well, and concludes with the lines
> _____________________________________
>
> + chmod +x ./autogen.status
> + autoreconf -vif .
> ./autogen.sh: 23: ./autogen.sh: autoreconf: not found

Well that is strange because no autogen.sh is shipped with the stable
version ...
So are you using
https://raw.githubusercontent.com/linbox-team/linbox/master/linbox-auto-install.sh
and did you try a fresh install ?

Alexander D. Rahm

unread,
Jan 23, 2018, 1:12:39 PM1/23/18
to linbo...@googlegroups.com
Dear Jean-Guillaume,

Yes, also after downloading the version of which you sent me the link,

https://raw.githubusercontent.com/linbox-team/linbox/master/linbox-auto-install.sh

and having deleted all previously installed linbox files that I could
find, the script terminates (after replacing every instance of
"decompress" by "tar -xzvf") with the output lines
_________________________________

+ chmod +x ./autogen.status
+ autoreconf -vif .
./autogen.sh: 23: ./autogen.sh: autoreconf: not found
-e  * building LinBox...
make  CXXFLAGS+="" LDFLAGS+="-Wl,-rpath,/tmp"
make: *** No targets specified and no makefile found. Stop.
-e  * installing LinBox...
make: *** No rule to make target `install'. Stop.
-e  done !

-e  * Don't forget to run something like
-e  *   'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/lib'
-e  * to ensure you don't get undefined symbols !

-e  * Happy LinBoxing ! (installed in /tmp)
___________________________________________

Best wishes,

Alexander

Alexand...@uni.lu

unread,
Feb 28, 2018, 12:50:01 AM2/28/18
to linbox-use
Dear Linbox Team,

I have now installed linbox on the current Debian distribution, such that pkg-config finds the incantations for givaro and linbox. But using these incantations, a minimalistic dummy program which compiles correctly without the incantations, compiles to a crashing file with the incantations:

rahm@debian:~$pkg-config --cflags --libs givaro
rahm@debian:~$ g++ -fabi-version=6 -I/usr/local/include -L/usr/local/lib -lgivaro -lgmp -lgmpxx testblank.c
rahm@debian:~$ ./a.out
./a.out: error while loading shared libraries: libgivaro.so.9: cannot open shared object file: No such file or directory

The above dummy program "testblank.c" is just
______________________

#include <iostream>

int main()
{
  std::cout << "Hello World!" << std::endl;
  return 0;
}
_______________________

The file libgivaro.so.9 that is declared missing by the above error message, is however present at the path that the incantation -L/usr/local/lib feeds in: 

root@debian:/# find -name libgivaro.so.9
./usr/lib/givaro-4.0.4/src/.libs/libgivaro.so.9
./usr/local/lib/libgivaro.so.9

If I feed in the second copy of the file, via -L/usr/lib/givaro-4.0.4/src/.libs/ , then I get the same error message.
If I use the complete incantations for linbox, I get an analogous error at the linbox level:

rahm@debian:~$  pkg-config --cflags --libs linbox
-O2 -Wall -g -DNDEBUG -U_LB_DEBUG -DDISABLE_COMMENTATOR -fopenmp -fabi-version=6 -I/usr/local/include -L/usr/local/lib -llinbox -fopenmp -lopenblas -lgivaro -lgmp -lgmpxx
rahm@debian:~$ g++ -O2 -Wall -g -DNDEBUG -U_LB_DEBUG -DDISABLE_COMMENTATOR -fopenmp -fabi-version=6 -I/usr/local/include -L/usr/local/lib -llinbox -fopenmp -lopenblas -lgivaro -lgmp -lgmpxx testblank.c -o Test.out
rahm@debian:~$ ./Test.out
./Test.out: error while loading shared libraries: liblinbox.so.0: cannot open shared object file: No such file or directory

Please note also that using only the --cflags incantations, and not the --libs incantations, the dummy program is compiled correctly, but the compilation crashes when adding a call to a linbox library, e.g.,
#include <linbox/solutions/det.h>

Here are some details on my installation:

1.) After having replaced the function decompress
by tar -xf in the linbox-auto-install.sh file,
and having run
sudo apt-get install gcc
sudo apt-get install git-core
sudo apt-get install libopenblas-dev
the installation seems to work at first glance, except that at the end it does not find some files that seem to be important for fflas-ffpack:

""""""""""""""""""""""""""""""""""
./autogen.sh: 23: ./autogen.sh: autoreconf: not found
-e  * building Fflas-Ffpack...
make  CXXFLAGS+=""
linbox-auto-install.sh: 713: linbox-auto-install.sh: make: not found
-e  * installing Fflas-Ffpack...
linbox-auto-install.sh: 723: linbox-auto-install.sh: make: not found
""""""""""""""""""""""""""""""""""

2.) So it seems necessary to install manually GMP, then givaro, then fflas-ffpack, then linbox.

Having run
sudo apt-get install pkg-config
and installed GMP from
https://gmplib.org/manual/Installing-GMP.html#Installing-GMP
finally I got Givaro to be installed.
Then I did install fflas-ffpack with the manually installed openBlas:
root@debian:/usr/lib/fflas-ffpack-2.3.2# ./configure --with-blas-libs="-lopenblas"
make
make install
Then I did install linbox with the manually installed openBlas:
root@debian:/usr/lib/linbox-1.5.2#./configure --with-blas-libs="-lopenblas"
make
make install

Everything seemed to run well, except that the "make" command of linbox produced one warning,
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
make[3]: Entering directory '/usr/lib/linbox-1.5.2/benchmarks'
/bin/bash ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..  -I..  -O2   -Wall -g -DNDEBUG -U_LB_DEBUG   -DDISABLE_COMMENTATOR -DLinBoxSrcOnly  -fopenmp -fabi-version=6 -I/usr/local/include        -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -MT benchmark.lo -MD -MP -MF .deps/benchmark.Tpo -c -o benchmark.lo benchmark.C
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I.. -O2 -Wall -g -DNDEBUG -U_LB_DEBUG -DDISABLE_COMMENTATOR -DLinBoxSrcOnly -fopenmp -fabi-version=6 -I/usr/local/include -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -MT benchmark.lo -MD -MP -MF .deps/benchmark.Tpo -c benchmark.C  -fPIC -DPIC -o .libs/benchmark.o
In file included from benchmark.h:63:0,
                 from benchmark.C:36:
benchmark-metadata.h: In member function ‘void LinBox::MetaData::clean()’:
benchmark-metadata.h:58:4: warning: nonnull argument ‘this’ compared to NULL [-Wnonnull-compare]
    if (this != NULL) {
    ^~
libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -I.. -O2 -Wall -g -DNDEBUG -U_LB_DEBUG -DDISABLE_COMMENTATOR -DLinBoxSrcOnly -fopenmp -fabi-version=6 -I/usr/local/include -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -MT benchmark.lo -MD -MP -MF .deps/benchmark.Tpo -c benchmark.C -o benchmark.o >/dev/null 2>&1
mv -f .deps/benchmark.Tpo .deps/benchmark.Plo
/bin/bash ../libtool  --tag=CXX   --mode=link g++  -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx  -L/usr/local/lib -fopenmp -lopenblas -lgivaro -lgmp -lgmpxx   -o libbenchmarks.la  benchmark.lo ../linbox/liblinbox.la
libtool: link: ar cru .libs/libbenchmarks.a .libs/benchmark.o
ar: `u' modifier ignored since `D' is the default (see `U')
libtool: link: ranlib .libs/libbenchmarks.a
libtool: link: ( cd ".libs" && rm -f "libbenchmarks.la" && ln -s "../libbenchmarks.la" "libbenchmarks.la" )
"""""""""""""""""""""""""""""""""""""""""""""""

Is there a way to repair the installation / find incantations that work?

Or can you recommend me a Linux distribution on which it is known that Linbox can be installed without problems?

Best wishes,

Alexander

Reply all
Reply to author
Forward
0 new messages