2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

rubyとopenssl 1.1の組み合わせでビルドエラー

Last updated at Posted at 2018-03-28

MacOSX 10.8.5
ruby 2.2.9

$ curl --version
curl 7.59.0 (x86_64-apple-darwin12.6.0) libcurl/7.59.0 OpenSSL/1.1.0h zlib/1.2.11
Release-Date: 2018-03-14
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy 

$ openssl version
OpenSSL 1.1.0h  27 Mar 2018

参考にした。
MacにRubyをソースからインストールする - Qiita

#1.ruby 2.2.9 configure

.bash_profile
export LDFLAGS='-L/usr/local/openssl/lib':$LDFLAGS
export LDFLAGS='-L/usr/local/readline/lib':$LDFLAGS

export CPPFLAGS='-I/usr/local/openssl/include':$CPPFLAGS
export CPPFLAGS='-I/usr/local/readline/include':$CPPFLAGS
./configure --with-openssl-dir=/usr/local/openssl -with-readline-dir=/usr/local/readline

#2.make でビルドエラー

makeすると、
openssl_missing.h
などでエラーが多数。

compiling openssl_missing.c
In file included from openssl_missing.c:21:
./openssl_missing.h:78:31: error: too many arguments provided to function-like macro invocation
EVP_MD_CTX *EVP_MD_CTX_create(void);
                              ^
/usr/local/openssl/include/openssl/evp.h:500:10: note: macro 'EVP_MD_CTX_create' defined here
# define EVP_MD_CTX_create()     EVP_MD_CTX_new()
         ^
In file included from openssl_missing.c:21:
./openssl_missing.h:82:22: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
void EVP_MD_CTX_init(EVP_MD_CTX *ctx);
     ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/local/openssl/include/openssl/evp.h:501:52: note: expanded from macro 'EVP_MD_CTX_init'
# define EVP_MD_CTX_init(ctx)    EVP_MD_CTX_reset((ctx))
                                                   ^
In file included from openssl_missing.c:21:
./openssl_missing.h:82:6: error: conflicting types for 'EVP_MD_CTX_reset'
void EVP_MD_CTX_init(EVP_MD_CTX *ctx);
     ^
/usr/local/openssl/include/openssl/evp.h:501:34: note: expanded from macro 'EVP_MD_CTX_init'
# define EVP_MD_CTX_init(ctx)    EVP_MD_CTX_reset((ctx))
                                 ^
/usr/local/openssl/include/openssl/evp.h:498:5: note: previous declaration is here
int EVP_MD_CTX_reset(EVP_MD_CTX *ctx);
    ^
In file included from openssl_missing.c:21:
./openssl_missing.h:90:25: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
     ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/local/openssl/include/openssl/evp.h:502:51: note: expanded from macro 'EVP_MD_CTX_destroy'
# define EVP_MD_CTX_destroy(ctx) EVP_MD_CTX_free((ctx))
                                                  ^
In file included from openssl_missing.c:21:
./openssl_missing.h:90:6: error: conflicting types for 'EVP_MD_CTX_free'
void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
     ^
/usr/local/openssl/include/openssl/evp.h:502:34: note: expanded from macro 'EVP_MD_CTX_destroy'
# define EVP_MD_CTX_destroy(ctx) EVP_MD_CTX_free((ctx))
                                 ^
/usr/local/openssl/include/openssl/evp.h:499:6: note: previous declaration is here
void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
     ^
openssl_missing.c:39:19: error: too many arguments provided to function-like macro invocation
EVP_MD_CTX_create(void)
                  ^
/usr/local/openssl/include/openssl/evp.h:500:10: note: macro 'EVP_MD_CTX_create' defined here
# define EVP_MD_CTX_create()     EVP_MD_CTX_new()
         ^
openssl_missing.c:39:18: error: expected ';' after top level declarator
EVP_MD_CTX_create(void)
                 ^
                 ;
2 warnings and 5 errors generated.
make[2]: *** [openssl_missing.o] Error 1
make[1]: *** [ext/openssl/all] Error 2
make[1]: *** Waiting for unfinished jobs....
installing default nkf libraries
compiling objspace_dump.c
linking shared-object objspace.bundle
linking shared-object date_core.bundle
linking shared-object nkf.bundle
make: *** [build-ext] Error 2

#3. 対策方法

rubyのビルドエラーは解決した。

ruby 2.5あるいは2.4を入れる。
opensslの1.0.2oを入れる。

ruby とopensslでインストール出来る組み合わせと出来ない組み合わせがあるらしい。

opensslの1.1を一旦削除。
openssl 1.0.2oをインストール。
ruby 2.5をインストール。ビルドエラーなし。

opensslのインストール先は /usr/local/opensslであることに注意。
(本環境はHomebrewを使ってない。)

これで解決した。

以上。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?