在MAC OS X上编译Httrack

时间:2015-12-16 19:20:14

标签: macos openssl httrack

我正在尝试在我的MAC上编译httrack。 ./configure成功。但是在编译程序包时我遇到了错误,并且无法解决它。

In file included from htscore.c:40:
In file included from ./htscore.h:81:
In file included from ./htslib.h:67:
./htsbasenet.h:76:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
      ^
2 warnings and 1 error generated.
make[2]: *** [libhttrack_la-htscore.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

也试过这个解决方案,但没有运气 https://serverfault.com/questions/283271/how-to-get-httrack-to-work-with-ssl-on-mac-os-x-libssl-so-not-found

Openssl位于/ usr / include / openssl

3 个答案:

答案 0 :(得分:5)

如果你可以没有HTTPS,那么

@model ShowUserProjectsViewModel

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

@foreach (var item in Model.Projects)
{
    <div>
        <p>@Html.DisplayFor(m=>item.ProjectName)</p>
    </div>
}

应该足够了。

答案 1 :(得分:3)

如果您想要安装非Apple软件包并安装homebrew之类的软件包管理器,这是一个问题,这是从homebrew website复制和粘贴一行的问题。

然后你可以找到你想要的任何包:

brew search httrack

并安装它们并使用

构建它们
brew install httrack

并使用

删除它们
brew rm httrack

并使用

更新所有已安装的软件包
brew update && brew upgrade --all && brew cleanup

答案 2 :(得分:3)

听起来你在路径上没有OpenSSL,或者Httrack没有拿起它。似乎Httrack没有configure选项来指定OpenSSL目录。

Httrack似乎还拒绝任何低于OpenSSL 1.0.1g(Heartbleed)的东西。 OS X默认提供OpenSSL 0.9.8,因此您应该downloadinstall最新版本的OpenSSL。

获得OpenSSL的更新版本后,通过CFLAGSLDFLAGS导出所需的路径。 Httrack自己选择LDLIBS

$ export CFLAGS="-I/usr/local/ssl/macosx-x64/include"
$ export LDFLAGS="-L/usr/local/ssl/macosx-x64/lib"

$ ./configure 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
...
config.status: executing depfiles commands
config.status: executing libtool commands

$ cat ./config.log | grep -i openssl
| #define HTS_USEOPENSSL 1
| #define HTS_USEOPENSSL 1
OPENSSL_LIBS='-lcrypto -lssl'
#define HTS_USEOPENSSL 1

以上内容来自OS X 10.8.5和Htrack 3.48.21

您可以验证OpenSSL是否与以下内容相关联:

$ find . -name *.dylib
./libtest/.libs/libbaselinks.dylib
...
./src/.libs/libhtsjava.dylib
./src/.libs/libhttrack.dylib

然后:

$ otool -L ./src/.libs/libhttrack.dylib | grep -i ssl
    /usr/local/ssl/macosx-x64/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/local/ssl/macosx-x64/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)

您应该能够在安装之前使用make check

测试构建
$ make
...

$ make check
...
PASS: 00_runnable.test
PASS: 01_engine-charset.test
PASS: 01_engine-entities.test
md5 selftest succeeded
hashtable summary: size=262144 (lg2=18) used=72619 stash-size=0 pool-size=6693195 pool-capacity=8388608 pool-used=6480537 writes=6600000 (new=175000) moved=44471 stashed=4 max-stash-size=1 avg-moved=0.25412 rehash=14 pool-compact=15 pool-realloc=30 memory=14680688
all hashtable tests were successful!
PASS: 01_engine-hashtable.test
PASS: 01_engine-idna.test
PASS: 01_engine-simplify.test
online tests are disabled
skipping online unit tests
SKIP: 10_crawl-simple.test
online tests are disabled
skipping online unit tests
SKIP: 11_crawl-cookies.test
online tests are disabled
skipping online unit tests
SKIP: 11_crawl-idna.test
online tests are disabled
skipping online unit tests
SKIP: 11_crawl-international.test
online tests are disabled
skipping online unit tests
SKIP: 11_crawl-longurl.test
online tests are disabled
skipping online unit tests
SKIP: 11_crawl-parsing.test
online tests are disabled
skipping online unit tests
SKIP: 12_crawl_https.test
======================
All 6 tests passed
(7 tests were not run)
======================
make[2]: Leaving directory '/Users/.../httrack-3.48.21/tests'
make[1]: Leaving directory '/Users/.../httrack-3.48.21/tests'
make[1]: Entering directory '/Users/.../httrack-3.48.21'
make[1]: Nothing to be done for 'check-am'.
make[1]: Leaving directory '/Users/.../httrack-3.48.21'

我不知道为什么在线测试执行,因为它们默认启用:

$ ./configure --help | grep -i online
    --enable-online-unit-tests=[yes/no/auto]
                                    Enable online-unit-tests [default=yes]

另见Issue 92: 'make check' and "uname: illegal option -- o" on OS X

他们使用OpenSSL看起来有改进的余地......您可以考虑打开src/htslib.c,向下滚动到第5166行:

// OpenSSL_add_all_algorithms();
openssl_ctx = SSL_CTX_new(SSLv23_client_method());
if (!openssl_ctx) {
  fprintf(stderr,
          "fatal: unable to initialize TLS: SSL_CTX_new(SSLv23_client_method)\n");
  abortLog("unable to initialize TLS: SSL_CTX_new(SSLv23_client_method)");
  assertf("unable to initialize TLS" == NULL);
}

将其更改为:

// OpenSSL_add_all_algorithms();
openssl_ctx = SSL_CTX_new(SSLv23_client_method());
if (!openssl_ctx) {
  fprintf(stderr, "fatal: unable to initialize TLS: SSL_CTX_new(SSLv23_client_method)\n");
  abortLog("unable to initialize TLS: SSL_CTX_new(SSLv23_client_method)");
  assertf("unable to initialize TLS" == NULL);
}

const long flags = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_COMPRESSION;
SSL_CTX_set_options(openssl_ctx, flags);

const char PREFERRED_CIPHERS[] = "HIGH:!aNULL:!kRSA:!PSK:!SRP:!MD5:!RC4";
long res = SSL_CTX_set_cipher_list(openssl_ctx, PREFERRED_CIPHERS);
if (res != 1) {
  fprintf(stderr, "fatal: unable to initialize TLS: SSL_CTX_set_cipher_list(PREFERRED_CIPHERS)\n");
  abortLog("unable to initialize TLS: SSL_CTX_set_cipher_list(PREFERRED_CIPHERS)");
  assertf("unable to initialize TLS" == NULL);
}

您还可以做其他一些事情。请参阅OpenSSL wiki上的SSL/TLS Client