You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compilation fails on macOS 12 on Apple Silicon with "error: implicitly declaring library function 'finite'." Full error message below. The solution is apparently simple, "include the header <math.h> or explicitly provide a declaration for 'finite'", but I couldn't make this work, instead if I do:
sed -i -e 's@finite@isfinite@' src/levmar/compiler.h
But this is probably not appropriate as a general solution...
Then it compiles and runs.
:info:build /usr/bin/clang -DHAVE_CONFIG_H -I. -I../.. -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -pipe -Os -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch arm64 -MT lm.o -MD -MP -MF .deps/lm.Tpo -c -o lm.o lm.c :info:build In file included from lm.c:81: :info:build ./lm_core.c:206:7: error: implicitly declaring library function 'finite' with type 'int (double)' [-Werror,-Wimplicit-function-declaration] :info:build if(!LM_FINITE(p_eL2)) stop=7; :info:build ^ :info:build ./compiler.h:63:19: note: expanded from macro 'LM_FINITE' :info:build #define LM_FINITE finite // ICC, GCC :info:build ^ :info:build ./lm_core.c:206:7: note: include the header <math.h> or explicitly provide a declaration for 'finite' :info:build ./compiler.h:63:19: note: expanded from macro 'LM_FINITE' :info:build #define LM_FINITE finite // ICC, GCC :info:build ^ :info:build In file included from lmbc.c:84: :info:build ./lmbc_core.c:324:13: error: implicitly declaring library function 'finite' with type 'int (double)' [-Werror,-Wimplicit-function-declaration] :info:build if (!LM_FINITE(fpls)) { :info:build ^ :info:build ./compiler.h:63:19: note: expanded from macro 'LM_FINITE' :info:build #define LM_FINITE finite // ICC, GCC :info:build ^ :info:build ./lmbc_core.c:324:13: note: include the header <math.h> or explicitly provide a declaration for 'finite' :info:build ./compiler.h:63:19: note: expanded from macro 'LM_FINITE' :info:build #define LM_FINITE finite // ICC, GCC :info:build ^ :info:build 1 error generated. :info:build 1 error generated.
Best regards
John
The text was updated successfully, but these errors were encountered:
compiler.h uses obsolete macros which will be rejected by more and more compilers. The general solution is to add #include <math.h> in compiler.h and to replace finite by isfinite in the source code as suggested.
Good morning Emmanuel,
Compilation fails on macOS 12 on Apple Silicon with "error: implicitly declaring library function 'finite'." Full error message below. The solution is apparently simple, "include the header <math.h> or explicitly provide a declaration for 'finite'", but I couldn't make this work, instead if I do:
sed -i -e 's@finite@isfinite@' src/levmar/compiler.h
But this is probably not appropriate as a general solution...
Then it compiles and runs.
:info:build /usr/bin/clang -DHAVE_CONFIG_H -I. -I../.. -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -pipe -Os -I/opt/local/include -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch arm64 -MT lm.o -MD -MP -MF .deps/lm.Tpo -c -o lm.o lm.c :info:build In file included from lm.c:81: :info:build ./lm_core.c:206:7: error: implicitly declaring library function 'finite' with type 'int (double)' [-Werror,-Wimplicit-function-declaration] :info:build if(!LM_FINITE(p_eL2)) stop=7; :info:build ^ :info:build ./compiler.h:63:19: note: expanded from macro 'LM_FINITE' :info:build #define LM_FINITE finite // ICC, GCC :info:build ^ :info:build ./lm_core.c:206:7: note: include the header <math.h> or explicitly provide a declaration for 'finite' :info:build ./compiler.h:63:19: note: expanded from macro 'LM_FINITE' :info:build #define LM_FINITE finite // ICC, GCC :info:build ^ :info:build In file included from lmbc.c:84: :info:build ./lmbc_core.c:324:13: error: implicitly declaring library function 'finite' with type 'int (double)' [-Werror,-Wimplicit-function-declaration] :info:build if (!LM_FINITE(fpls)) { :info:build ^ :info:build ./compiler.h:63:19: note: expanded from macro 'LM_FINITE' :info:build #define LM_FINITE finite // ICC, GCC :info:build ^ :info:build ./lmbc_core.c:324:13: note: include the header <math.h> or explicitly provide a declaration for 'finite' :info:build ./compiler.h:63:19: note: expanded from macro 'LM_FINITE' :info:build #define LM_FINITE finite // ICC, GCC :info:build ^ :info:build 1 error generated. :info:build 1 error generated.
Best regards
John
The text was updated successfully, but these errors were encountered: