What-I-am-doing for compiling DBASE.C for Lua - lua

friend.
I need instructions for compiling this utility. But I can not find info.
My current scenario is Win7, Lua 5.1 (because it is installed in my machine by my son, but later I'll try with Lua v5.3.## current).
I have seen on a txt file this command:
gcc string.c dbf_head.c dbf_ndx.c dbf_misc.c dbf_rec.c luadbase.c -shared -O2 -Wall -L/usr/local/lib -llua -ldl -lm -lnsl -o dbase.so
As I understand that /usr/local/lib is a Linux dir, then I change it for ./
I consider that this means that I will look for libraries in the directory I write: in my case I say it that the libraries is in the same dir. http://iie.fing.edu.uy/~vagonbar/gcc-make/gcc.htm
First try:
I create make_win.bat with this content (see the .DLL extension):
gcc string.c dbf_head.c dbf_ndx.c dbf_misc.c dbf_rec.c luadbase.c
-shared -O2 -Wall -L./ -llua -ldl -lm -lnsl -o dbase.dll
D:\lua-dbase-compiling>make_win
D:\lua-dbase-compiling>gcc string.c dbf_head.c dbf_ndx.c dbf_misc.c dbf_rec.c lu
adbase.c -shared -O2 -Wall -L./ -llua -ldl -lm -lnsl -o dbase.dll
dbf_rec.c: In function 'pack_dbf':
dbf_rec.c:131: warning: implicit declaration of function 'ftruncate'
luadbase.c:20:17: error: lua.h: No such file or directory
luadbase.c:21:21: error: lauxlib.h: No such file or directory
luadbase.c:23:24: error: compat-5.1.h: No such file or directory
luadbase.c:48: error: expected ')' before '*' token
luadbase.c:49: error: expected ')' before '*' token
luadbase.c:50: error: expected ')' before '*' token
luadbase.c:56: error: expected ')' before '*' token
luadbase.c:67: error: expected ')' before '*' token
luadbase.c:77: error: expected ')' before '*' token
luadbase.c:85: error: expected ')' before '*' token
luadbase.c:113: error: expected ')' before '*' token
luadbase.c:120: error: expected ')' before '*' token
luadbase.c:141: error: expected ')' before '*' token
luadbase.c:146: error: expected ')' before '*' token
luadbase.c:151: error: expected ')' before '*' token
luadbase.c:160: error: expected ')' before '*' token
luadbase.c:231: error: expected ')' before '*' token
luadbase.c:398: error: expected ')' before '*' token
luadbase.c:402: error: expected ')' before '*' token
luadbase.c:406: error: expected ')' before '*' token
luadbase.c:428: error: expected ')' before '*' token
luadbase.c:501: error: expected ')' before '*' token
luadbase.c:686: error: expected ')' before '*' token
luadbase.c:700: error: expected ')' before '*' token
luadbase.c:709: error: expected ')' before '*' token
As it it saying that cannot find three files: lua.h, lauxlib.h and compat-5.1.h, then I look for them in m PC. I find them, then copy'em to the dir where I have the sources for DBASE.DLL .
Second try:
I run make_win.bat with this same content as the first try.
I got a long list of error and warnings. The several first --as you can see in next lines-- indicates me that it could not find the three files I copy.
D:\lua-dbase-compiling>make_win
D:\lua-dbase-compiling>gcc string.c dbf_head.c dbf_ndx.c dbf_misc.c dbf_rec.c lu
adbase.c -shared -O2 -Wall -L./ -llua -ldl -lm -lnsl -o dbase.dll
dbf_rec.c: In function 'pack_dbf':
dbf_rec.c:131: warning: implicit declaration of function 'ftruncate'
In file included from luadbase.c:20:
lua.h:16:21: error: luaconf.h: No such file or directory
In file included from luadbase.c:20:
lua.h:99: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'lua_Nu
mber'
lua.h:103: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'lua_I
nteger'
lua.h:110: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'lua_S
tate'
lua.h:111: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
In file included from luadbase.c:21:
lauxlib.h:42: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'vo
id'
lauxlib.h:44: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'vo
id'
lauxlib.h:46: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'in
t'
lauxlib.h:47: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'in
t'
luadbase.c: In function 'luaM_tostring':
luadbase.c:58: warning: implicit declaration of function 'lua_touserdata'
luadbase.c:63: warning: implicit declaration of function 'lua_pushfstring'
luadbase.c:63: warning: implicit declaration of function 'lua_tolstring'
luadbase.c: In function 'luaM_regconst':
luadbase.c:68: warning: implicit declaration of function 'lua_pushstring'
luadbase.c:69: warning: implicit declaration of function 'lua_pushnumber'
luadbase.c:70: warning: implicit declaration of function 'lua_rawset'
luadbase.c: In function 'luaM_setmeta':
luadbase.c:78: warning: implicit declaration of function 'lua_getfield'
Then I decided to copy all the sources of Lua v.5.1.4 and the some more for compat-5.1 (that are not in the same sources).
Third try:
I run make_win.bat with this same content as the first and second try.
The error were a few, in just seven lines.
D:\lua-dbase-compiling>gcc string.c dbf_head.c dbf_ndx.c dbf_misc.c dbf_rec.c lu
adbase.c -shared -O2 -Wall -L./ -llua -ldl -lm -lnsl -o dbase.dll
dbf_rec.c: In function 'pack_dbf':
dbf_rec.c:131: warning: implicit declaration of function 'ftruncate'
ld: cannot find -llua
ld: cannot find -ldl
ld: cannot find -lnsl
As I am not an expert C programmer, I decided to supress this three arguments: -llua -ldl -lnsl in the runable sentence.
Forth try:
Now the sentence is:
gcc string.c dbf_head.c dbf_ndx.c dbf_misc.c dbf_rec.c luadbase.c -shared -O2 -Wall -L./ -lm -o dbase.dll
I got a lot of errors. I got no the first lines:
C:\Users\user\AppData\Local\Temp\ccwaAh3E.o:luadbase.c:(.text+0x1f8): undefined
reference to `lua_tolstring'
C:\Users\user\AppData\Local\Temp\ccwaAh3E.o:luadbase.c:(.text+0x210): undefined
reference to lua_tolstring'
C:\Users\user\AppData\Local\Temp\ccwaAh3E.o:luadbase.c:(.text+0x220): undefined
reference tolua_rawset'
C:\Users\user\AppData\Local\Temp\ccwaAh3E.o:luadbase.c:(.text+0x230): undefined
reference to lua_settop'
C:\Users\user\AppData\Local\Temp\ccwaAh3E.o:luadbase.c:(.text+0x240): undefined
reference tolua_next'
C:\Users\user\AppData\Local\Temp\ccwaAh3E.o:luadbase.c:(.text+0x254): undefined
reference to lua_settop'
C:\Users\user\AppData\Local\Temp\ccwaAh3E.o:luadbase.c:(.text+0x264): undefined
reference tolua_objlen'
C:\Users\user\AppData\Local\Temp\ccwaAh3E.o:luadbase.c:(.text+0x27e): undefined
reference to lua_pushboolean'
C:\Users\user\AppData\Local\Temp\ccwaAh3E.o:luadbase.c:(.text+0x28e): undefined
reference tolua_pushstring'
C:\Users\user\AppData\Local\Temp\ccwaAh3E.o:luadbase.c:(.text+0x2ac): undefined
reference to lua_tonumber'
C:\Users\user\AppData\Local\Temp\ccwaAh3E.o:luadbase.c:(.text+0x2bf): undefined
reference tolua_settop'
C:\Users\user\AppData\Local\Temp\ccwaAh3E.o:luadbase.c:(.text+0x31b): undefined
reference to `lua_rawgeti'
C:\Users\user\AppData\Local\Temp\ccwaAh3E.o:luadbase.c:(.text+0x336): undefined
I do not understand.
I do not see any DLL in the directory.
I do not know how to proceed.
Any help would be appreciated.
Thanks for reading this question.
HERNAN CANO M.

Related

Unable to build library for iOS (arm) because SSE, AVX, etc flags get set by configure, libtool

I'm trying to get Tesseract to build for iOS (and macOS) but am running into errors when building for the arm-apple-darwin64 target.
Here's the Makefile.
The configure commands are run with this command:
./configure --host=arm-apple-darwin64 --prefix=`pwd` --enable-shared=no --disable-graphics
and then the make command is run with this:
make -sj8
However, I'm getting errors about SSE, AVX, and similar. I can see in the libtool command that's being run that some flags including -DAVX, -DAVX2, -DSSE4_1, etc are being set, but I don't think they should be for the arm-apple-darwin64 target, as far as I know.
Any ideas as to what I'm doing wrong? What makes it more confusing is that this exact Makefile used to work for me just fine, but it has started to fail me just recently and I can't think what's changed.
This is (most of) the error output (it was too large to copy and paste in its entirety):
cd /Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64 && /Applications/Xcode.app/Contents/Developer/usr/bin/make -sj8 && /Applications/Xcode.app/Contents/Developer/usr/bin/make install
Making all in src/arch
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -msse4.1 -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++14 -MT libtesseract_sse_la-intsimdmatrixsse.lo -MD -MP -MF .deps/libtesseract_sse_la-intsimdmatrixsse.Tpo -c ../../../../src/arch/intsimdmatrixsse.cpp -o libtesseract_sse_la-intsimdmatrixsse.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -mavx -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++14 -MT libtesseract_avx_la-dotproductavx.lo -MD -MP -MF .deps/libtesseract_avx_la-dotproductavx.Tpo -c ../../../../src/arch/dotproductavx.cpp -o libtesseract_avx_la-dotproductavx.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -mavx2 -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++14 -MT libtesseract_avx2_la-intsimdmatrixavx2.lo -MD -MP -MF .deps/libtesseract_avx2_la-intsimdmatrixavx2.Tpo -c ../../../../src/arch/intsimdmatrixavx2.cpp -o libtesseract_avx2_la-intsimdmatrixavx2.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -msse4.1 -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++14 -MT libtesseract_sse_la-dotproductsse.lo -MD -MP -MF .deps/libtesseract_sse_la-dotproductsse.Tpo -c ../../../../src/arch/dotproductsse.cpp -o libtesseract_sse_la-dotproductsse.o
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../../src/arch -I../.. -DNDEBUG -I../../../../src/ccstruct -I../../../../src/ccutil -I../../../../src/viewer -DAVX -DAVX2 -DSSE4_1 -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -fembed-bitcode -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/leptonica/ios/arm-apple-darwin64/include/leptonica -I/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/tesseract-ocr/ios/arm-apple-darwin64/ -L/Users/ham/projects/swift/Tesseract-OCR-iOS/TesseractOCR/ios/lib -Qunused-arguments -arch arm64 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -miphoneos-version-min=10.0 -O2 -Wno-deprecated-register -std=c++14 -MT libtesseract_arch_la-simddetect.lo -MD -MP -MF .deps/libtesseract_arch_la-simddetect.Tpo -c ../../../../src/arch/simddetect.cpp -o libtesseract_arch_la-simddetect.o
../../../../src/arch/dotproductavx.cpp:20:2: error: Implementation only for AVX capable architectures
../../../../src/arch/dotproductsse.cpp:19:../../../../src/arch/intsimdmatrixsse.cpp2:: 19:error2: : Implementationerror : only for SSE 4.1Implementation capableonly architecturesfor#error Implementation only for AVX capable architectures
SSE 4.1 capable ^architectures
#error Implementation only for SSE 4.1 capable architectures
^
../../../../src/arch/intsimdmatrixavx2.cpp:20:2: error: Implementation only for #error Implementation only for SSE 4.1 capable architecturesAVX2
capable architectures
^
#error Implementation only for AVX2 capable architectures
^
In file included from ../../../../src/arch/dotproductavx.cpp:23:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/immintrin.h:28:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
__builtin_ia32_emms();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:5: note: '__builtin_isless' declared here
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:25: error: too few arguments to function call, expected 2, have 0
__builtin_ia32_emms();
^
In file included from ../../../../src/arch/dotproductsse.cpp:22:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/emmintrin.h:27:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/xmmintrin.h:27:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
__builtin_ia32_emms();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:5: note: '__builtin_isless' declared here
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:25: error: too few arguments to function call, expected 2, have 0
__builtin_ia32_emms();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:64:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:64:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:81:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:81:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:143:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:143:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:173:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:173:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:203:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:203:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:230:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:230:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:253:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:253:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:274:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:274:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:301:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:301:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:324:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:324:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:345:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:345:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:366:19: error: use of undeclared identifier '__builtin_ia32_paddb'
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:387:19: error: use of undeclared identifier '__builtin_ia32_paddw'
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h ^:
366:19: error: use of undeclared identifier '__builtin_ia32_paddb'
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:408:19: error: use of undeclared identifier '__builtin_ia32_paddd'
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:387:19: error: use of undeclared identifier '__builtin_ia32_paddw'
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:430:19: error: use of undeclared identifier '__builtin_ia32_paddsb'
return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:408:19: error: use of undeclared identifier '__builtin_ia32_paddd'
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:453:19: error: use of undeclared identifier '__builtin_ia32_paddsw'
return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:430:19: error: use of undeclared identifier '__builtin_ia32_paddsb'
return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:453:19: error: use of undeclared identifier '__builtin_ia32_paddsw'
return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[5]: *** [libtesseract_sse_la-dotproductsse.lo] Error 1
make[5]: *** Waiting for unfinished jobs....
In file included from ../../../../src/arch/intsimdmatrixsse.cpp:25:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/emmintrin.h:27:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/xmmintrin.h:27:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
__builtin_ia32_emms();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:5: note: '__builtin_isless' declared here
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:25: error: too few arguments to function call, expected 2, have 0
__builtin_ia32_emms();
^
In file included from ../../../../src/arch/intsimdmatrixavx2.cpp:25:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/immintrin.h:28:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
__builtin_ia32_emms();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:5: note: '__builtin_isless' declared here
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:47:25: error: too few arguments to function call, expected 2, have 0
__builtin_ia32_emms();
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:64:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:64:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:81:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:81:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:143:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:143:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:173:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:173:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:203:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:203:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:230:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:230:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:253:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:253:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:274:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:274:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
^
20 errors generated.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:301:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:301:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:324:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:324:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:345:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
^
make[5]: *** [libtesseract_avx_la-dotproductavx.lo] Error 1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:345:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:366:19: error: use of undeclared identifier '__builtin_ia32_paddb'
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:366:19: error: use of undeclared identifier '__builtin_ia32_paddb'
return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:387:19: error: use of undeclared identifier '__builtin_ia32_paddw'
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:387:19: error: use of undeclared identifier '__builtin_ia32_paddw'
return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:408:19: error: use of undeclared identifier '__builtin_ia32_paddd'
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:408:19: error: use of undeclared identifier '__builtin_ia32_paddd'
return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/mmintrin.h:430:19: error: use of undeclared identifier '__builtin_ia32_paddsb'
return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
^
...
5 errors generated.

undefined reference to `LLVMLinkInInterpreter'

I'm trying to compile fibonacci.cpp from llvm's examples to test llvm 3.8 (installed from repo) on my system (4.6.4-1-ARCH)
I get the following error. I dug around to see what's missing in llvm-config parameters but I wasn't lucky.
Below, I provide the command run and its output:
[drunk#teapot LLVMPlayBox]$ clang++ fibonacci.cpp `llvm-config --cxxflags --ldflags --libs --system-libs engine` -o fibonacci
warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option]
1 warning generated.
/tmp/fibonacci-34ba2b.o: In function `_GLOBAL__sub_I_fibonacci.cpp':
fibonacci.cpp:(.text.startup+0x1): undefined reference to `LLVMLinkInInterpreter'
clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)`
I also used -v to see more details but skipping most of it since it's lengthy:
....
1 warning generated.
"/usr/bin/ld" --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o fibonacci /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../lib64/crt1.o /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../lib64/crti.o /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/crtbegin.o -L/usr/lib -L/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1 -L/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../lib64 -L/usr/bin/../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../.. -L/usr/bin/../lib -L/lib -L/usr/lib /tmp/fibonacci-5ea4ee.o -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMInstrumentation -lLLVMProfileData -lLLVMTransformUtils -lLLVMBitWriter -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMExecutionEngine -lLLVMTarget -lLLVMAnalysis -lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMMC -lLLVMCore -lLLVMSupport -lrt -ldl -lcurses -lpthread -lz -lm -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/crtend.o /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/6.1.1/../../../../lib64/crtn.o
/tmp/fibonacci-5ea4ee.o: In function `_GLOBAL__sub_I_fibonacci.cpp':
fibonacci.cpp:(.text.startup+0x1): undefined reference to `LLVMLinkInInterpreter'
clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)`
Edit:
I tried as suggested but I got more errors now.
clang++ `llvm-config --cxxflags --ldflags --system-libs --libs engine interpreter` fibonacci.cpp -o fibonacci
warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option]
1 warning generated.
/usr/lib/libLLVMInterpreter.a(ExternalFunctions.cpp.o): In function `llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>)':
(.text._ZN4llvm11Interpreter20callExternalFunctionEPNS_8FunctionENS_8ArrayRefINS_12GenericValueEEE+0x333): undefined reference to `ffi_type_pointer'
/usr/lib/libLLVMInterpreter.a(ExternalFunctions.cpp.o): In function `llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>)':
(.text._ZN4llvm11Interpreter20callExternalFunctionEPNS_8FunctionENS_8ArrayRefINS_12GenericValueEEE+0x386): undefined reference to `ffi_type_sint64'
/usr/lib/libLLVMInterpreter.a(ExternalFunctions.cpp.o): In function `llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>)':
(.text._ZN4llvm11Interpreter20callExternalFunctionEPNS_8FunctionENS_8ArrayRefINS_12GenericValueEEE+0x397): undefined reference to `ffi_type_sint32'
/usr/lib/libLLVMInterpreter.a(ExternalFunctions.cpp.o): In function
.......
(.text._ZN4llvm11Interpreter20callExternalFunctionEPNS_8FunctionENS_8ArrayRefINS_12GenericValueEEE+0xd52): undefined reference to `ffi_type_sint64'
/usr/lib/libLLVMInterpreter.a(ExternalFunctions.cpp.o): In function `llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>)':
(.text._ZN4llvm11Interpreter20callExternalFunctionEPNS_8FunctionENS_8ArrayRefINS_12GenericValueEEE+0xd5e): undefined reference to `ffi_type_double'
/usr/lib/libLLVMInterpreter.a(ExternalFunctions.cpp.o): In function `llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>)':
(.text._ZN4llvm11Interpreter20callExternalFunctionEPNS_8FunctionENS_8ArrayRefINS_12GenericValueEEE+0xd6a): undefined reference to `ffi_type_sint32'
/usr/lib/libLLVMInterpreter.a(ExternalFunctions.cpp.o): In function `llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>)':
(.text._ZN4llvm11Interpreter20callExternalFunctionEPNS_8FunctionENS_8ArrayRefINS_12GenericValueEEE+0xd7b): undefined reference to `ffi_type_sint8'
/usr/lib/libLLVMInterpreter.a(ExternalFunctions.cpp.o): In function `llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>)':
(.text._ZN4llvm11Interpreter20callExternalFunctionEPNS_8FunctionENS_8ArrayRefINS_12GenericValueEEE+0xd87): undefined reference to `ffi_type_sint16'
/usr/lib/libLLVMInterpreter.a(ExternalFunctions.cpp.o): In function `llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>)':
(.text._ZN4llvm11Interpreter20callExternalFunctionEPNS_8FunctionENS_8ArrayRefINS_12GenericValueEEE+0xd93): undefined reference to `ffi_type_float'
/usr/lib/libLLVMInterpreter.a(ExternalFunctions.cpp.o): In function
.....
(.text._ZN4llvm11Interpreter20callExternalFunctionEPNS_8FunctionENS_8ArrayRefINS_12GenericValueEEE+0x1368): undefined reference to `ffi_type_float'
/usr/lib/libLLVMInterpreter.a(ExternalFunctions.cpp.o): In function `llvm::Interpreter::callExternalFunction(llvm::Function*, llvm::ArrayRef<llvm::GenericValue>)':
(.text._ZN4llvm11Interpreter20callExternalFunctionEPNS_8FunctionENS_8ArrayRefINS_12GenericValueEEE+0x1374): undefined reference to `ffi_type_void'
clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)
Edit #2:
I added -lffi as suggested and it worked. So the command issued is:
clang++ fibonacci.cpp `llvm-config --cxxflags --ldflags --system-libs --libs engine interpreter ` -lffi -o fibonacci
LLVMLinkInInterpreter is part of libLLVMInterpreter, which is not included in your llvm-config command. To fix the problem you simply need to extend your build script as following:
llvm-config --cxxflags --ldflags --system-libs --libs engine interpreter
Notice --libs interpreter at the end.

Problems Building GMP using iOS SDK 8.3

I can't build GMP for iOS -arch armv7s no matter how I configure make. First, configure wasn't finding a c compiler, then I got past the configure stage with this : ./configure CC=clang CPP="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -E" CPPFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/ -miphoneos-version-min=8.0 -arch armv7s -target arm-apple-darwin" --host=aarch64-apple-darwin --disable-assembly --enable-static --disable-shared
Afterwards, make runs for a little bit, then quits with this :
libtool: compile: clang -DHAVE_CONFIG_H -I. -I.. -D__GMP_WITHIN_GMP -I.. -DOPERATION_div_qr_1n_pi1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/ -miphoneos-version-min=8.0 -arch armv7s -target arm-apple-darwin -O2 -pedantic -DNO_ASM -c div_qr_1n_pi1.c -o div_qr_1n_pi1.o
div_qr_1n_pi1.c:218:3: error: expected ')'
add_mssaaaa (u2, u1, u0, u0, up[n-2], p1, p0);
^
div_qr_1n_pi1.c:140:49: note: expanded from macro 'add_mssaaaa'
: "r" (ah), "rI" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC)
^
div_qr_1n_pi1.c:218:3: note: to match this '('
div_qr_1n_pi1.c:135:11: note: expanded from macro 'add_mssaaaa'
__asm__ ( "adds %2, %5, %6\n\t" \
^
div_qr_1n_pi1.c:256:7: error: expected ')'
add_mssaaaa (u2, u1, u0, u0, up[j], p1, p0);
^
div_qr_1n_pi1.c:140:49: note: expanded from macro 'add_mssaaaa'
: "r" (ah), "rI" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC)
^
div_qr_1n_pi1.c:256:7: note: to match this '('
div_qr_1n_pi1.c:135:11: note: expanded from macro 'add_mssaaaa'
__asm__ ( "adds %2, %5, %6\n\t" \
^
2 errors generated.
make[2]: *** [div_qr_1n_pi1.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Does anyone have any idea how to fix this? I can compile gmp for x86 on my mac without a single problem.
This issue was fixed a few months ago. Sadly, it isn't available in an official release yet, but you can get a snapshot from https://gmplib.org/download/snapshot/ .

Error installing atomic JDK8 required?

I read Error Installing Atomic.
But my problem is different:
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/pills/.rvm/rubies/ruby-1.9.3-p448/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/lib
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/pills/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
from /Users/pills/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/mkmf.rb:712:in `try_run'
from extconf.rb:26:in `<main>'
From atomic web page I read that atomic requires JDK8, I installed it, I am in OS X 10.9.
Some other useful information:
$ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
$ /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/java -version
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b114)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b56, mixed mode)
How should I reference JDK8 when installing this gem? is that the issue?
More useful output?
cat /Users/pills/.rvm/gems/ruby-1.9.3-p448/gems/atomic-1.1.14/ext/mkmf.log
"/usr/local/bin/gcc-4.2 -o conftest -I/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/x86_64-darwin12.4.0 -I/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/backward -I/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -fno-common -pipe conftest.c -L. -L/Users/pills/.rvm/rubies/ruby-1.9.3-p448/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -lruby.1.9.1 -lpthread -ldl -lobjc "
In file included from /Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby.h:32,
from conftest.c:1:
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/ruby.h:48:21: error: string.h: No such file or directory
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/ruby.h:58:21: error: stdint.h: No such file or directory
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/ruby.h:61:23: error: inttypes.h: No such file or directory
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/ruby.h:65:19: error: stdio.h: No such file or directory
In file included from /Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/ruby.h:67,
from /Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby.h:32,
from conftest.c:1:
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/defines.h:29:21: error: stdlib.h: No such file or directory
In file included from /Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby.h:32,
from conftest.c:1:
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/ruby.h:74:20: error: alloca.h: No such file or directory
In file included from /Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/ruby.h:178,
from /Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby.h:32,
from conftest.c:1:
/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/../lib/gcc/i686-apple-darwin11/4.2.1/include/limits.h:10:25: error: limits.h: No such file or directory
In file included from /Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/ruby.h:1383,
from /Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby.h:32,
from conftest.c:1:
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:36:23: error: sys/types.h: No such file or directory
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:40:22: error: sys/time.h: No such file or directory
In file included from /Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:43,
from /Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/ruby.h:1383,
from /Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby.h:32,
from conftest.c:1:
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/st.h:130: error: expected declaration specifiers or '...' before 'uint32_t'
In file included from /Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/ruby.h:1383,
from /Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby.h:32,
from conftest.c:1:
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:294: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rb_fdset_t'
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:389: error: expected declaration specifiers or '...' before 'fd_set'
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:389: error: expected declaration specifiers or '...' before 'fd_set'
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:389: error: expected declaration specifiers or '...' before 'fd_set'
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:389: warning: 'struct timeval' declared inside parameter list
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:389: warning: its scope is only this definition or declaration, which is probably not what you want
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:390: error: expected declaration specifiers or '...' before 'rb_fdset_t'
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:390: error: expected declaration specifiers or '...' before 'rb_fdset_t'
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:390: error: expected declaration specifiers or '...' before 'rb_fdset_t'
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:390: warning: 'struct timeval' declared inside parameter list
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:391: warning: 'struct timeval' declared inside parameter list
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:563: error: expected declaration specifiers or '...' before 'pid_t'
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:581: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rb_fork'
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:582: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rb_fork_err'
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:584: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rb_waitpid'
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:585: error: expected ')' before 'pid'
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:586: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rb_spawn'
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:587: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rb_spawn_err'
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:589: error: expected ')' before 'pid'
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:708: error: expected declaration specifiers or '...' before 'uint32_t'
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:833: error: expected ')' before 'long'
/Users/pills/.rvm/rubies/ruby-1.9.3-p448/include/ruby-1.9.1/ruby/intern.h:834: error: expected ')' before 'long'
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
I did not require JDK8, I did:
xcode-select --install
gem install atomic -v '1.1.14
And it worked.

unable to compile ffmpeg for iOS

I'm trying to compile FFmpeg for iOS (for iPhone5, in order to do some RSTP streaming stuff) following the tutorial here but I get stuck with this error :
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc is unable to create an executable file.
C compiler test failed.
In my config.log file I have this :
BEGIN /var/folders/9g/zv_vdz7x16g1hgx9pqj57zz80000gn/T//ffconf.D3a73otQ.c
1 int main(void){ return 0; }
END /var/folders/9g/zv_vdz7x16g1hgx9pqj57zz80000gn/T//ffconf.D3a73otQ.c
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -arch armv7 -mfpu=neon -miphoneos-version-min=6.0 -mcpu=cortex-a9 -c -o /var/folders/9g/zv_vdz7x16g1hgx9pqj57zz80000gn/T//ffconf.Wv4eZtHX.o /var/folders/9g/zv_vdz7x16g1hgx9pqj57zz80000gn/T//ffconf.D3a73otQ.c
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -miphoneos-version-min=6.0 --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -o /var/folders/9g/zv_vdz7x16g1hgx9pqj57zz80000gn/T//ffconf.y84bbrJt /var/folders/9g/zv_vdz7x16g1hgx9pqj57zz80000gn/T//ffconf.Wv4eZtHX.o
ld: library not found for -lcrt1.3.1.o
collect2: ld returned 1 exit status
C compiler test failed.
I have other errors with other scripts found on stackoverflow or with google
Any idea ?
Ok (i'm kinda new on mac environment), I managed to pass the configure step by fixing the sdk target to the last sdk I have (6.1), removing Other Linker Flags but then the "make" command is full of errors (either with gcc or arm-apple-darwin10-gcc-4.2) :
In file included from ./libavutil/internal.h:113,
from ./libavutil/common.h:385,
from ./libavutil/avutil.h:238,
from libavdevice/version.h:28,
from libavdevice/avdevice.h:22,
from libavdevice/alldevices.c:22:
./libavutil/libm.h:53: error: static declaration of ‘cbrt’ follows non-static declaration
./libavutil/libm.h:60: error: static declaration of ‘cbrtf’ follows non-static declaration
./libavutil/libm.h:86: error: expected identifier or ‘(’ before ‘sizeof’
./libavutil/libm.h:96: error: expected identifier or ‘(’ before ‘sizeof’
./libavutil/libm.h:142: error: static declaration of ‘rint’ follows non-static declaration
./libavutil/libm.h:149: error: static declaration of ‘lrint’ follows non-static declaration
./libavutil/libm.h:156: error: static declaration of ‘lrintf’ follows non-static declaration
./libavutil/libm.h:163: error: static declaration of ‘round’ follows non-static declaration
./libavutil/libm.h:170: error: static declaration of ‘roundf’ follows non-static declaration
./libavutil/libm.h:177: error: static declaration of ‘trunc’ follows non-static declaration
./libavutil/libm.h:184: error: static declaration of ‘truncf’ follows non-static declaration
make: *** [libavdevice/alldevices.o] Error 1
./configure --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffserver --enable-cross-compile --arch=arm --target-os=darwin --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc --as='/usr/local/bin/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk --cpu=cortex-a8 --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk' --enable-pic --enable-decoder=rawvideo --disable-asm
You also have to care about paths like "--as=/usr/local/bin/gas-preprocessor.pl" or ".../SDKs/iPhoneOS6.1.sdk" and adapt them to your own paths/SDK

Resources