projectNe10 / Ne10

An open optimized software library project for the ARM® Architecture
Other
1.46k stars 408 forks source link

FFT problem #217

Open whaoer opened 5 years ago

whaoer commented 5 years ago

ubuntu ThunderX

void N10mfccFFT(float frameSample, float FFTSample, int frameSize){

ne10_float32_t src[frameSize] = {};                   
ne10_fft_cpx_float32_t dst[(frameSize / 2) + 1] = {}; 
ne10_fft_r2c_cfg_float32_t cfg; 

if (ne10_init() != NE10_OK)
{
    fprintf(stderr, "Failed to initialise Ne10.\n");
}
cfg = ne10_fft_alloc_r2c_float32(frameSize);

for (int i = 0; i < frameSize; i++)
{
    src[i] = (ne10_float32_t)frameSample[i];
}

ne10_fft_r2c_1d_float32(dst, src, cfg);

for (int i = 0; i < frameSize; i++)
{
    printf( "IN[%2d]: %10.4f\t", i, src[i]);
    if (i <= frameSize / 2)
        printf("OUT[%2d]: %10.4f + %10.4fi", i, dst[i].r, dst[i].i);
    printf("\n");
}

ne10_fft_destroy_r2c_float32(cfg);

}

use g++ /tmp/ccSCIPxL.o: In function N10mfccFFT(float*, float*, int) [clone .constprop.9]': mfcc-xld.cpp:(.text+0xe0): undefined reference tone10_init' mfcc-xld.cpp:(.text+0x12c): undefined reference to ne10_fft_alloc_r2c_float32' mfcc-xld.cpp:(.text+0x1d8): undefined reference tone10_fft_r2c_1d_float32' mfcc-xld.cpp:(.text+0x1e0): undefined reference to ne10_fft_r2c_1d_float32' mfcc-xld.cpp:(.text+0x2f0): undefined reference tone10_fft_destroy_r2c_float32' /tmp/ccSCIPxL.o: In function N10mfccFFT(float*, float*, int)': mfcc-xld.cpp:(.text+0x7b0): undefined reference tone10_init' mfcc-xld.cpp:(.text+0x7fc): undefined reference to ne10_fft_alloc_r2c_float32' mfcc-xld.cpp:(.text+0x8a8): undefined reference tone10_fft_r2c_1d_float32' mfcc-xld.cpp:(.text+0x8b0): undefined reference to ne10_fft_r2c_1d_float32' mfcc-xld.cpp:(.text+0x9c0): undefined reference tone10_fft_destroy_r2c_float32' collect2: error: ld returned 1 exit status

How can I fix it?

mout551 commented 5 years ago

Hi, i have the same problem on my raspberry pi 3.

i compile NE10 library like this :

git clone https://github.com/projectNe10/Ne10
 cd Ne10/
 mkdir build
 cd build/
 export NE10_LINUX_TARGET_ARCH=armv7
 cmake -DGNULINUX_PLATFORM=ON -DNE10_LINUX_TARGET_ARCH=armv7 ..
 make

and now, i want to compile an simple test

#include <stdio.h>
#include <stdlib.h>
#include "NE10.h"

int main(void)
{
    ne10_float32_t src[SAMPLES] = {};                   
    ne10_fft_cpx_float32_t dst[(SAMPLES / 2) + 1] = {}; 
    ne10_fft_r2c_cfg_float32_t cfg;                    

    ne10_init();
    return 0;
}

with this command : sudo arm-linux-gnueabihf-gcc fft.c -o fft -I$NE10_INC_PATH -l:$NE10_LIB_PATH/libNE10.a -lm

but i have some mistakes :

/tmp/ccwEIfMb.o : Dans la fonction « main » : fft.c:(.text+0x3c) : référence indéfinie vers « ne10_init » collect2: error: ld returned 1 exit status

any ideas ? Erwan.