LHAPDF configure error - 2020.01.02

在Ubuntu18上安装LHAPDF6.2.3时遇到配置错误,尝试解决LHAPDF安装问题,包括配置错误和Cython问题。尽管gcc和g++已安装,但C++编译器无法创建可执行文件。

Nah nah nah nah…
I don’t want to finish this blog anymore, cuz the problem is way beyond my skill set so far. Once I overcome it, I’ll revisit this blog then and post about what I do.
Thanks

1. What I was doing on this bloody night

Who knows!

  • OS = Ubuntu 18
  • gcc = 5.5.0
  • g++ = 5.5.0
  • LHAPDF = 6.2.3/6.2.1/6.1.6/6.1.5

1.1 Before I run into this error

别人都告诉我LHAPDF是比较容易装的,我记得我之前装LHAPDF的时候也不觉得难,直到我遇到了今天这台机器。

  • LHAPDF-6.2.3

最开始的时候是LHAPDF-6.2.3的安装遇到了问题。老老实实按照LHAPDF installation instructions一步一步来,configure、make、make install都没有遇到什么大问题,但是在调用lhapdf的时候很明显可以看出来LHAPDF没有安装对。

lhapdf install CT14lo
Traceback (most recent call last):
  File "/usr/local/bin/lhapdf", line 442, in <module>
    for pdf in get_installed_list(options.PDFDIR):
  File "/usr/local/bin/lhapdf", line 237, in get_installed_list
    import lhapdf
ImportError: libLHAPDF.so: cannot open shared object file: No such file or directory

lhapdf list也会给出同样的错误,说明LHAPDF出了问题。然而lhapdf -h则可以给出LHAPDF的帮助文档,说明LHAPDF只是没有安好,而不是没有安装上。尝试良久,但找不到破解的方法。
一直关照我的小老师提醒了一下,LHAPDF installation instructions上说可以立c++的flag“-std=c++11”。但尝试后就会发现,./configure时并没有-std这个选项,进而改为

./configure CPPFLAGS=c++11 --prefix=/path/for/installation

但结果会变得更加恐怖

$ ./configure CPPFLAGS=c++11 --prefix=/usr/local
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for sw_vers... no
checking for g++... g++
checking whether the C++ compiler works... no
configure: error: in `/media/ms/Research/PDFit/LHAPDF/LHAPDF-6.2.1':
configure: error: C++ compiler cannot create executables
See `config.log' for more details

最令人挠头的是我明明安装了gcc和g++,但终端却告诉我C++ compiler没在工作。至此,并不知道该怎么办。

  • LHAPDF-6.2.1
    小老师说,要不咱尝试一下别的版本,看看是不是LHAPDF-6.2.3太新了的缘故。

剩下的明天在写,谢谢!

  • LHAPDF-6.1.6/6.1.5

1.2 Cython Problem

2. What I vainly tried

2.1 for configuration error

2.2 for Cython shit

