test/v3ext.c fails to compile on MacOS11 arm64
Building using: ./Configure no-shared no-gost darwin64-arm64-cc -g -fPIC -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -mmacosx-version-min=11.1 fails with:
clang -Iinclude -arch arm64 -O3 -Wall -g -fPIC -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk -mmacosx-version-min=11.1 -D_REENTRANT -DNDEBUG -MMD -MF test/v3ext.d.tmp -MT test/v3ext.o -c -o test/v3ext.o test/v3ext.c
test/v3ext.c:201:24: error: implicitly declaring library function 'memcmp' with type 'int (const void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
if (!TEST_true(memcmp(ip1->data, ip2->data, ip1->length) <= 0))
^
test/v3ext.c:201:24: note: include the header <string.h> or explicitly provide a declaration for 'memcmp'
1 error generated.
make[1]: *** [test/v3ext.o] Error 1
Adding #include <string.h> to test/v3ext.c resolves the error (other tests already explicitly include string.h)
Also hit this bug. Further confirmed via CI: https://github.com/openssl/openssl/runs/7190875851?check_suite_focus=true
I encountered this on NonStop also, but the case was open by the time I got to it. Worked around it in my case. Will deal with the conflict at 1.1.1r.
I have stumbled across exactly this problem today as well. I am building openssl for iOS and its arm64 build (and I think the x64 build as well) fails with the exact same error. I am using XCode 12.5.1. The last version I have used before was 1.1.1.n and that worked without any problems.
Yes, it is a genuine issue with 1.1.1q. A fix has already been committed to the OpenSSL_1_1_1-stable branch and should be in the next version of 1.1.1.
To fix is to add a line #include <string.h> at the top of test/v3ext.c, if you don't want to use the stable branch or wait for the next 1.1.1 release.
How can I do, to install this patch ?
Waiting for the new release with the fix.
My patch looks like this and I apply it in my build script with patch -u test/v3ext.c v3ext.c.patch in case this helps anybody:
diff -u bad/v3ext.c good/v3ext.c --- bad/v3ext.c 2022-07-05 11:08:33.000000000 +0200 +++ good/v3ext.c 2022-07-09 13:04:28.449762000 +0200 @@ -8,6 +8,7 @@ */
#include <stdio.h> +#include <string.h> #include <openssl/x509.h> #include <openssl/x509v3.h> #include <openssl/pem.h>
I was trying to install rbenv install 2.7.6. Having this issue now:(
rbenv install 2.7.6
Downloading openssl-1.1.1q.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca
Installing openssl-1.1.1q...
BUILD FAILED (macOS 12.0.1 using ruby-build 20220710)
...
test/v3ext.c:201:24: error: implicitly declaring library function 'memcmp' with type 'int (const void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
if (!TEST_true(memcmp(ip1->data, ip2->data, ip1->length) <= 0))
Still facing this issue.. What can we do to fix this?
Still facing this issue.. What can we do to fix this?
Either wait until 1.1.1r is out or apply the patch yourself, it is not that hard.
I think for rbenv users all we can do is wait, since it attempts to download a new version everytime you run a install command. Correct me if I'm wrong but that's what I've noticed at least.
Four downloads of the same version, once for each attempt.
ruby-build.20220711152759.90203.iUixfj/openssl-1.1.1q/test/v3ext.c
ruby-build.20220711152259.75171.IpsEZO/openssl-1.1.1q/test/v3ext.c
ruby-build.20220711151859.60116.1Coe7H/openssl-1.1.1q/test/v3ext.c
ruby-build.20220711151540.44657.nTmFzb/openssl-1.1.1q/test/v3ext.c
Found a workaround here, helped me
I was trying to install
rbenv install 2.7.6. Having this issue now:(rbenv install 2.7.6 Downloading openssl-1.1.1q.tar.gz... -> https://dqw8nmjcqpjn7.cloudfront.net/d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca Installing openssl-1.1.1q... BUILD FAILED (macOS 12.0.1 using ruby-build 20220710) ... test/v3ext.c:201:24: error: implicitly declaring library function 'memcmp' with type 'int (const void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration] if (!TEST_true(memcmp(ip1->data, ip2->data, ip1->length) <= 0))
I'm facing the same issue unfortunatelly, is there any workaround for rbenv? Or the only option is to wait until the release?
OPENSSL_CFLAGS=-Wno-error=implicit-function-declaration should help for rbenv / ruby-build. (https://github.com/rbenv/ruby-build/issues/1998)
I was trying to install
rbenv install 2.7.6. Having this issue now:(rbenv install 2.7.6 Downloading openssl-1.1.1q.tar.gz... -> https://dqw8nmjcqpjn7.cloudfront.net/d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca Installing openssl-1.1.1q... BUILD FAILED (macOS 12.0.1 using ruby-build 20220710) ... test/v3ext.c:201:24: error: implicitly declaring library function 'memcmp' with type 'int (const void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration] if (!TEST_true(memcmp(ip1->data, ip2->data, ip1->length) <= 0))I'm facing the same issue unfortunatelly, is there any workaround for rbenv? Or the only option is to wait until the release?
This tutorial helped me get past the issue, https://dev.to/yasuhiron777/install-2x-3x-version-of-ruby-via-rbenv-on-m1-mac-3okn
just add this at the end of your .zshrc file after installing openssl-1.1.1
export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH"
I was trying to install
rbenv install 2.7.6. Having this issue now:(rbenv install 2.7.6 Downloading openssl-1.1.1q.tar.gz... -> https://dqw8nmjcqpjn7.cloudfront.net/d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca Installing openssl-1.1.1q... BUILD FAILED (macOS 12.0.1 using ruby-build 20220710) ... test/v3ext.c:201:24: error: implicitly declaring library function 'memcmp' with type 'int (const void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration] if (!TEST_true(memcmp(ip1->data, ip2->data, ip1->length) <= 0))I'm facing the same issue unfortunatelly, is there any workaround for rbenv? Or the only option is to wait until the release?
you can download older version from git (v20220630) or use asdf ASDF_RUBY_BUILD_VERSION=v20220630 asdf install ruby 2.7.6
Installing previous version and linking it for ruby install helped me https://github.com/rbenv/ruby-build/discussions/1940#discussioncomment-2663209
Hit this issue as well. What I am also curious about is why is the test/ code built during the normal (rbenv in my case) build? Do we even care about test code? Do these tests actually run and check anything or are they just built and forgotten?..
make test runs them. Doing this is recommended.
is there a param to skip that step?
make apps/openssl might be enough.
Sorry for a bit offtopic, I want to disable the unit tests compilation because of this problem, I tried with perl Configure no-unit-test but this problematic file still compiles and I got error. Tried also no-acvp-tests and that option is not recognized.
Thanks
Sorry for a bit offtopic, I want to disable the unit tests compilation because of this problem, I tried with
perl Configure no-unit-testbut this problematic file still compiles and I got error. Tried alsono-acvp-testsand that option is not recognized. Thanks
None of these would help. Does adding -Wno-error=implicit-function-declaration to the Configure line help you?
Sorry for a bit offtopic, I want to disable the unit tests compilation because of this problem, I tried with
perl Configure no-unit-testbut this problematic file still compiles and I got error. Tried alsono-acvp-testsand that option is not recognized. ThanksNone of these would help. Does adding
-Wno-error=implicit-function-declarationto the Configure line help you?
Seems that no-tests worked. :)
Thanks
Where can you find test/v3ext.c ?
mac asdf peeps that have ended up in this thread: (openssl 1.1.1q preventing install)
Intel:
ASDF_RUBY_BUILD_VERSION=v20220630 asdf install ruby SOME_VERSION
M1:
optflags=-Wno-error=implicit-function-declaration ASDF_RUBY_BUILD_VERSION=v20220630 asdf install ruby SOME_VERSION
(thank you @frozen92) (thank you @captain-enjoyable for digging into this and finding this thread)
OPENSSL_CFLAGS=-Wno-error=implicit-function-declaration rbenv install 2.7.6 worked for me
Hi I also kept running into this on 'Mac OS X 10.15.7 using ruby-build' I had to set both of the following variables at the same time before the rbenv install 3.0.1 command:
OPENSSL_CFLAGS=-Wno-error=implicit-function-declaration RUBY_CONFIGURE_OPTS=--with-readline-dir="$(brew --prefix readline)" rbenv install 3.0.1
This is happening with a generic build on MacOS11 x86_64 (darwin64-x86_64-cc) architecture as well (not just arm64):
${LDCMD:-cc} -arch x86_64 -O3 -Wall -L. -Wl,-search_paths_first \
-o test/uitest test/uitest.o \
apps/libapps.a -lssl test/libtestutil.a -lcrypto
cc -Iinclude -arch x86_64 -O3 -Wall -D_REENTRANT -DNDEBUG -MMD -MF test/v3ext.d.tmp -MT test/v3ext.o -c -o test/v3ext.o test/v3ext.c
test/v3ext.c:201:24: error: implicitly declaring library function 'memcmp' with type 'int (const void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
if (!TEST_true(memcmp(ip1->data, ip2->data, ip1->length) <= 0))
^
test/v3ext.c:201:24: note: include the header <string.h> or explicitly provide a declaration for 'memcmp'
1 error generated.
make[1]: *** [test/v3ext.o] Error 1
make: *** [all] Error 2
@jasonacox Yes, it is a "generic" bug and not related to the architecture you build for. It causes a build error only on macOS because the clang on macOS implicitly adds -Wimplicit-function-declaration in -Wall, which it doesn't on Linux. The fix is in the OpenSSL_1_1_1-stable branch and will be in the next release of 1.1.1 - in the file test/v3ext.c, after the line #include <stdio.h> near the top, add a line that says
#include <string.h>