mardi 27 mars 2018

Fail compilation with FFTW3 library with g++-6.4.0 under cygwin

I have the following code from sigpack website

 #include "sigpack.h" 
 using namespace arma;
 using namespace sp;

int main()
{   
    int N = 45191;  // Large prime number
    FFTW ss(N,FFTW_ESTIMATE);
    vec x(N);
    cx_vec Sxx(N);

    vec P(N);
    clock_t tic;
    for (int n = 1; n < 5; n++)
    {
       x.randn();
       tic = clock();
       Sxx = ss.fft(x);
       cout << "FFTW Loop[" << n << "]. Time = " << (clock() - tic)/   
       double(CLOCKS_PER_SEC) << endl;
       x.randn();
       tic = clock();
       Sxx = fft(x);
       cout << " FFT Loop[" << n << "]. Time = " << (clock() - tic) /   
       double(CLOCKS_PER_SEC) << endl;
   }
  return 0;
}

I save it as exFFT1

when i build the file under cygwin with g++-6.4.0with command :

g++ -Wall -std=gnu++11 -I/home/budiarjo/sigpack-1.2.4/sigpack/ -I/usr/local/include/ -I/opt/OpenBLAS/include/ -L/opt/OpenBLAS/lib/ -L/usr/local/lib/ -DHAVE_FFTW -lblas -llapack -Dunix exFFT1.cpp -lfftw3 -o exFFT1

The following are the error messages : /tmp/ccRsp1Bf.o:exFFT1.cpp:(.text.startup+0x1cc): undefined reference to __emutls_v._ZN4arma23arma_rng_cxx11_instanceE' /tmp/ccRsp1Bf.o:exFFT1.cpp:(.text.startup+0x242): undefined reference to__emutls_v._ZN4arma23arma_rng_cxx11_instanceE' /tmp/ccRsp1Bf.o:exFFT1.cpp:(.text.startup+0x6db): undefined reference to __emutls_v._ZN4arma23arma_rng_cxx11_instanceE' /tmp/ccRsp1Bf.o:exFFT1.cpp:(.text.startup+0x752): undefined reference to__emutls_v._ZN4arma23arma_rng_cxx11_instanceE' /tmp/ccRsp1Bf.o:exFFT1.cpp:(.text.startup+0x1662): undefined reference to __emutls_v._ZN4arma23arma_rng_cxx11_instanceE' /tmp/ccRsp1Bf.o:exFFT1.cpp:(.text.startup+0x16f9): more undefined references to__emutls_v._ZN4arma23arma_rng_cxx11_instanceE' follow collect2: error: ld returned 1 exit status

But in raspberry pi with g++-4.8, when i build the file with the command sudo g++ -Wall -std=gnu++11 -I/home/pi/sigpack-1.2.4/sigpack/ -I/opt/OpenBLAS/include/ -L/opt/OpenBLAS/lib/ -DHAVE_FFTW -lopenblas -llapack -Dunix exFFT1.cpp -lfftw3 -o exFFT1

I could build successfully without any error messages.

What could be wrong with my cygwin setting. should I replace the g++-6.4.0 in cygwin with g++-4.80 ? How to downgrade it, since if I compile and do make, the g++-4.80 package, I would get error messages as well because of the usge of gcc/g++-6.40 during the process.

Aucun commentaire:

Enregistrer un commentaire