c++macosgcctruecrypt

Issues compiling Veracrypt on Mac OS X El Capitan 10.11.5


I'm having issues compiling Veracrypt on El Capitan

This is the error I get:

../Crypto/Whirlpool.c:511:3: error: unknown token in expression
                KSH(2, 3, 2, 1, 0, 7)
                ^
../Crypto/Whirlpool.c:452:2: note: expanded from macro 'KSH'
        KSH##op(b, [AS_REG_6+2*2048+8*WORD_REG(di)])\
        ^
<scratch space>:264:1: note: expanded from here
KSH2
^
../Crypto/Whirlpool.c:445:2: note: expanded from macro 'KSH2'
        AS2(movq        [SSE2_workspace+8*a], mm##a)
        ^
/Users/whatnots/Desktop/veracrypt/src/Crypto/cpu.h:149:23: note: expanded from macro 'AS2'
    #define AS2(x, y) GNU_AS2(x, y)
                      ^
/Users/whatnots/Desktop/veracrypt/src/Crypto/cpu.h:144:27: note: expanded from macro 'GNU_AS2'
    #define GNU_AS2(x, y) #x ", " #y ";" NEW_LINE
                          ^
<scratch space>:270:2: note: expanded from here
"movq [%3+8*1]"
 ^
<inline asm>:162:7: note: instantiated into assembly here
movq [%r10+8*1], mm1;
      ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

Here is my gcc info:

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

This compiles fine on Ubuntu 16.04. Not sure what i need to do. I've install all the required software and I've even tried two higher versions of gcc.


Solution

  • The inline code for the nasm assembler is not correctly expanded, see also this issue in veracrypt repository. The culprits are located in cpu.h (lines 259 until 263 in the 1.19 release). You can try to substitute these with

    #define GNU_AS1(x) #x ";"
    #define GNU_AS2(x, y) #x ", " #y ";"
    #define GNU_AS3(x, y, z) #x ", " #y ", " #z ";"
    #define GNU_ASL(x) "\n\t#x:"
    #define GNU_ASJ(x, y, z) #x " " #y #z ";"
    

    but it could be that in the final test for encryption you will get an error for TestPkcs5.

    Addendum 2017-06-08: The latest git clone of veracrypt compiles without problems, the inline assembly in the whirlpool hashing function is disabled now.