etotheipi / BitcoinArmory

Python-Based Bitcoin Software
Other
826 stars 619 forks source link

Need to fix clang compile #277

Closed yurivict closed 9 years ago

yurivict commented 9 years ago

Clang breaks on assembly: semicolon isn't a valid statemennt separator, itshould be replaced with "\n\t", see this llvm bug report: https://llvm.org/bugs/show_bug.cgi?id=18916

gcc does understand semicolons as an exception, but they really aren't a valid separator in assembly.

yurivict commented 9 years ago

@njaard Since you are the last who committed into armory, maybe you can fix the clang compile, or you know somebody who cares?

njaard commented 9 years ago

Can you provide the error message clang gives you? My version is very old and kind of hopeless.

yurivict commented 9 years ago

Yes, see messages. One problem is that semicolon isn't allowed as statement separator (newline is the separator). But the problem is deeper than that.

clang++ -DNDEBUG -g -O2 -fPIC -DCRYPTOPP_DISABLE_AESNI -pipe -c gzip.cpp sha.cpp:340:2: error: unknown token in expression ASL(1) ^ ./cpu.h:224:17: note: expanded from macro 'ASL'

define ASL(x) GNU_ASL(x)

                   ^

./cpu.h:218:26: note: expanded from macro 'GNU_ASL'

define GNU_ASL(x) "\n" #x ":"

                            ^
:243:2: note: expanded from here "1" ^ :3:20879: note: instantiated into assembly here sha.cpp:340:2: error: unknown token in expression ASL(1) ^ ./cpu.h:224:17: note: expanded from macro 'ASL' #define ASL(x) GNU_ASL(x) ^ ./cpu.h:218:26: note: expanded from macro 'GNU_ASL' #define GNU_ASL(x) "\n" #x ":" ^ :243:2: note: expanded from here "1" ^ :3:21223: note: instantiated into assembly here sha.cpp:340:2: error: invalid instruction mnemonic 'prefix' ASL(1) ^ ./cpu.h:224:17: note: expanded from macro 'ASL' #define ASL(x) GNU_ASL(x) ^ ./cpu.h:218:26: note: expanded from macro 'GNU_ASL' #define GNU_ASL(x) "\n" #x ":" ^ :243:2: note: expanded from here "1" ^ :3:21236: note: instantiated into assembly here sha.cpp:340:2: error: unknown token in expression ASL(1) ^ ./cpu.h:224:17: note: expanded from macro 'ASL' #define ASL(x) GNU_ASL(x) ^ ./cpu.h:218:26: note: expanded from macro 'GNU_ASL' #define GNU_ASL(x) "\n" #x ":" ^ :243:2: note: expanded from here "1" ^ :3:20879: note: instantiated into assembly here sha.cpp:340:2: error: unknown token in expression ASL(1) ^ ./cpu.h:224:17: note: expanded from macro 'ASL' #define ASL(x) GNU_ASL(x) ^ ./cpu.h:218:26: note: expanded from macro 'GNU_ASL' #define GNU_ASL(x) "\n" #x ":" ^ :243:2: note: expanded from here "1" ^ :3:21223: note: instantiated into assembly here sha.cpp:340:2: error: invalid instruction mnemonic 'prefix' ASL(1) ^ ./cpu.h:224:17: note: expanded from macro 'ASL' #define ASL(x) GNU_ASL(x) ^ ./cpu.h:218:26: note: expanded from macro 'GNU_ASL' #define GNU_ASL(x) "\n" #x ":" ^ :243:2: note: expanded from here "1" ^ :3:21236: note: instantiated into assembly here sha.cpp:340:2: error: unknown token in expression ASL(1) ^ ./cpu.h:224:17: note: expanded from macro 'ASL' #define ASL(x) GNU_ASL(x) ^ ./cpu.h:218:26: note: expanded from macro 'GNU_ASL' #define GNU_ASL(x) "\n" #x ":" ^ :243:2: note: expanded from here "1" ^ :3:20879: note: instantiated into assembly here sha.cpp:340:2: error: unknown token in expression ASL(1) ^ ./cpu.h:224:17: note: expanded from macro 'ASL' #define ASL(x) GNU_ASL(x) ^ ./cpu.h:218:26: note: expanded from macro 'GNU_ASL' #define GNU_ASL(x) "\n" #x ":" ^ :243:2: note: expanded from here "1" ^ :3:21223: note: instantiated into assembly here sha.cpp:340:2: error: invalid instruction mnemonic 'prefix' ASL(1) ^ ./cpu.h:224:17: note: expanded from macro 'ASL' #define ASL(x) GNU_ASL(x) ^ ./cpu.h:218:26: note: expanded from macro 'GNU_ASL' #define GNU_ASL(x) "\n" #x ":" ^ :243:2: note: expanded from here "1" ^ :3:21236: note: instantiated into assembly here clang++ -DNDEBUG -g -O2 -fPIC -DCRYPTOPP_DISABLE_AESNI -pipe -c dessp.cpp 9 errors generated.
njaard commented 9 years ago

Does adding -DCRYPTOPP_DISABLE_ASM to CXXFLAGS in cppForSwig/cryptopp/Makefile fix it for you?

yurivict commented 9 years ago

Yes, if fixed compile errors. Clang link also failed, I had to add -fPIC to fix it. But after this is builds fine (with some warnings).

yurivict commented 9 years ago

Thanks for workaround!

droark commented 9 years ago

Hello. Just curious, which OS and version of clang are you using? Everything works fine when compiling on OS X, which uses clang.

yurivict commented 9 years ago

FreeBSD 10.1, clang 3.4.1 OSX might be disabling assembly, not sure. Clang team themselves acknowledged the problem, but they won't fix it for now (see link to llvm bug in my OP). They say projects should fix non-compliant assembly syntax.

droark commented 9 years ago

Fixed. See https://github.com/etotheipi/BitcoinArmory/commit/87122c3f15b9c03017094804ddfe3c3dc7571144 for details.