ksahlin / strobealign

Aligns short reads using dynamic seed size with strobemers
MIT License
151 stars 17 forks source link

Compiling on a M1 Mac #2

Open jianshu93 opened 3 years ago

jianshu93 commented 3 years ago

Dear StrobeAlign,

I cannot compile it on a M1 pro chip (ARM), something like -O3 -march=armv8. Any possibilities to also provide a binary?

THanks,

Jianshu

ksahlin commented 3 years ago

This will be the first thing I try whenever I can get a hold of a MacBook with M1 chip.

What is the compilation error?

jianshu93 commented 2 years ago

Hi Check this on M1:

Jianshus-MBP-2:StrobeAlign jianshuzhao$ g++ -std=c++14 main.cpp source/index.cpp source/ksw2_extz2_sse.c -lz -fopenmp -o StrobeAlign -O3 -march=armv8.5-a Undefined symbols for architecture arm64: "_ksw_extz2_sse", referenced from: __Z9ksw_alignPKciS0_iiiiiR10ksw_extz_t in ccdGVhMg.o ld: symbol(s) not found for architecture arm64 collect2: error: ld returned 1 exit status

Thanks,

Jianshu

sjaenick commented 2 years ago

This might be useful here: https://github.com/DLTcollab/sse2neon

ksahlin commented 2 years ago

Hi @jianshu93 ,

I realized that strobealign is no longer using ksw2. I made a commit to develop that disables it https://github.com/ksahlin/StrobeAlign/commit/706ebb972552ec34a23d8003aa81eb3d097017aa