<think>我们正在处理一个配置错误:执行`./configure`时出现`error: invalid option "--error.log-"`。这个错误表明在配置命令中有一个无效的选项`--error.log-`。 回顾用户提供的配置命令: ```bash ./configure --prefix=/usr/local/nginx-1.26.3 --sbin-path=/usr/sbin/nginx-1.26.3 --pid-path=/usr/local/nginx/nginx.pid --error-log- path=/usr/local/nginx-1.26.3/error.log --http-log-path=/usr/local/nginx-1.26.3/access.log --with-pcre=/usr/local/pcre-8.39 --with- zlib=/usr/local/zlib-1.2.11 --with-http_stub_status_module ``` 注意到在`--error-log-`后面有一个换行,使得参数被分成了两行,但在实际执行时,换行可能被忽略而导致选项被错误地拼接。观察配置命令,我们发现有一个明显的断行: 原命令中: ``` --error-log- path=/usr/local/nginx-1.26.3/error.log ``` 这会导致实际传递给`configure`脚本的选项是`--error-log-path`被分割成了`--error-log-`(因为换行符可能被忽略或者命令在输入时换行位置不当)。在大多数shell中,如果一行以`\`结束,下一行会作为同一命令的延续。但这里没有使用反斜杠,所以可能是直接复制粘贴时换行符被当作空格处理,从而形成了无效选项`--error.log-`(注意:原命令中写的是`--error-log-`,但错误信息中是`--error.log-`,这可能是一个笔误?) 但是,错误信息中提示的是`--error.log-`,而我们配置命令中写的是`--error-log-path`,所以这里可能是用户输入命令时写错了选项名。 根据错误信息`invalid option "--error.log-"`,我们可以推断: 1. 可能用户输入的命令中错误地将`--error-log-path`写成了`--error.log-path`,因为错误信息显示的是`--error.log-`(注意点号)。 2. 或者,在命令输入时,选项`--error-log-path`被错误地拆分成了`--error.log-`和`path=...`,并且由于点号的出现(可能是输入错误),导致配置脚本无法识别。 让我们检查配置命令:在原始命令中,我们看到的是`--error-log-`和下一行的`path=`,这会导致两个问题: - 选项名不完整:`--error-log-`不是一个完整的选项。 - 而且,在错误信息中,它变成了`--error.log-`,这可能是由于复制粘贴时引入了点号?或者用户在输入时误将连字符`-`输入成了点号`.`。 因此,解决方法如下: ### 步骤1: 检查命令中的选项名称 确保正确选项为`--error-log-path`(注意是连字符`-`,而不是点号`.`)。在配置命令中,应该写为: ``` --error-log-path=/usr/local/nginx-1.26.3/error.log ``` ### 步骤2: 修正命令行中的换行问题 确保选项`--error-log-path`及其参数在同一行,或者使用反斜杠`\`来连接多行。例如: 正确写法(在同一行): ```bash ./configure --prefix=/usr/local/nginx-1.26.3 \ --sbin-path=/usr/sbin/nginx-1.26.3 \ --pid-path=/usr/local/nginx/nginx.pid \ --error-log-path=/usr/local/nginx-1.26.3/error.log \ --http-log-path=/usr/local/nginx-1.26.3/access.log \ --with-pcre=/usr/local/pcre-8.39 \ --with-zlib=/usr/local/zlib-1.2.11 \ --with-http_stub_status_module ``` 或者在同一行输入(不换行): ```bash ./configure --prefix=/usr/local/nginx-1.26.3 --sbin-path=/usr/sbin/nginx-1.26.3 --pid-path=/usr/local/nginx/nginx.pid --error-log-path=/usr/local/nginx-1.26.3/error.log --http-log-path=/usr/local/nginx-1.26.3/access.log --with-pcre=/usr/local/pcre-8.39 --with-zlib=/usr/local/zlib-1.2.11 --with-http_stub_status_module ``` ### 步骤3: 验证选项的正确性 如果按照上述修正后仍然出现同样的错误,请检查是否在命令中无意中键入了点号(.)而不是连字符(-)。例如,错误地写成`--error.log-path`(点号)而不是`--error-log-path`(连字符)。 ### 步骤4: 检查配置脚本的帮助 可以查看配置脚本支持的选项,确认`--error-log-path`是否存在: ```bash ./configure --help | grep error-log-path ``` 正常情况下,应该输出: ``` --error-log-path=PATH set error log pathname ``` ### 错误原因总结 - **无效选项名称**:错误信息提示的选项`--error.log-`(带点号)不是有效的配置选项,正确的选项应该是`--error-log-path`(全部使用连字符)。 - **命令行换行问题**:原始命令中`--error-log-`和`path=`被分在两行,导致选项被截断。 ### 解决方案 1. 将配置命令中的`--error-log-`和下一行的`path=`合并为`--error-log-path=`,并确保其后的路径正确。 2. 检查整个命令,确保所有选项都正确书写(使用连字符`-`,而不是点号`.`),并且没有不必要的换行。 修正后的命令示例: ```bash ./configure \ --prefix=/usr/local/nginx-1.26.3 \ --sbin-path=/usr/sbin/nginx-1.26.3 \ --pid-path=/usr/local/nginx/nginx.pid \ --error-log-path=/usr/local/nginx-1.26.3/error.log \ --http-log-path=/usr/local/nginx-1.26.3/access.log \ --with-pcre=/usr/local/pcre-8.39 \ --with-zlib=/usr/local/zlib-1.2.11 \ --with-http_stub_status_module ``` 运行修正后的命令即可避免该错误。 §§相关问题§§ 1. Nginx的configure脚本常见选项有哪些? 2. 如何正确配置Nginx的日志路径? 3. 编译安装Nginx时常见错误及解决方法? </think>### 错误原因分析 执行 `./configure` 时出现 `error: invalid option "--error.log-"` 错误,主要是因为**选项名称格式不正确**。根据您提供的配置命令: ```bash --error-log- path=/usr/local/nginx-1.26.3/error.log ``` 问题出在: 1. **选项被错误分割**:`--error-log-path` 被分成两行书写(`--error-log-` + `path=`) 2. **连字符缺失**:正确选项应是 `--error-log-path` (使用连字符 `-`),而不是点号 `.` 或换行分割 3. **空格问题**:选项和参数之间不应有空格(`=` 直接连接参数) ### 解决方案 #### 方法一:修正选项格式(推荐) 将选项合并为完整格式: ```bash ./configure \ --prefix=/usr/local/nginx-1.26.3 \ --sbin-path=/usr/sbin/nginx-1.26.3 \ --pid-path=/usr/local/nginx/nginx.pid \ --error-log-path=/usr/local/nginx-1.26.3/error.log \ # 修正点 --http-log-path=/usr/local/nginx-1.26.3/access.log \ --with-pcre=/usr/local/pcre-8.39 \ --with-zlib=/usr/local/zlib-1.2.11 \ --with-http_stub_status_module ``` 关键修改: 1. 将 `--error-log-` 和 `path=` 合并为 `--error-log-path=` 2. 确保使用连字符 `-` 而非点号 `.` 3. 删除选项和值之间的空格 #### 方法二:验证正确选项格式 通过帮助命令查看有效选项: ```bash ./configure --help | grep "error-log" # 正确输出应显示:--error-log-path=PATH ``` #### 方法三:解决路径权限问题(预防性措施) 若修正后仍报错,需确保日志目录可写: ```bash sudo mkdir -p /usr/local/nginx-1.26.3 sudo touch /usr/local/nginx-1.26.3/error.log sudo chmod 644 /usr/local/nginx-1.26.3/error.log ``` ### 错误预防建议 1. **避免换行分割选项**:使用 `\` 安全换行 ```bash --error-log-path=/path/to/error.log \ # 正确换行 --http-log-path=/path/to/access.log ``` 2. **检查选项拼写**:Nginx 选项均为 `--kebab-case` 格式(小写+连字符) 3. **预验证命令**:使用 `echo` 检查最终命令 ```bash echo ./configure --error-log-path=/test # 输出应无空格或截断 ``` ### 原理说明 Nginx 的 `configure` 脚本通过 `getopt` 解析选项,要求: - 选项格式:`--option-name=value`(无空格) - 命名规则:仅接受小写字母和连字符的组合 - 语法规范:不支持选项截断或分隔符变化[^1] 当遇到 `--error.log-` 这种包含点号且不完整的格式时,解析器会直接拒绝[^3]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值