kockie69 / SquinkyVCV-main

GNU General Public License v3.0
22 stars 12 forks source link

Compiling with Rack 2.2.0 using gcc 11.3 fails on simde instructions #78

Closed gitterdude closed 8 months ago

gitterdude commented 1 year ago

Rack 2.2.0 apparently changed something in the simde instructions resulting in the errors below when compiling with gcc 11.3 on Ubuntu 22.04 and having -march=nehalem in Rack/compile.mk

A workaround is to replaced nehalem with -march=broadwell or skylake or compile it using an older version of gcc, like 7.5 in Ubuntu 18.04

build/src/CH10Module.cpp.o src/CH10Module.cpp
In file included from ../Rack/dep/include/simde/x86/sse3.h:30,
                 from ../Rack/dep/include/simde/x86/ssse3.h:30,
                 from ../Rack/dep/include/simde/x86/sse4.1.h:31,
                 from ../Rack/dep/include/simde/x86/sse4.2.h:31,
                 from ../Rack/include/simd/common.hpp:4,
                 from ../Rack/include/simd/Vector.hpp:3,
                 from ../Rack/include/simd/functions.hpp:2,
                 from ../Rack/include/dsp/common.hpp:4,
                 from ../Rack/include/rack.hpp:110,
                 from src/Squinky.hpp:2,
                 from src/BasicModule.cpp:3:
../Rack/dep/include/simde/x86/sse2.h:3653:30: error: redefinition of ‘__m128i simde_mm_loadu_epi64(const void*)’
 3653 |   #define _mm_loadu_epi64(a) simde_mm_loadu_epi64(a)
      |                              ^~~~~~~~~~~~~~~~~~~~
../Rack/dep/include/simde/x86/sse2.h:3633:1: note: ‘simde__m128i simde_mm_loadu_epi64(const void*)’ previously defined here
 3633 | simde_mm_loadu_epi64(void const * mem_addr) {
      | ^~~~~~~~~~~~~~~~~~~~
../Rack/dep/include/simde/x86/sse2.h:3628:30: error: redefinition of ‘__m128i simde_mm_loadu_epi32(const void*)’
 3628 |   #define _mm_loadu_epi32(a) simde_mm_loadu_epi32(a)
      |                              ^~~~~~~~~~~~~~~~~~~~
gitterdude commented 1 year ago

The Surge folks had similar problems in https://github.com/VCVRack/library/issues/745 and the suggested fix from Andrew was to remove immintrin.h :

--- composites/MixM.h~  2022-12-09 09:03:57.000000000 +0100
+++ composites/MixM.h   2022-12-09 11:48:34.562249343 +0100
@@ -2,7 +2,6 @@
 #pragma once

 #include <assert.h>
-#include <immintrin.h>

 #include <memory>
--- dsp/third-party/src/SqMath.h~   2022-12-09 09:03:57.000000000 +0100
+++ dsp/third-party/src/SqMath.h    2022-12-09 11:48:43.878249254 +0100
@@ -1,7 +1,6 @@
 #pragma once

 #include "rack.hpp"
-#include <immintrin.h>
 #include <random>
 #if !defined(M_PI)
 #define M_PI float(3.14159265358979323846264338327950288)
--- ssehack/x86intrin.h.org 2022-12-09 09:03:57.000000000 +0100
+++ ssehack/x86intrin.h 2022-12-09 12:59:26.086208797 +0100
@@ -7,4 +7,3 @@

 #include <xmmintrin.h>
 #include <mmintrin.h>
-#include <immintrin.h>

I've confirmed that it builds and works in Ubuntu 22.04

kockie69 commented 8 months ago

This has been fixed, sent request to add latest version to vcv library