Since the error you reported is due to the ksw2 lib, it may be possible to compile the develop commit (https://github.com/ksahlin/StrobeAlign/commit/706ebb972552ec34a23d8003aa81eb3d097017aa) with

g++ -std=c++14 main.cpp source/index.cpp  source/xxhash.c source/ssw_cpp.cpp  source/ssw.c source/pc.cpp source/aln.cpp -lz -lpthread -o strobealign -O3 -mavx2

Would be cool if you could verify whether it compiles whenever you have time.

jianshu93 commented 2 years ago

Hello @ksahlin ,

See below:

g++ -std=c++14 main.cpp source/index.cpp source/xxhash.c source/ssw_cpp.cpp source/ssw.c source/pc.cpp source/aln.cpp -lz -lpthread -o strobealign -O3 -march=armv8.4-a In file included from source/ssw_cpp.cpp:6: source/ssw.h:17:10: fatal error: emmintrin.h: No such file or directory 17 | #include | ^~~~~ compilation terminated. source/ssw.c:70:10: fatal error: emmintrin.h: No such file or directory 70 | #include | ^~~~~ compilation terminated.

I think the head saw.h relies on, emmintrin.h can be replaced by some of the headers mentioned by @sjaenick.

Thanks,

Jianshu

ksahlin commented 2 years ago

Great @jianshu93. I will order such a MacBook to look at this first-hand.

jianshu93 commented 2 years ago

You will love it! Everything is 3-5 times faster than an intel version, BWA-MEM neon version is 3.5 faster than an intel avx2 version on average. I believe strobealign will be amazingly fast on an M1 Mac, maybe even faster than a 24 threads computer cluster.

Jianshu

ksahlin commented 1 year ago

Just trying this out on an M1 macbook compiling in CLion and I run into the same thing. The intrinsics in SSW lib is only meant for x86 and x64 architectures.

@marcelm is this possible adding support for (and if so, is it worth it)? Was thinking now that strobealign's peak memory may be laptop friendly soon.

====================[ Build | strobealign | Debug ]=============================
/Applications/CLion_silicon.app/Contents/bin/cmake/mac/bin/cmake --build /Users/ksahlin/prefix/source/StrobeAlign/cmake-build-debug --target strobealign -j 8
[1/23] cd /Users/ksahlin/prefix/source/StrobeAlign/cmake-build-debug && /Applications/CLion_silicon.app/Contents/bin/cmake/mac/bin/cmake -D CONFIGIN="/Users/ksahlin/prefix/source/StrobeAlign/src/version.hpp.in" -D CONFIGOUT="/Users/ksahlin/prefix/source/StrobeAlign/cmake-build-debug/version.hpp" -D DEFAULT_VERSION="0.9.0" -P /Users/ksahlin/prefix/source/StrobeAlign/GitVersion.cmake
Setting version to v0.9.0-3-gcf94a7b
[2/23] Building CXX object CMakeFiles/salib.dir/src/fastq.cpp.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
1 warning generated.
[3/23] Building CXX object CMakeFiles/salib.dir/src/indexparameters.cpp.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
1 warning generated.
[4/23] Building CXX object CMakeFiles/salib.dir/src/paf.cpp.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
1 warning generated.
[5/23] Building CXX object CMakeFiles/salib.dir/src/sam.cpp.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
1 warning generated.
[6/23] Building CXX object CMakeFiles/salib.dir/src/refs.cpp.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
1 warning generated.
[7/23] Building CXX object CMakeFiles/salib.dir/src/pc.cpp.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
1 warning generated.
[8/23] Building CXX object CMakeFiles/salib.dir/src/cigar.cpp.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
1 warning generated.
[9/23] Building CXX object CMakeFiles/salib.dir/src/aligner.cpp.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
1 warning generated.
[10/23] Building CXX object CMakeFiles/salib.dir/src/index.cpp.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
1 warning generated.
[11/23] Building CXX object CMakeFiles/salib.dir/src/nam.cpp.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
/Users/ksahlin/prefix/source/StrobeAlign/src/nam.cpp:119:27: warning: comparison of integers of different signs: 'int' and 'unsigned int' [-Wsign-compare]
            if (h.query_s > prev_q_start + k) {
                ~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
2 warnings generated.
[12/23] Building C object CMakeFiles/salib.dir/ext/xxhash.c.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
1 warning generated.
[13/23] Building CXX object CMakeFiles/salib.dir/src/version.cpp.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
1 warning generated.
[14/23] Building C object CMakeFiles/salib.dir/ext/ssw/ssw.c.o
FAILED: CMakeFiles/salib.dir/ext/ssw/ssw.c.o 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc  -I/Users/ksahlin/prefix/source/StrobeAlign/src -I/Users/ksahlin/prefix/source/StrobeAlign/ext -I/Users/ksahlin/prefix/source/StrobeAlign/cmake-build-debug -I/Users/ksahlin/prefix/source/StrobeAlign/cmake-build-debug/_deps/zstrgitrepo-src/src -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -mmacosx-version-min=12.6 -fcolor-diagnostics -Wall -Wextra -Werror=maybe-uninitialized -MD -MT CMakeFiles/salib.dir/ext/ssw/ssw.c.o -MF CMakeFiles/salib.dir/ext/ssw/ssw.c.o.d -o CMakeFiles/salib.dir/ext/ssw/ssw.c.o -c /Users/ksahlin/prefix/source/StrobeAlign/ext/ssw/ssw.c
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
In file included from /Users/ksahlin/prefix/source/StrobeAlign/ext/ssw/ssw.c:70:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/emmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
 ^
In file included from /Users/ksahlin/prefix/source/StrobeAlign/ext/ssw/ssw.c:70:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/emmintrin.h:17:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/xmmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
 ^
In file included from /Users/ksahlin/prefix/source/StrobeAlign/ext/ssw/ssw.c:70:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/emmintrin.h:17:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/xmmintrin.h:17:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
 ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:54:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:133:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:163:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:193:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:220:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:243:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:264:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:291:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:314:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:335:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:356:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:377:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:398:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:420:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:443:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:465:12: error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
    return (__m64)__builtin_ia32_paddusb((__v8qi)__m1, (__v8qi)__m2);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
[15/23] Building CXX object CMakeFiles/salib.dir/src/readlen.cpp.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
1 warning generated.
[16/23] Building CXX object CMakeFiles/salib.dir/src/randstrobes.cpp.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
1 warning generated.
[17/23] Building CXX object CMakeFiles/salib.dir/src/io.cpp.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
1 warning generated.
[18/23] Building CXX object CMakeFiles/salib.dir/src/aln.cpp.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
/Users/ksahlin/prefix/source/StrobeAlign/src/aln.cpp:177:26: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
    if (ref_segm_len_ham == read_segm_len && !aln_did_not_fit) {
        ~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~
/Users/ksahlin/prefix/source/StrobeAlign/src/aln.cpp:243:49: warning: comparison of integers of different signs: 'int' and 'std::basic_string<char>::size_type' (aka 'unsigned long') [-Wsign-compare]
    if (projected_ref_end - projected_ref_start == query.size() && fits) {
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~
/Users/ksahlin/prefix/source/StrobeAlign/src/aln.cpp:309:23: warning: comparison of integers of different signs: 'int' and 'const unsigned long' [-Wsign-compare]
    if (ref_segm_size == read_len && fits) {
        ~~~~~~~~~~~~~ ^  ~~~~~~~~
/Users/ksahlin/prefix/source/StrobeAlign/src/aln.cpp:335:62: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare]
    int break_point = (global_max_bp >= T) && (global_max_bp <= (read_len - T)) ? global_max_bp : -1;
                                               ~~~~~~~~~~~~~ ^   ~~~~~~~~~~~~
/Users/ksahlin/prefix/source/StrobeAlign/src/aln.cpp:369:86: warning: comparison of integers of different signs: 'unsigned long' and 'const int' [-Wsign-compare]
        ref_tmp_segm_size = right_ref_start_bp + (read_len + diff - right_region_bp) < ref_len ? (read_len + diff - right_region_bp) : ref_len - right_ref_start_bp;
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~
/Users/ksahlin/prefix/source/StrobeAlign/src/aln.cpp:317:45: warning: variable 'ext_left' is uninitialized when used here [-Wuninitialized]
            sam_aln.ref_start = ref_start + ext_left + info.query_start;
                                            ^~~~~~~~
/Users/ksahlin/prefix/source/StrobeAlign/src/aln.cpp:295:17: note: initialize the variable 'ext_left' to silence this warning
    int ext_left;
                ^
                 = 0
/Users/ksahlin/prefix/source/StrobeAlign/src/aln.cpp:278:25: warning: unused function 'get_alignment_unused' [-Wunused-function]
static inline alignment get_alignment_unused(
                        ^
8 warnings generated.
[19/23] Building CXX object CMakeFiles/salib.dir/src/cmdline.cpp.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
1 warning generated.
[20/23] Building CXX object CMakeFiles/salib.dir/ext/ssw/ssw_cpp.cpp.o
FAILED: CMakeFiles/salib.dir/ext/ssw/ssw_cpp.cpp.o 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -I/Users/ksahlin/prefix/source/StrobeAlign/src -I/Users/ksahlin/prefix/source/StrobeAlign/ext -I/Users/ksahlin/prefix/source/StrobeAlign/cmake-build-debug -I/Users/ksahlin/prefix/source/StrobeAlign/cmake-build-debug/_deps/zstrgitrepo-src/src -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -mmacosx-version-min=12.6 -fcolor-diagnostics -Wall -Wextra -Werror=maybe-uninitialized -std=c++17 -MD -MT CMakeFiles/salib.dir/ext/ssw/ssw_cpp.cpp.o -MF CMakeFiles/salib.dir/ext/ssw/ssw_cpp.cpp.o.d -o CMakeFiles/salib.dir/ext/ssw/ssw_cpp.cpp.o -c /Users/ksahlin/prefix/source/StrobeAlign/ext/ssw/ssw_cpp.cpp
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
In file included from /Users/ksahlin/prefix/source/StrobeAlign/ext/ssw/ssw_cpp.cpp:6:
In file included from /Users/ksahlin/prefix/source/StrobeAlign/ext/ssw/ssw.h:17:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/emmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
 ^
In file included from /Users/ksahlin/prefix/source/StrobeAlign/ext/ssw/ssw_cpp.cpp:6:
In file included from /Users/ksahlin/prefix/source/StrobeAlign/ext/ssw/ssw.h:17:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/emmintrin.h:17:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/xmmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
 ^
In file included from /Users/ksahlin/prefix/source/StrobeAlign/ext/ssw/ssw_cpp.cpp:6:
In file included from /Users/ksahlin/prefix/source/StrobeAlign/ext/ssw/ssw.h:17:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/emmintrin.h:17:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/xmmintrin.h:17:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:14:2: error: "This header is only meant to be used on x86 and x64 architecture"
#error "This header is only meant to be used on x86 and x64 architecture"
 ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:37: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/14.0.0/include/mmintrin.h:37:5: note: '__builtin_isless' declared here
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:37: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/14.0.0/include/mmintrin.h:54: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/14.0.0/include/mmintrin.h:71: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/14.0.0/include/mmintrin.h:133: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/14.0.0/include/mmintrin.h:163: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/14.0.0/include/mmintrin.h:193: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/14.0.0/include/mmintrin.h:220: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/14.0.0/include/mmintrin.h:243: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/14.0.0/include/mmintrin.h:264: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/14.0.0/include/mmintrin.h:291: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/14.0.0/include/mmintrin.h:314: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/14.0.0/include/mmintrin.h:335: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/14.0.0/include/mmintrin.h:356:19: error: use of undeclared identifier '__builtin_ia32_paddb'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:356:19: note: '__builtin_arm_addg' declared here
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:356:19: error: first argument of MTE builtin function must be a pointer ('__v8qi' (vector of 8 'char' values) invalid)
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^                    ~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:377:19: error: use of undeclared identifier '__builtin_ia32_paddw'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/mmintrin.h:356:19: note: '__builtin_arm_addg' declared here
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
[21/23] Building CXX object CMakeFiles/strobealign.dir/src/main.cpp.o
warning: unknown warning option '-Werror=maybe-uninitialized'; did you mean '-Werror=uninitialized'? [-Wunknown-warning-option]
1 warning generated.
ninja: build stopped: subcommand failed.
marcelm commented 1 year ago

I don’t have access to an M1 Mac, so I think I cannot help too much with this. Two options come to mind:

  1. Use sse2neon, which translates from x86 SSE instructions to the SIMD instructions used on the M1 processor.
  2. Compile to an x86_64 binary and rely on the x86-64 emulation that I heard is built into macOS.
ksahlin commented 1 year ago

Alright, thanks for input. I see if I'll get around to try option 1 myself.