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

1.2: Error building aes_ni on standard compiler version on RH6 #362

Closed
chmielot opened this issue Jan 31, 2019 · 8 comments
Closed

1.2: Error building aes_ni on standard compiler version on RH6 #362

chmielot opened this issue Jan 31, 2019 · 8 comments
Labels
1.2 Related to older version of minizip 1.2 compilation Issues related to compiling source code encryption Encryption/decryption issue

Comments

@chmielot
Copy link

I am trying to build version 1.2 on a RH6/CentOS6 machine. The default compiler on that OS is gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23). The build fails with:

> cmake -DZLIB_LIBRARY:PATH="/absolute/path/to/libs/zlib-1.2.8" -DZLIB_INCLUDE_DIR:PATH="/absolute/path/to/libs/zlib-1.2.8" .
> cmake --build .
Scanning dependencies of target aes
[  6%] Building C object CMakeFiles/aes.dir/aes/aescrypt.c.o
[ 13%] Building C object CMakeFiles/aes.dir/aes/aeskey.c.o
[ 20%] Building C object CMakeFiles/aes.dir/aes/aestab.c.o
[ 26%] Building C object CMakeFiles/aes.dir/aes/aes_ni.c.o
cc: Internal error: Segmentation fault (program cc1)
Please submit a full bug report.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
gmake[2]: *** [CMakeFiles/aes.dir/aes/aes_ni.c.o] Error 1
gmake[1]: *** [CMakeFiles/aes.dir/all] Error 2
gmake: *** [all] Error 2

After that I tried to compile it on RH7/CentOS7 which works fine with gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36):

cmake --build .
Scanning dependencies of target aes
[  6%] Building C object CMakeFiles/aes.dir/aes/aescrypt.c.o
[ 13%] Building C object CMakeFiles/aes.dir/aes/aeskey.c.o
[ 20%] Building C object CMakeFiles/aes.dir/aes/aestab.c.o
[ 26%] Building C object CMakeFiles/aes.dir/aes/aes_ni.c.o
[ 33%] Building C object CMakeFiles/aes.dir/aes/fileenc.c.o
[ 40%] Building C object CMakeFiles/aes.dir/aes/hmac.c.o
[ 46%] Building C object CMakeFiles/aes.dir/aes/prng.c.o
[ 53%] Building C object CMakeFiles/aes.dir/aes/pwd2key.c.o
[ 60%] Building C object CMakeFiles/aes.dir/aes/sha1.c.o
Linking C static library libaes.a
[ 60%] Built target aes
Scanning dependencies of target minizip
[ 66%] Building C object CMakeFiles/minizip.dir/crypt.c.o
[ 73%] Building C object CMakeFiles/minizip.dir/ioapi.c.o
[ 80%] Building C object CMakeFiles/minizip.dir/ioapi_buf.c.o
[ 86%] Building C object CMakeFiles/minizip.dir/ioapi_mem.c.o
[ 93%] Building C object CMakeFiles/minizip.dir/unzip.c.o
[100%] Building C object CMakeFiles/minizip.dir/zip.c.o
Linking C static library libminizip.a
[100%] Built target minizip

Unfortunately, I have to ship for CentOS6 and I was wondering if you have any idea what the problem might be.

How to reproduce

In order to reproduce you could use Docker with the following Dockerfile:

FROM centos:6

RUN yum groupinstall -y "Development Tools" && yum install -y cmake

# Start from a Bash prompt
CMD [ "/bin/bash" ]
  1. Build: docker build -t centos6-build-env .
  2. Run (be sure to have zlib and the minizip source in PWD or adjust the source path otherwise): docker run -it -v $(PWD):/shared --name build-env centos6-build-env /bin/bash
  3. Run the cmake commands
@nmoinvaz
Copy link
Member

nmoinvaz commented Jan 31, 2019

I don't have any idea why it is failing on 1.2. The aes files in question are from this library:
https://github.com/BrianGladman/aes

@nmoinvaz
Copy link
Member

Maybe you can turn off USE_INTEL_AES_IF_PRESENT and see if that solves your problem - also see INTEL_AES_POSSIBLE in aesopt.h.

@nmoinvaz
Copy link
Member

nmoinvaz commented Feb 1, 2019

It also might make sense for you to build with OpenSSL instead.

@chmielot
Copy link
Author

chmielot commented Feb 4, 2019

Can you please provide instructions on how to build version 1.2 with OpenSSL? And on that occasion: are there any/a lot of compatibility breaks between 1.2 and the most current version?

@nmoinvaz
Copy link
Member

nmoinvaz commented Feb 4, 2019

Ah sorry OpenSSL is only for version 2.0. You would just specify -DMZ_OPENSSL=ON. If you were using your own IO layer/interface that would not be supported. But most everything else is supported.

@nmoinvaz
Copy link
Member

nmoinvaz commented Feb 8, 2019

Were you able to get it to run by turning off USE_INTEL_AES_IF_PRESENT?

@chmielot
Copy link
Author

chmielot commented Feb 8, 2019

If turned off USE_INTEL_AES_IF_PRESENT by removing the define in aesopt.h, please tell me if there is a better way.
In any case, this actually helped, I was able to compile it. I'm not an expert in these tings, what does that mean for the library compilation? Does it make any difference? Will AES still be available?

@nmoinvaz
Copy link
Member

nmoinvaz commented Feb 8, 2019

All it does is remove some Intel CPU optimizations for the AES library. You will still be able to use AES but it won't be as fast.

@nmoinvaz nmoinvaz closed this as completed Feb 8, 2019
@nmoinvaz nmoinvaz added 1.2 Related to older version of minizip 1.2 compilation Issues related to compiling source code encryption Encryption/decryption issue labels Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.2 Related to older version of minizip 1.2 compilation Issues related to compiling source code encryption Encryption/decryption issue
Projects
None yet
Development

No branches or pull requests

2 participants