treeform / pixie

Full-featured 2d graphics library for Nim.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile using cpp backend

jerous86 opened this issue · comments

I want to use pixie in a nim program that can only be compiled with the cpp backend.
However, pixie cannot be compiled using this cpp backend on my system (mac OS 12).

For example,
nim cpp --gc:orc -d:release -r tests/all.nim
results in multiple errors like

.cache/nim/all_r/@m..@ssrc@spixie@ssimd@savx2.nim.cpp:197:5: error: no matching function for call to '_mm256_store_si256'
                                _mm256_store_si256(((void*) (p)), colorVec);
                                ^~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/include/avxintrin.h:3277:1: note: candidate function not viable: cannot convert argument of incomplete type
      'void *' to '__m256i *' for 1st argument
_mm256_store_si256(__m256i *__p, __m256i __a)

Anyway to get it compiling using nim cpp?

Try nim cpp -d:pixieNoSimd -d:zippyNoSimd -r tests/all.nim

commented

Why wouldn't SIMD instructions work on C++? Just Curious

We run all of our tests using nim cpp for every commit so I can be confident C++ is not the issue here. The real question is why does it not work on your computer which is unfortunately much harder to answer from far away.

Yeah this is something Mac specific.

It appears clang on Mac requires pointers to be cast to something like const __m128i_u *. This is a made-up requirement, serves no purpose and is dumb. Fortunately no other compilers require it so I'm not eager to do anything here.