Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation Error on Xcode #13

Open
Tabaie opened this issue Aug 13, 2021 · 3 comments
Open

Compilation Error on Xcode #13

Tabaie opened this issue Aug 13, 2021 · 3 comments

Comments

@Tabaie
Copy link

Tabaie commented Aug 13, 2021

I can successfully install ot, zk and tool on a macOS, with all the tests passing successfully.
However, the following simple program, which only makes a reference to setup_zk_bool won't compile with Xcode.

#include <emp-tool/emp-tool.h>
#include <emp-zk/emp-zk.h>

int main(int argc, const char * argv[]) {
    setup_zk_bool((BoolIO<NetIO>**)nullptr, 0, 0);
    return 0;
}

The errors are the following:

emp-tool/utils/aes_opt.h:12:15: Always_inline function '_mm_aesenclast_si128' requires target feature 'aes', but would be inlined into function 'ks_rounds' that is compiled without support for 'aes'

emp-tool/utils/aes_opt.h:79:13: Always_inline function '_mm_aesenc_si128' requires target feature 'aes', but would be inlined into function 'ParaEnc' that is compiled without support for 'aes'

emp-tool/utils/aes_opt.h:89:12: Always_inline function '_mm_aesenclast_si128' requires target feature 'aes', but would be inlined into function 'ParaEnc' that is compiled without support for 'aes'

Since all the tests pass using the same compiler on the same machine, I suspect that the issue has to do with compiler configurations, with Xcode telling the compiler to be strict and throw errors when it could just give a warning. But I don't know which flags that could be.

A small Xcode project containing the program is available here.

@wangxiao1254
Copy link
Member

wangxiao1254 commented Aug 14, 2021

Unfortunately, I do not have any knowledge in Xcode. If you compile from the terminal, everything should work as described. I think you should tell Xcode to use cmake for configuration. I'm sure there is a way :)

@Tabaie
Copy link
Author

Tabaie commented Aug 14, 2021

Thank you for the prompt response. I tried the following cmake script:

project(emp_zk_compile_err)

set(CMAKE_CXX_STANDARD 17)

add_executable(emp_zk_compile_err main.cpp)
target_include_directories(emp_zk_compile_err PUBLIC "/path/emp-zk")
target_include_directories(emp_zk_compile_err PUBLIC "/path/emp-tool")
target_include_directories(emp_zk_compile_err PUBLIC "/path/emp-ot")
target_include_directories(emp_zk_compile_err PUBLIC "/usr/local/opt/openssl@1.1/include")

Still got the same errors:

Aryas-MacBook-Pro:build arya$ make
[ 50%] Building CXX object CMakeFiles/emp_zk_compile_err.dir/main.o
In file included from /path/emp-compile-err/emp-compile-err/main.cpp:2:
In file included from /path/emp-tool/emp-tool/emp-tool.h:29:
In file included from /path/emp-tool/emp-tool/utils/mitccrh.h:3:
/path/emp-tool/emp-tool/utils/aes_opt.h:12:15: error: always_inline function '_mm_aesenclast_si128' requires target feature 'aes', but would be inlined into function 'ks_rounds' that is compiled without support for 'aes'
                block aux = _mm_aesenclast_si128 (x2, con);
                            ^
/path/emp-tool/emp-tool/utils/aes_opt.h:79:13: error: always_inline function '_mm_aesenc_si128' requires target feature 'aes', but would be inlined into function 'ParaEnc' that is compiled without support for 'aes'
                                *blks = _mm_aesenc_si128(*blks, K);
                                        ^
/path/emp-tool/emp-tool/utils/aes_opt.h:89:12: error: always_inline function '_mm_aesenclast_si128' requires target feature 'aes', but would be inlined into function 'ParaEnc' that is compiled without support for 'aes'
                        *blks = _mm_aesenclast_si128(*blks, K);
                                ^
/path/emp-tool/emp-tool/utils/aes_opt.h:79:13: error: always_inline function '_mm_aesenc_si128' requires target feature 'aes', but would be inlined into function 'ParaEnc' that is compiled without support for 'aes'
                                *blks = _mm_aesenc_si128(*blks, K);
                                        ^
/path/emp-tool/emp-tool/utils/aes_opt.h:89:12: error: always_inline function '_mm_aesenclast_si128' requires target feature 'aes', but would be inlined into function 'ParaEnc' that is compiled without support for 'aes'
                        *blks = _mm_aesenclast_si128(*blks, K);
                                ^
5 errors generated.
make[2]: *** [CMakeFiles/emp_zk_compile_err.dir/main.o] Error 1
make[1]: *** [CMakeFiles/emp_zk_compile_err.dir/all] Error 2
make: *** [all] Error 2

@wangxiao1254
Copy link
Member

wangxiao1254 commented Aug 14, 2021

Please use our cmake configuration at https://github.com/emp-toolkit/emp-zk/blob/master/CMakeLists.txt, crucially, this file include https://github.com/emp-toolkit/emp-tool/blob/master/cmake/emp-base.cmake#L50, that enables AES.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants