【问题标题】:not found for architecture x86_64, macOS Sierra未找到架构 x86_64、macOS Sierra
【发布时间】:2017-05-18 04:33:51
【问题描述】:

背景:

是的,我知道使用 Brew 非常简单!已经测试并且可以工作了!

现在我正在试验 MacOS Sierra,并安装 httpd-2.4.25.tar.gz 启用 openssl。

我没有使用 Xcode 的经验!

$ openssl version
OpenSSL 1.1.0c  10 Nov 2016
$

$ which openssl
/usr/bin/openssl
$ 

$ cd /etc/ServerWeb/httpd
$ sudo ./configure  --prefix=/usr/local/ServerWeb/httpd  --enable-deflate  --enable-so  --enable-expires  --enable-headers  --enable-rewrite  --with-apr=/etc/ServerWeb/httpd/srclib/apr  --with-apr-util=/etc/ServerWeb/httpd/srclib/apr-util  -with-pcre=/etc/pcre  --with-z=/usr/include/zlib  --enable-ssl  --with-ssl=/etc/openssl

当我表演时:

    $ sudo make

我收到此错误!

/etc/ServerWeb/httpd/srclib/apr/build-1/libtool --silent --mode=compile gcc -I/etc/openssl/include  -g -O2      -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -DDARWIN_10   \
        -I. -I/private/etc/httpd-2.4.25/os/unix -I/private/etc/httpd-2.4.25/include -I/etc/ServerWeb/httpd/srclib/apr/include/apr-1 -I/private/etc/apr-util-1.5.4/include -I/usr/local/Cellar/pcre/8.39/include -I/private/etc/httpd-2.4.25/modules/aaa -I/private/etc/httpd-2.4.25/modules/cache -I/private/etc/httpd-2.4.25/modules/core -I/private/etc/httpd-2.4.25/modules/database -I/private/etc/httpd-2.4.25/modules/filters -I/private/etc/httpd-2.4.25/modules/ldap -I/private/etc/httpd-2.4.25/modules/loggers -I/private/etc/httpd-2.4.25/modules/lua -I/private/etc/httpd-2.4.25/modules/proxy -I/private/etc/httpd-2.4.25/modules/session -I/private/etc/httpd-2.4.25/modules/ssl -I/private/etc/httpd-2.4.25/modules/test -I/private/etc/httpd-2.4.25/server -I/private/etc/httpd-2.4.25/modules/arch/unix -I/private/etc/httpd-2.4.25/modules/dav/main -I/private/etc/httpd-2.4.25/modules/generators -I/private/etc/httpd-2.4.25/modules/mappers  -prefer-non-pic -static -c ab.c && touch ab.lo
ab.c:2398:28: warning: implicit declaration of function 'SSLv2_client_method' is invalid in C99 [-Wimplicit-function-declaration]
                    meth = SSLv2_client_method();
                        ^
ab.c:2398:26: warning: incompatible integer to pointer conversion assigning to 'const SSL_METHOD *' (aka 'const struct ssl_method_st *') from 'int' [-Wint-conversion]
                    meth = SSLv2_client_method();
                        ^ ~~~~~~~~~~~~~~~~~~~~~
ab.c:2412:28: warning: 'TLSv1_1_client_method' is deprecated [-Wdeprecated-declarations]
                    meth = TLSv1_1_client_method();
                        ^
/etc/openssl/include/openssl/ssl.h:1604:45: note: 'TLSv1_1_client_method' has been explicitly marked deprecated here
DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_1_client_method(void)) /* TLSv1.1 */
                                            ^
ab.c:2414:28: warning: 'TLSv1_2_client_method' is deprecated [-Wdeprecated-declarations]
                    meth = TLSv1_2_client_method();
                        ^
/etc/openssl/include/openssl/ssl.h:1610:45: note: 'TLSv1_2_client_method' has been explicitly marked deprecated here
DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_2_client_method(void)) /* TLSv1.2 */
                                            ^
ab.c:2417:28: warning: 'TLSv1_client_method' is deprecated [-Wdeprecated-declarations]
                    meth = TLSv1_client_method();
                        ^
/etc/openssl/include/openssl/ssl.h:1598:45: note: 'TLSv1_client_method' has been explicitly marked deprecated here
DEPRECATEDIN_1_1_0(__owur const SSL_METHOD *TLSv1_client_method(void)) /* TLSv1.0 */
                                            ^
ab.c:2468:5: warning: implicit declaration of function 'CRYPTO_malloc_init' is invalid in C99 [-Wimplicit-function-declaration]
    CRYPTO_malloc_init();
    ^
6 warnings generated.
/etc/ServerWeb/httpd/srclib/apr/build-1/libtool --silent --mode=link gcc  -g -O2   -L/etc/openssl/lib -lssl -lcrypto -lpthread  \
            -o ab  ab.lo       /private/etc/apr-util-1.5.4/libaprutil-1.la -lexpat -liconv /etc/ServerWeb/httpd/srclib/apr/lib/libapr-1.la -lpthread 
Undefined symbols for architecture x86_64:
"_CRYPTO_malloc_init", referenced from:
    _main in ab.o
"_SSLv2_client_method", referenced from:
    _main in ab.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [ab] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1
jb-MacBook:httpd jb$

据此:

Error when compiling some simple c++ code

ld: symbols not found for architecture x86_64, clang: linker command failed

ld: symbol(s) not found for architecture x86_64 (libusb)

我已经明白了...我需要将 gcc 更改为 c++clang 更改为 clang++ 或类似的。

但是,我没有使用xcode 应用程序,只有终端:

  • sudo ./configure ...
  • sudo make
  • sudo make install

必须在哪里改?

怎么做?

也许我需要编辑一些文件,哪个文件?

怎么算?

谢谢!

【问题讨论】:

    标签: linux xcode macos gcc clang++


    【解决方案1】:

    对于您的情况,无需编辑或更改文件。

    $ cd /etc/ServerWeb/httpd
    $ sudo ./configure  --prefix=/usr/local/ServerWeb/httpd  --enable-deflate  --enable-so  --enable-expires  --enable-headers  --enable-rewrite  --with-apr=/etc/ServerWeb/httpd/srclib/apr  --with-apr-util=/etc/ServerWeb/httpd/srclib/apr-util  -with-pcre=/etc/pcre  --with-z=/usr/include/zlib  --enable-ssl  --with-ssl=/etc/openssl
    $
    

    要更改编译器,您必须使用标志 CC

    您的案例示例:

    $ sudo CC=clang ./configure  --prefix=/usr/local/ServerWeb/httpd  --enable-deflate  --enable-so  --enable-expires  --enable-headers  --enable-rewrite  --with-apr=/etc/ServerWeb/httpd/srclib/apr  --with-apr-util=/etc/ServerWeb/httpd/srclib/apr-util  -with-pcre=/etc/pcre  --with-z=/usr/include/zlib  --enable-ssl  --with-ssl=/etc/openssl
    $
    

    CC=gcc,根据解决方案找到,不能使用空格指定值标志。

    【讨论】:

      【解决方案2】:

      您好,我遇到了类似的问题: httpd(2.4.25), openssl(1.0.2k) - Cannot compile in macOS Sierra Error on make: Undefined symbols for architecture x86_64: "_CRYPTO_malloc_init"

      我在 apr-util-1.5.4 上安装了正确的版本并配置了 openssl 启用加密:

      ./configure --prefix=/usr/local/mac-dev-env/apr-util-1.5.4 --with-apr=/usr/local/mac-dev-env/apr-1.5.2 --with-openssl=/usr/local/mac-dev-env/openssl-1.0.2k --with-crypto
      

      然后配置 apache 构建:

      ./configure --prefix=/usr/local/mac-dev-env/apache-2.4.25 --enable-so --enable-ssl  --with-ssl=/usr/local/mac-dev-env/openssl-1.0.2k --with-apr=/usr/local/apr --with-apr-util=/usr/local/mac-dev-env/apr-util-1.5.4 --with-ldap
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-03-03
        • 2019-09-04
        • 2017-12-23
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多