Доброго времени суток.
Не получается собрать clang’ом, на win7+gcc то же самое собирается без проблем. Другие функции из math.h кроме powf(), powl() вызываются исправно. В чём может быть причина? Заранее спасибо.
#include <stdio.h>
#include <math.h>
int main(int argc, char *argv[]) {
printf("%.f\n", pow(2, 3));
return(0);
}
$ clang -v ./test.c -o ./test.o
OpenBSD clang version 11.1.0
Target: i386-unknown-openbsd7.0
Thread model: posix
InstalledDir: /usr/bin
"/usr/bin/clang" -cc1 -triple i386-unknown-openbsd7.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name test.c -mrelocation-model pic -pic-level 1 -pic-is-pie -mframe-pointer=all -relaxed-aliasing -fno-rounding-math -mconstructor-aliases -target-cpu i586 -fno-split-dwarf-inlining -debugger-tuning=gdb -v -resource-dir /usr/lib/clang/11.1.0 -internal-isystem /usr/lib/clang/11.1.0/include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/red13/coding/c_lang -ferror-limit 19 -fwrapv -stack-protector 2 -fgnuc-version=4.2.1 -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-valloc -fno-builtin-free -fno-builtin-strdup -fno-builtin-strndup -faddrsig -o /tmp/test-2c44c5.o -x c ./test.c
clang -cc1 version 11.1.0 based upon LLVM 11.1.0 default target i386-unknown-openbsd7.0
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/clang/11.1.0/include
/usr/include
End of search list.
"/usr/bin/ld" -e __start --eh-frame-hdr -Bdynamic -dynamic-linker /usr/libexec/ld.so -o ./test.o /usr/lib/crt0.o /usr/lib/crtbegin.o -L/usr/lib /tmp/test-2c44c5.o -lcompiler_rt -lc -lcompiler_rt /usr/lib/crtend.o
ld: error: undefined symbol: pow
>>> referenced by test.c
>>> /tmp/test-2c44c5.o:(main)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
$ ls -lh /usr/include/math.h
-r--r--r-- 1 root bin 12.5K Oct 13 10:47 /usr/include/math.h
$ cat /usr/include/math.h | grep pow
double pow(double, double);
float powf(float, float);
long double powl(long double, long double);