sslab-gatech / opensgx

OpenSGX
Other
288 stars 80 forks source link

still can't compile this project #21

Closed optimus1130 closed 8 years ago

optimus1130 commented 8 years ago

Compile sgx library $ make -C libsgx

I got In file included from src/malloc/malloc.c:13:0: src/malloc/malloc.c: In function ‘_malloc_init’: ./include/sgx-lib.h:32:5: error: inconsistent operand constraints in an ‘asm’ asm volatile("movl %0, %%eax\n\t" \ ^ is it because I'm compiling this project on an 32 bit operating system but running a 64 bit CPU?

johnmwshih commented 8 years ago

fix -- https://github.com/sslab-gatech/opensgx/commit/986a6fd6fc3976d2afc26bdf219c9c393ab82578 Could you check again? Thanks!

optimus1130 commented 8 years ago

still not ok....

In file included from src/malloc/malloc.c:13:0: src/malloc/malloc.c: In function ‘_malloc_init’: ./include/sgx-lib.h:32:5: error: inconsistent operand constraints in an ‘asm’ asm volatile("movl %0, %%eax\n\t" \ ^ src/malloc/malloc.c:64:6: note: in expansion of macro ‘sgx_exit’ sgx_exit(stub->trampoline); ^ make[1]: *\ [src/malloc/malloc.o] Error 1 make[1]: Leaving directory `/home/sijieding/RA/opensgx/libsgx/musl-libc'

optimus1130 commented 8 years ago

I have no experience with inline asm... Would you please give me a hint on what could possibly cause this? a lot of thanks!

johnmwshih commented 8 years ago

Could you check libsgx/musl-libc/include/sgx-lib.h line 35 is there only one underscore after asm? (e.g., _asm ) or two ( asm )?

optimus1130 commented 8 years ago

there are two..

johnmwshih commented 8 years ago

Hmm.. that's weird, at least I cannot reproduce in my environment. Maybe it really has to do with 32-bit platform. Could you try to download musl-libc 1.0.5 (http://www.musl-libc.org/download.html) and compile to see if it works?

optimus1130 commented 8 years ago

thanks any way.... but, after changing the musl-libc to an older version, I still cannot compile this....... sgx-basics.c: In function ‘_enclu’: sgx-basics.c:32:4: error: inconsistent operand constraints in an ‘asm’ asm volatile(".byte 0x0F\n\t" ^ sgx-basics.c:48:9: error: inconsistent operand constraints in an ‘asm’ asm volatile ("movl %%eax, %0\n\t" ^ make: *\ [sgx-basics.o] Error 1 I have no Idea what's happening

johnmwshih commented 8 years ago

Seems to me the compiler you are using doesn't support in-line assembly correctly. Maybe you can try to verify that. (e.g., write a simple c program using inline assemebly)

optimus1130 commented 8 years ago

reinstalled a Ubuntu 64 bit OS. Now it works!!!!!!! Thanks!!