Hi,
On a Get Start thread of this web site, it has a short NE10 example having such snippet:
I install NE10 library. In the documentation, it has a different definition:
ne10_result_t ne10_addc_float_neon (ne10_float32_t *dst, ne10_float32_t *src, const ne10_float32_t cst, ne10_uint32_t count) asm("ne10_addc_float_neon")
I am curious about the last "asm("ne10_addc_float_neon")". Could you tell me that?
Thanks,
Excuse me for the previous question. I find that it is caused by the generated documentation, which is wrong after I check the on-line documentation.
Now, I have a new question when I build another simple example from the right NE10 documentation:
int main()
{
ne10_result_t status;
printf ("Going to initialize NE10...\n");
status = ne10_init();
if (status != NE10_OK)
printf ("NE10 init failed.\n");
printf ("NE10 has been initialized.\n");
test_add1();
test_add2();
return 0;
}
I find that "
will cause build errors, such as:
robert@M5100:~/workspace_v5_5/NE10_testHardware0$ arm-linux-gnueabihf-gcc -O2 -o sample testHd.c -I$NE10_INC_PATH -l:$NE10_LIB_PATH/libNE10.a
/home/robert/projectNe10-Ne10-4167142/build/modules/libNE10.a(NE10_len.c.o): In function `ne10_len_vec2f_c':
NE10_len.c:(.text+0x5e): undefined reference to `sqrtf'
/home/robert/projectNe10-Ne10-4167142/build/modules/libNE10.a(NE10_len.c.o): In function `ne10_len_vec3f_c':
NE10_len.c:(.text+0xf4): undefined reference to `sqrtf'
/home/robert/projectNe10-Ne10-4167142/build/modules/libNE10.a(NE10_len.c.o): In function `ne10_len_vec4f_c':
NE10_len.c:(.text+0x18c): undefined reference to `sqrtf'
I have no idea on how to solve this. Please help me!
I would like to add more information about the problem.
First, the test .c file is from link:
Project Ne10: File List
Its path is:
/home/yang/NE10/NE10_github/Ne10_github_doc/Ne10/samples/NE10_test.c [code]
Second, it generates an error in test_add1 when compiling.
00046 void test_add1 (void)
00047 {
00048 int i;
00049 ne10_float32_t thesrc[5];
00050 ne10_float32_t thecst;
00051 ne10_float32_t thedst[5];
00052
00053 for (i = 0; i < 5; i++)
00054 {
00055 thesrc[i] = (ne10_float32_t) rand() / RAND_MAX * 5.0f;
00056 }
00057 thecst = (ne10_float32_t) rand() / RAND_MAX * 5.0f;
00058
00059 ne10_addc_float (thedst , thesrc, thecst, 5);
00060 }
00061
I have set up the include and library path in the IDE. It seems that it does understand ne10_addc_float in my environment. I originally thought it was a typo. After I changed that to ne10_addcfloat_c, it has the undefined reference errors.
I also have tried command line for building. It has the same errors.
Is there a way to check the included functions inside libNE10.a? I try nm with arm-linux-gnueabihf-nm, but it wants .out input file.
As the link: Ne10 Library Getting Started, I build NE10 library again with the following commands:
$mkdir build $cd build$cmake -DCMAKE_TOOLCHAIN_FILE=../config.cmake .. $make
The generated library is: libNE10.a. I build my project with commands:
$arm-linux-gnueabihf-ar-gcc –O2 -o sample sample.c -I$NE10_INC_PATH -l:$NE10_LIB_PATH/libNE10.a
The undefined reference problem is still there.
I find that the generated NE10_test_static can run at the target. After some search, I find NE10_test_static uses the following link command under folder (projectNe10-Ne10-4167142/build/samples/CMakeFiles/NE10_test_static.dir) :
It seems that it uses dynamic library. I have not found any way to generate static NE10 library with many options with (ON or OFF)
LD_LIBRARY_PATH=
Even after the library path variable is removed, the copied NE10_test_static and my project can run. That is, it does not use the hard drive libNE10.a. I am new to Linux and puzzled by the conflicting facts. I have attached the library, the static test applications and link file. Do you think on my drive libNE10.a is static or dynamic library? How to generate a static libNE10 library?
<robert@M5100:~/workspace_v5_5/NE10_testHardware0$ arm-linux-gnueabihf-gcc -O2 -o sample testHd.c -I$NE10_INC_PATH -l:$NE10_LIB_PATH/libNE10.a
<</home/robert/projectNe10-Ne10-4167142/build/modules/libNE10.a(NE10_len.c.o): In function `ne10_len_vec2f_c':<<NE10_len.c:(.text+0x5e): undefined reference to `sqrtf'<</home/robert/projectNe10-Ne10-4167142/build/modules/libNE10.a(NE10_len.c.o): In function `ne10_len_vec3f_c':<<NE10_len.c:(.text+0xf4): undefined reference to `sqrtf'<</home/robert/projectNe10-Ne10-4167142/build/modules/libNE10.a(NE10_len.c.o): In function `ne10_len_vec4f_c':<<NE10_len.c:(.text+0x18c): undefined reference to `sqrtf'<<I have no idea on how to solve this. Please help me!
you should add -lm when you compile your code
>I find that the generated NE10_test_static can run at the target. After some search, I find NE10_test_static uses the following link command under folder (projectNe10-Ne10-4167142/build/samples/CMakeFiles/NE10_test_static.dir) :
>It seems that it uses dynamic library. I have not found any way to generate static NE10 library with many options with (ON or OFF)
The command you supply is NOT using a dynamic library (refer here: http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html for more details about -rdynamic option), it is static linking. You can find related optiones at line 31 and 32 of Ne10 library's root CMakelists.txt (the top CMakelists.txt).
>Even after the library path variable is removed, the copied NE10_test_static and my project can run. That is, it does not use the hard drive libNE10.a. I am new to Linux and puzzled by the conflicting facts. I have attached the library, the static test applications and link file. Do you think on my drive libNE10.a is static or dynamic library? How to generate a static libNE10 library?
The libNE10.a is static library. *.a is static library under linux, refer more details: http://en.wikipedia.org/wiki/Static_library.