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

error: ‘align’ is not a member of ‘std’ #38

Open
gitCoder1024 opened this issue May 28, 2024 · 1 comment
Open

error: ‘align’ is not a member of ‘std’ #38

gitCoder1024 opened this issue May 28, 2024 · 1 comment

Comments

@gitCoder1024
Copy link

We tried to run the code, but when we run the command "python install.py --tool --ot --sh2pc", this error occurs:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/utils/prg.h: In member function ‘void emp::PRG::random_data_unaligned(void*, int)’:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/utils/prg.h:76:6: error: ‘align’ is not a member of ‘std’
if(std::align(sizeof(block), sizeof(block), aligned_data, size)) {
^
In file included from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h:4:0,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/file_io_channel.h:5,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/emp-tool.h:2,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/test/prg.cpp:1:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/utils/prg.h: In member function ‘void emp::PRG::random_data_unaligned(void*, int)’:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/utils/prg.h:76:6: error: ‘align’ is not a member of ‘std’
if(std::align(sizeof(block), sizeof(block), aligned_data, size)) {
^
In file included from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h:4:0,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/file_io_channel.h:5,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/emp-tool.h:2,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/test/hash.cpp:1:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/utils/prg.h: In member function ‘void emp::PRG::random_data_unaligned(void*, int)’:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/utils/prg.h:76:6: error: ‘align’ is not a member of ‘std’
if(std::align(sizeof(block), sizeof(block), aligned_data, size)) {
^
In file included from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h:4:0,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/file_io_channel.h:5,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/emp-tool.h:2,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/test/netio.cpp:1:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/utils/prg.h: In member function ‘void emp::PRG::random_data_unaligned(void*, int)’:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/utils/prg.h:76:6: error: ‘align’ is not a member of ‘std’
if(std::align(sizeof(block), sizeof(block), aligned_data, size)) {
^
In file included from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/file_io_channel.h:5:0,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/emp-tool.h:2,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/test/prp.cpp:1:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h: In member function ‘void emp::IOChannel::send_bool(bool*, size_t)’:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h:56:26: error: ‘align’ is not a member of ‘std’
const void * aligned = std::align(alignof(uint64_t), sizeof(uint64_t), ptr, space);
^
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h: In member function ‘void emp::IOChannel::recv_bool(bool*, size_t)’:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h:69:20: error: ‘align’ is not a member of ‘std’
void * aligned = std::align(alignof(uint64_t), sizeof(uint64_t), ptr, space);
^
In file included from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/file_io_channel.h:5:0,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/emp-tool.h:2,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/test/hash.cpp:1:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h: In member function ‘void emp::IOChannel::send_bool(bool*, size_t)’:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h:56:26: error: ‘align’ is not a member of ‘std’
const void * aligned = std::align(alignof(uint64_t), sizeof(uint64_t), ptr, space);
^
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h: In member function ‘void emp::IOChannel::recv_bool(bool*, size_t)’:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h:69:20: error: ‘align’ is not a member of ‘std’
void * aligned = std::align(alignof(uint64_t), sizeof(uint64_t), ptr, space);
^
In file included from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/file_io_channel.h:5:0,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/emp-tool.h:2,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/test/prg.cpp:1:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h: In member function ‘void emp::IOChannel::send_bool(bool*, size_t)’:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h:56:26: error: ‘align’ is not a member of ‘std’
const void * aligned = std::align(alignof(uint64_t), sizeof(uint64_t), ptr, space);
^
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h: In member function ‘void emp::IOChannel::recv_bool(bool*, size_t)’:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h:69:20: error: ‘align’ is not a member of ‘std’
void * aligned = std::align(alignof(uint64_t), sizeof(uint64_t), ptr, space);
^
In file included from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/file_io_channel.h:5:0,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/emp-tool.h:2,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/test/netio.cpp:1:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h: In member function ‘void emp::IOChannel::send_bool(bool*, size_t)’:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h:56:26: error: ‘align’ is not a member of ‘std’
const void * aligned = std::align(alignof(uint64_t), sizeof(uint64_t), ptr, space);
^
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h: In member function ‘void emp::IOChannel::recv_bool(bool*, size_t)’:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/io/io_channel.h:69:20: error: ‘align’ is not a member of ‘std’
void * aligned = std::align(alignof(uint64_t), sizeof(uint64_t), ptr, space);
^
In file included from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/emp-tool.h:15:0,
from /home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/test/prp.cpp:1:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/circuits/sha3_256.h: In function ‘int emp::sha3_256(uint8_t*, const T*, size_t)’:
/home/users/dase212lxy/tmp/emp-sh2pc-master/emp-tool/emp-tool/circuits/sha3_256.h:32:37: error: there are no arguments to ‘EVP_sha3_256’ that depend on a template parameter, so a declaration of ‘EVP_sha3_256’ must be available [-fpermissive]
const EVP_MD * algo = EVP_sha3_256();

@Stu-Yang
Copy link

The errors you're encountering seem to stem from two issues:

  1. std::align Not Found:

    • The std::align function is available starting from C++17. If your compiler or build system is not set to use C++17, this error will occur.
  2. EVP_sha3_256 Undefined:

    • This function is part of OpenSSL 1.1.1 or newer. If your system has an older version of OpenSSL or is missing it, this error will occur.

Resolution Steps:

1. Fixing std::align Error

  • Ensure your compiler supports C++17. Run the following command to check the version of g++ or clang:

    g++ --version

    For GCC, version 7 or newer is recommended.

  • Update your compiler flags to include -std=c++17. Modify the CMakeLists.txt file in the emp-sh2pc project. Find the line that sets the compiler flags and ensure it includes:

    set(CMAKE_CXX_STANDARD 17)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)

2. Fixing EVP_sha3_256 Error

  • Verify your OpenSSL version using the command:

    openssl version

    If it's older than 1.1.1, you need to update OpenSSL. On Ubuntu, you can do this with:

    sudo apt update
    sudo apt install libssl-dev

    On other systems, ensure the latest OpenSSL development libraries are installed.

  • If OpenSSL is installed correctly, make sure your build system links against it. For CMake, include:

    find_package(OpenSSL REQUIRED)
    include_directories(${OPENSSL_INCLUDE_DIR})
    target_link_libraries(<the_target_name> ${OPENSSL_LIBRARIES})

3. Clean and Rebuild

  • After making the changes, clean your build directory:

    cmake ..
    make -j 4

4. Re-run the Install Command

Once the build completes successfully, try re-running the install command:

python install.py --tool --ot --sh2pc

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