简体   繁体   English

OpenSSL 错误构建 Erlang OTP 从源

[英]OpenSSL error building Erlang OTP from source

Trying to build a completely self-contained OTP that can be moved around independently of libs installed on a system.尝试构建一个完全独立的 OTP,它可以独立于系统上安装的库移动。

Build OpenSSL 1.0.0d from source as follows:从源代码构建 OpenSSL 1.0.0d,如下所示:

./config --prefix=<open-ssl-dir>
make
make install

Then OTP R14B03:然后是 OTP R14B03:

./configure --prefix=<erlang-dir> --with-ssl=<open-ssl-dir> --without-termcap

Make of Erlang then fails as follows: Erlang 的制造然后失败如下:

relocation R_X86_64_32 against `OPENSSL_ia32cap_P' can not be used when making a shared object; recompile with -fPIC

We're talking Ubuntu 10.04.我们说的是 Ubuntu 10.04。 Any help greatly appreciated - thanks!非常感谢任何帮助 - 谢谢!

The "can not be used when making a shared object; recompile with -fPIC" would mean SSL is not build with the Position Independent Code flag. “在制作共享 object 时无法使用;使用 -fPIC 重新编译”意味着 SSL 不是使用 Position 独立代码标志构建的。 This is needed for building it as a Dynamic Shared Object (DSO).这是将其构建为动态共享 Object (DSO) 所必需的。 This is probably needed by Erlang build process.这可能是 Erlang 构建过程需要的。 Example build:示例构建:

$ tar zxvf openssl-0.x.tar.gz
$ cd openssl-x
$ sh config shared -fPIC
$ make
$ sudo make install

For ppc64le:对于 ppc64le:

./configure --prefix=/home/huaxin/huaxin/toolsInstalled/ --build=ppc64le CFLAGS="-D_GNU_SOURCE -DOPENSSL_NO_EC=1"

I suggest that you build on a VM where you have sudo permissions.我建议您在具有 sudo 权限的 VM 上构建。 Then build libraries like OpenSSL using --prefix=/usr so that make install puts them in the usual system library.然后使用 --prefix=/usr 构建像 OpenSSL 这样的库,以便 make install 将它们放在通常的系统库中。

Then build your tool, in this case Erlang, using -rpath.然后使用 -rpath 构建您的工具,在本例中为 Erlang。 Then use ldd to find all library dependencies for Erlang and any ports (C extensions) and copy those into Erlangs lib directory.然后使用ldd查找 Erlang 和任何端口(C 扩展)的所有库依赖项,并将它们复制到 Erlangs lib 目录中。 Check all binaries and libraries with readelf -d to make sure that RPATH is set to $ORIGIN or $ORIGIN/../lib as needed.使用 readelf -d 检查所有二进制文件和库,以确保根据需要将 RPATH 设置为 $ORIGIN 或 $ORIGIN/../lib。 Use patchelf to fix these things if the linking process is not quite right (or you copied in secondary dependencies of system libraries).如果链接过程不太正确(或者您复制了系统库的辅助依赖项),请使用 patchelf 修复这些问题。

Then use patchelf to set the interpreter for your binaries (not libraries) to point to ld-linux.so.2 in Erlang's lib directory.然后使用 patchelf 将二进制文件(而不是库)的解释器设置为指向 Erlang 的 lib 目录中的 ld-linux.so.2。 And then run a test suite using然后使用运行测试套件

strace -e open erl... to make sure that your build is not opening anything in /lib or /usr/lib. strace -e open erl...以确保您的构建没有打开 /lib 或 /usr/lib 中的任何内容。

At this point tar it up and it will run on any Linux.此时 tar 起来,它将在任何 Linux 上运行。

See this question Compiling Python 2.6.6 and need for external packages wxPython, setuptools, etc... in Ubuntu for far more detail on how I built Python in this fashion.请参阅此问题Compiling Python 2.6.6 and need for external packages wxPython, setuptools, etc... in Ubuntu以了解有关我如何以这种方式构建 ZA7F5F35426B92378211FC92313B 的更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM