如何使用相对rpath编译OpenSSL [英] How to compile OpenSSL with relative rpath

查看:112
本文介绍了如何使用相对rpath编译OpenSSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用以下rpath编译openssl 1.0.0g:

I have been trying to compile openssl 1.0.0g with the following rpath:

$ORIGIN/../lib64

每次我readelf -d apps/openssl时,我都会得到如下结果,具体取决于我尝试的转义变体形式:

Everytime I readelf -d apps/openssl, I am getting results like the following depending on what escaping variation I tried:

\RIGIN/../lib64
RIGIN/../lib64
ORIGIN/../lib64

我想设置我的rpath而不使用诸如chrpath之类的外部工具.有可能吗?我基本上会接受任何不涉及使用诸如chrpath之类的外部工具的东西(尽管我已经做完了).

I want to setup my rpath without using external tools like chrpath. Is it at all possible? I will basically accept anything that does not involve using external tools like chrpath (though I would already be done with that).

理想情况下,我想通过在命令行中传递选项(-Wl,-rpath,$ORIGIN/../lib64的任何形式)来做到这一点.

Ideally, I would like to do it by passing options on the command line (any form of -Wl,-rpath,$ORIGIN/../lib64).

我不介意编辑生成的Makefile,这是我最后一次尝试的操作.如果我能得到它打印一个愚蠢的美元符号!!!我试过在BUILDENV =块下修改LIBRPATH,但是没有运气.迄今为止我最好的成绩:

I don't mind editing the generated Makefile, which is what I have been trying last. If only I could get it to print a stupid dollar sign!!! I tried modifying LIBRPATH under the BUILDENV= block with no luck. My best results so far:

LIBRPATH=$$'ORIGIN/../lib64 # result: /../lib64
LIBRPATH=$$$$'ORIGIN/../lib64 # result: 12345<pid>/../lib64 

我已经阅读了与rpath相关的各种问题,并尝试了各种转义和引用技巧,但到目前为止没有任何效果!

I have read various rpath related questions and tried various escaping and quoting tricks but nothing worked so far!

推荐答案

在您的Makefile中尝试:

In your makefile try:

-Wl,-rpath,${ORIGIN}/../lib64

我假设 ORIGIN 是一个shell变量.

I am assuming that the ORIGIN is a shell variable.

编辑

我刚刚找到了您问题的答案(最好迟到再也没有): 您需要防止make插值变量,为此,您需要使用$$(双美元符号):

I have just found an answer to your question (better late then never): You need to prevent make from interpolating variables, to do that you need to use $$ (double dolar sign):

-Wl,-rpath,'$$ORIGIN/../lib64'

我知道它可行,因为我已经使用自己的应用程序对其进行了测试,请尽情享受:)

I know that it works because I have tested it with my own application, enjoy :)

这篇关于如何使用相对rpath编译OpenSSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