apple clang and sse instructions form armv7 ( mobile processors ) - c++

I have problems cross compiling some c++ sources that contain sse instruction.
I manage to compile them for simulator (with no extra c++ flag), but for armv7 i get the following error:
#error "SSE instruction set not enabled"
( and following other errors such as:
... unknown type name '__m128'
)
I have looked into clang flags for a flag to activate sse instructions, but did not find
( the source file that i'm trying to compile is gdalgrid.cpp in project gdal,
http://fossies.org/dox/gdal-1.10.1/gdalgrid_8cpp_source.html
)
thx in advance

Similar problem; trying to compile 'make' an altcoin wallet application on ARM7 hardware, the gcc compiler bombs out with
/usr/share/gccxml-0.9/GCC/4.7/xmmintrin.h:32:3: error: #error "SSE instruction
set not enabled"
src/scrypt_mine.cpp: In function ‘void* scrypt_buffer_alloc()’:
src/scrypt_mine.cpp:66:19: error: ‘SCRYPT_BUFFER_SIZE’ was not declared in this scope
src/scrypt_mine.cpp: In function ‘void scrypt(const void*, size_t, uint32_t*, void*)’:
src/scrypt_mine.cpp:87:21: error: ‘scrypt_core’ was not declared in this scope
Makefile:1909: recipe for target 'build/scrypt_mine.o' failed
make: *** [build/scrypt_mine.o] Error 1
What I think is going on is that some implementations of scrypt got made to be so totally dependent on sse instructions on one brand of cpu that they won't compile for another.
Now the solution requires a better answer from the Litecoin people, as what I got to work is only applicable to bitcoin and other sha256d coins:
Ditch any scrypt based coins, as those are limited to a particular brand of cpu which does sse. Compile for sha256d based coins as those are more portable and wallets can work on ARM7 devices including raspberry pi.

Related

Mingw32 errors when building OpenCV 3.2.0 on Windows 7

I'm trying to build OpenCV 3.2.0 vc14 from its sources with MinGW 5.3.0 32 bit in order to use its functionality from Qt 5.8. My platform is Windows 7 64 bit.
The main instruction I follow is here, on Qt's wiki. On several steps, I encounter errors for which I haven't found solutions yet. As I am a newbie, I apologize for my helplessness and will appriciate any suggestions.
Error 1. On the stage of generating build files.
In cmake-gui (cmake-3.2.1-win32-x86), I precisely follow the steps specified in the Qt wiki article mentioned above. However, during the final generation, the following CMake error occurs at the end:
CMake Error in modules/highgui/CMakeLists.txt:
No known features for CXX compiler
"GNU"
version 5.3.0.
Generating done
I wonder how it affects the project files and if it causes the next errors.
Error 2. When trying to build OpenCV
The build process is interrupted midway, logging the following:
In file included from C:/Qt/Tools/mingw530_32/i686-w64-
mingw32/include/c++/type_
traits:35:0,
from C:/Qt/5.8/mingw53_32/include/QtCore/qglobal.h:45,
from C:/Qt/5.8/mingw53_32/include/QtCore/QtCore:4,
from C:/Qt/5.8/mingw53_32/include/QtOpenGL/QtOpenGLDepends:3,
from C:/Qt/5.8/mingw53_32/include/QtOpenGL/QtOpenGL:3,
from C:/opencv/sources/modules/highgui/src/window_QT.h:46,
from C:\opencv\sources\modules\highgui\src\window_QT.cpp:47:
C:/Qt/Tools/mingw530_32/i686-w64-
mingw32/include/c++/bits/c++0x_warning.h:32:2:
error: #error This file requires compiler and library support for the ISO
C++ 2011 standard. This support is currently experimental, and must be
enabled with the -std=c++11 or -std=gnu++11 compiler options.
(...)
C:/Qt/5.8/mingw53_32/include/QtCore/qcompilerdetection.h:562:6: error:
#error Qt requires a C++11 compiler and yours does not seem to be that.
(...)
^
C:/Qt/5.8/mingw53_32/include/QtCore/qtypeinfo.h:62:40: error: expected
primary-expression before '>' token isIntegral = std::is_integral<T>::value,
^
C:/Qt/5.8/mingw53_32/include/QtCore/qtypeinfo.h:62:41: error: '::value' has
not been declared isIntegral = std::is_integral<T>::value,
NOTE: I also had sprintf() family security error. So I followed Alex's suggestion to add add_definitions(-DSTRSAFE_NO_DEPRECATE) to the beginning of CMakeLists.txt to suppress the error.
Thank you for your time.

Error compiling Boost.Log

I am trying to compile the boost log library and I keep getting this error from the dump_avx2.cpp file
error: always_inline function '_mm256_set1_epi32' requires target feature 'sse4.2', but would be inlined into function 'dump_data_avx2' that is compiled without support for 'sse4.2'
boost/boost/libs/log/src/dump_avx2.cpp:71:31: note: expanded from macro 'BOOST_LOG_AUX_MM_CONSTANTS'
const __m256i mm_char_0 = _mm256_set1_epi32(0x30303030);\
^
I get a lot of errors that are very similar to the one above, all of them have the same error message but different locations in the file where they occur, for reference I am on the commit hash 68701167a1020b0b4c47b76e31d3a3da9e2faf3f for the Boost.Log submodule as fetched from the github repo (https://github.com/boostorg/boost)
Does anyone know how I can go about resolving this issue? I am building with a C++14 compiler and this is what I get when I type g++ --version
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Thanks!
Note I should clarify that in this context it is required that I compile this library separately.
Note There seem to be two related source files dump_ssse3.cpp and the mentioned dump_avx2.cpp file, do I have to compile only one of them? I cannot make out what to do from the Jamfile in the build folder :(
That looks like a bug in clang (LLVM). First, the intrinsic belongs to AVX2, not SSE4.2. Second, the whole dump_avx2.cpp file is compiled with -mavx2, so the required extensions are enabled. You can see the compiler switches in the error message from b2. And no, both dump_ssse3.cpp and dump_avx2.cpp should be compiled. The library does runtime detection of the available instructions in the CPU and selects the proper implementation.

PIN tool unknown ABI error

I installed the latest version of PIN from here. And I modified the created a file to trace calls to gets() using a copy of malloctrace.cpp. However, while compiling, I get an error:
In file included from ./include/pin/pin.H:41:0, from
tools/ManualExamples/inputtrace.cpp:32:
./include/pin/compiler_version_check2.H:83:3: error: #error "Unknown
target architecture" # error "Unknown target architecture" ^
./include/pin/compiler_version_check2.H:98:2: error: #error "internal
error pin compiler configuration not available " #error "internal
error pin compiler configuration not available " ^
./include/pin/compiler_version_check2.H:102:2: error: #error The C++
ABI of your compiler does not match the ABI of the pin kit. #error
The C++ ABI of your compiler does not match the ABI of the pin kit.
^ ./include/pin/compiler_version_check2.H:122:2: error: #error Kit has
unknown compiler ABI #error Kit has unknown compiler ABI ^ In file
included from ./include/pin/level_base.PLH:66:0,
from ./include/pin/pin.H:43,
from tools/ManualExamples/inputtrace.cpp:32:
./include/pin/foundation.PLH:25:28: fatal error: types_marker.TLH: No
such file or directory #include "types_marker.TLH"
^
compilation terminated.
I did make sure that the version of PIN I installed was the latest. But the problem persists.
Can someone help me in this regard?
Update: I am using a linux machine x86-64 and the compiler is gcc version 4.8.4
Adding this as an answer since, I do not have the required reputation to make a comment.
Unless you tell us the exact parameters you used for running make, I am afraid a clear and direct answer to your question will not be possible.
This might be a total stab in the dark. But, I ran into a similar problem recently, like you have specified above. I am using an x86_64 Linux system and I was trying to cross-compile my PinTool for ia-32 architecture.
If you do not have 32-bit shared libraries in your system, or if you get the TARGET parameter in make wrong, it would result in
Unknown target architecture
For me running the below command, made it build successfully. Use the following to build for ia32 architecture.
make TARGET=ia32

G++ Link-time optimisation on Mac - compiler/linker bug?

I have a project that uses OpenMP (which doesn't seem to be available in the current OS X default clang setup) but would also like to use LTO. I have sections of the code in SIMD intrinsics using SSE4 and found that G++ was unable to link this code without using the OS X provided clang linker (flag -Wa,-q). G++ 5.10 is installed via Homebrew and compiled with without multilib.
I can compile with LTO using clang but then I lose the parallel 'for's, when I add -flto to G++ I get:
lto1: internal compiler error: in add_symbol_to_partition_1, at lto/lto-partition.c:211
lto1: internal compiler error: Abort trap: 6
g++-5: internal compiler error: Abort trap: 6 (program lto1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://github.com/Homebrew/homebrew/issues> for instructions.
lto-wrapper: fatal error: g++-5 returned 4 exit status
compilation terminated.
collect2: fatal error: lto-wrapper returned 1 exit status
compilation terminated.
This also occurs without -Wa,-q if I remove the intrinsics so that it can compile the remaining code.
I have tried a simple two file program that compiles fine with LTO in G++ so I'm not sure what the problem is. Whilst LTO doesn't seem to make a huge amount of difference to this code, in clang I've measured about 7% which is non-negligible as the program takes a while to run.
I know the error says to submit a bug report but I don't want to unless I know it's not just my own stupidity.
Does anyone have experience of this sort of problem, or have I actually run into a compiler bug? (haven't come across one before to my knowledge)
Cheers!
Compilers are never supposed to report ICEs. It's a bug. It may already be a reported bug, but it is most certainly a bug.

Cygwin compile error: "log10l" not recognized (declared)

I am compiling a linux program on cygwin (teaching a class with students that have windows computers) and have run into a problem with compatibility I think.
The error I get is this:
`$ Make
g++ -fopenmp -c start.cpp errors.cpp
start.cpp: In function ‘int main(int, char**)’:
start.cpp:1184:54: error: ‘log10l’ was not declared in this scope
else po[i]=log10l(p_rj[i]/(1-p_rj[i]));
^
Makefile:7: recipe for target 'start.o' failed
Make: *** [start.o] Error 1`
The log10l is not declared. A little research on cygwin's site about this and I found this page which lists "non implemented system interfaces" and log10l is on there.
Do I need to replace 'log10l' with a compatible function and why would't it be compatible?
App compiles without error on my linux box.
Any Help would be much appreciated.
LP
If that function is just taking the log base 10 of the inner expression, you can just replace it with
else po[i] = std::log10(p_rj[i]/(1-p_rj[i]));
As long as you
#include <cmath>
Cygwin does not currently support long double math functions, of which log10l is one. You can use log10 instead, but it is limited to a double type.