0

I downloaded and try to installed the package "wfconvert" from this link . but I got some error.

here what I did:

  1. copy the wfconvert folder in root "/"
  2. cd /wfconvert/build/

    root@geant4:/wfconvert/build# cmake ..
    
    -- Current revision : 65 modified on 2013-01-16 22:14:53 +0330 (Wed, 16 Jan 2013)  
    -- Found mpi.h and libraries. Check for working mpi compiler  
    -- MPI is disabled  
    -- Failed to link LAPACK, BLAS, ATLAS libraries with environments. Going to search standard paths.  
    -- LAPACK_LIBRARIES=/usr/lib/liblapack.so  
    -- BLAS_LIBRARIES=/usr/lib/libblas.so  
    -- CXX compiler flags:  -g -O3 -ftemplate-depth-60 -Drestrict=__restrict__ -funroll-all-loops   -finline-limit=1000 -Wno-deprecated  -mmmx -msse -msse2 -msse3 -fopenmp  
    -- CC  compiler flags:  -O3 -Drestrict=__restrict__ -funroll-all-loops   -finline-limit=1000 -std=gnu99 -fomit-frame-pointer  -mmmx -msse -msse2 -msse3  
    -- LIBXML2_INCLUDE_DIR=/usr/include/libxml2  
    -- LIBXML2_LIBRARIES=/usr/lib/libxml2.so  
    -- HDF5_INCLUDE_DIR=/usr/include  
    -- HDF5_LIBRARIES=/usr/lib/libhdf5.so  
    -- FFTW_INCLUDE_DIR=/usr/include  
    -- FFTW_LIBRARIES=/usr/lib/libfftw3.so  
    -- Ready to build qmcpack  
    -- Configuring done  
    -- Generating done  
    -- Build files have been written to: /wfconvert/build  
    
  3. make command

    root@geant4:/wfconvert/build# make
    
    [  1%] Building C object src/einspline/CMakeFiles/einspline.dir/bspline_create.c.o  
    In file included from /wfconvert/src/einspline/bspline_base.h:24:0,  
             from /wfconvert/src/einspline/bspline_create.h:24,  
             from /wfconvert/src/einspline/bspline_create.c:21:  
    /wfconvert/build/src/Common/config.h:65:17: fatal error: cmath: No such file or directory  
     #include <cmath> 
             ^
    compilation terminated.    
    make[2]: *** [src/einspline/CMakeFiles/einspline.dir/bspline_create.c.o] Error 1  
    make[1]: *** [src/einspline/CMakeFiles/einspline.dir/all] Error 2  
    make: *** [all] Error 2  
    

I don`t know what to do!
here is my cmath file list:

root@geant4:/# find -name cmath
./opt/root5.32.00/cint/cint/include/cmath
./app/gcc/4.8.0/include/c++/4.8.0/ext/cmath
./app/gcc/4.8.0/include/c++/4.8.0/cmath
./app/gcc/4.8.0/include/c++/4.8.0/tr1/cmath
./usr/include/boost/compatibility/cpp_c_headers/cmath
./usr/include/boost/tr1/tr1/cmath
./usr/include/c++/4.5/cmath
./usr/include/c++/4.5/tr1_impl/cmath
./usr/include/c++/4.5/tr1/cmath
./usr/include/c++/4.6/cmath
./usr/include/c++/4.6/tr1/cmath
./usr/share/gccxml-0.9/GCC/2.95/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/stage1-i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c_global/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/c_std/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/include/tr1/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/testsuite/26_numerics/headers/cmath
./gcc-build/gcc-4.8.0/libstdc++-v3/testsuite/tr1/8_c_compatibility/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/ext/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/cmath
./gcc-build/gcc-4.8.0/prev-i686-pc-linux-gnu/libstdc++-v3/include/tr1/cmath

and

root@geant4:/# uname -a
Linux geant4 3.0.0-32-generic-pae #51-Ubuntu SMP Thu Mar 21 16:09:48 UTC 2013 i686 i686 i386 GNU/Linux

Please help me.

Ravexina
  • 55,668
  • 25
  • 164
  • 183
alireza yousefi
  • 1
  • 1
  • 1
  • 1

3 Answers3

0

I would suspect corrupt installation of development tools or something like that. First thing I would do is re install build package

sudo apt-get purge build-essential
sudo apt-get install build-essential

If the problem still persists post it back

Just curious: How did you install GCC 4.8? I have 13.04 and it have 4.7.3 So that might be an issue if was not done properly!

  • I did your instruction but the problem did not solve. for installing gcc-4.8 refer to the link : http://askubuntu.com/questions/271388/how-to-install-gcc-4-8-in-ubuntu-12-04-from-the-terminal – alireza yousefi Jun 18 '13 at 07:41
  • Can you upload CmakeList.txt or screenshot of CMake GUI configurations? What happens if you cahnge line from to <cmath.h>? – Stefano Mtangoo Jun 18 '13 at 11:51
  • download the CmakeList.txt , and when I replace the <cmath> with <cmath.h> the error remain the same. – alireza yousefi Jun 19 '13 at 10:40
  • To convert C++ sources to C (or ancient C++), <cmath> should be replaced with <math.h> (no c which denotes C standard libraries used in C++). – Melebius Dec 06 '18 at 07:22
0

Is libm automatically linked too, while compiling ?

libm is for compiler g++ and is automatically linked. If you use gcc as compiler you need to link manually with math.h

I found this link here about different compilers generally :

https://stackoverflow.com/questions/1033898/why-do-you-have-to-link-the-math-library-in-c

By the way - there is http://boost.org

You could compile and include with boost-libraries too.

dschinn1001
  • 3,829
  • how can I linked manually to math.h – alireza yousefi Jun 18 '13 at 07:58
  • with gcc it looks this: gcc example.c -o example -lm for more precise compiling you do this: gcc -ggdb -Wall example.c -o example -lm – dschinn1001 Jun 18 '13 at 17:19
  • with gcc it looks this: gcc example.c -o example -lm for more precise compiling you do this: gcc -ggdb -Wall example.c -o example -lm (provided - there is: #include <math.h> at the beginning of example.c) – dschinn1001 Jun 18 '13 at 17:32
0

With gcc it looks this:

gcc example.c -o example -lm   

for more precise compiling (with debugging output in case of failures) you do this:

gcc -ggdb -Wall example.c -o example -lm

lm is here the linking with the math-library of gcc (there is #include math.h at the beginning of example.c).

Ravexina
  • 55,668
  • 25
  • 164
  • 183
dschinn1001
  • 3,829