Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: the generated rpm package cannot be started due to incorrect shebang #107

Closed
Chinaxiang opened this issue Oct 8, 2021 · 5 comments · Fixed by #125
Closed

bug: the generated rpm package cannot be started due to incorrect shebang #107

Chinaxiang opened this issue Oct 8, 2021 · 5 comments · Fixed by #125

Comments

@Chinaxiang
Copy link

通过此项目构建的 apisix rpm 包可执行文件不可用

构建命令:

make package type=rpm app=apisix version=2.10 checkout=2.10 local_code_path=./apisix-2.10.0

得到的安装包安装后,提示:

apisix help
/usr/local/openresty/luajit/bin/luajit: /usr/bin/apisix:4: unexpected symbol near '#'

查看 /usr/bin/apisix 发现:

#! /usr/local/openresty/luajit/bin/luajit
package.path = "/usr/local/apisix/?.lua;" .. package.path

#
...

应该是这个样子才对的吧:

#!/bin/bash

...

看了一下 install_common.sh 中的内容,这一块有问题

    if [ "${checkout_v}" = "master" ] || [ "${checkout_v:0:1}" != "v" -a "${checkout_v}" \> "2.2" ] || [ "${checkout_v:0:1}" = "v" -a "${checkout_v:1}" \> "2.2" ]; then
        echo 'use shell '
    else
        bin='#! /usr/local/openresty/luajit/bin/luajit\npackage.path = "/usr/local/apisix/?.lua;" .. package.path'
        sed -i "1s@.*@$bin@" /tmp/build/output/apisix/usr/bin/apisix
    fi
    cp -r /usr/local/apisix/* /tmp/build/output/apisix/usr/local/apisix/
    mv /tmp/build/output/apisix/usr/local/apisix/deps/share/lua/5.1/apisix /tmp/build/output/apisix/usr/local/apisix/
    if [ "${checkout_v}" = "master" ] || [ "${checkout_v:0:1}" != "v" -a "${checkout_v}" \> "2.2" ] || [ "${checkout_v:0:1}" = "v" -a "${checkout_v:1}" \> "2.2" ]; then
        bin='package.path = "/usr/local/apisix/?.lua;" .. package.path'
        sed -i "1s@.*@$bin@" /tmp/build/output/apisix/usr/local/apisix/apisix/cli/apisix.lua
    else
        echo ''
    fi
@imjoey
Copy link
Contributor

imjoey commented Oct 28, 2021

@Chinaxiang Hi, sorry for this late response. Could you please provide your environment, like OS distribution, luajit version, openresty version? Thanks.

BTW, could you have a try to install the official rpm instead to see if same error happens? See the guide in https://github.com/apache/apisix/blob/master/docs/en/latest/how-to-build.md#installation-via-rpm-repositorycentos-7.

@Chinaxiang
Copy link
Author

I think these codes have wrong:

checkout_v is 2.10, "2.10" \> "2.2" is false, so that cause /usr/bin/apisix has #! /usr/local/openresty/luajit/bin/luajit\npackage.path = "/usr/local/apisix/?.lua;" .. package.path

if [ "${checkout_v}" = "master" ] || [ "${checkout_v:0:1}" != "v" -a "${checkout_v}" \> "2.2" ] || [ "${checkout_v:0:1}" = "v" -a "${checkout_v:1}" \> "2.2" ]; then
  echo 'use shell '
else
  bin='#! /usr/local/openresty/luajit/bin/luajit\npackage.path = "/usr/local/apisix/?.lua;" .. package.path'
  sed -i "1s@.*@$bin@" /tmp/build/output/apisix/usr/bin/apisix
fi

@imjoey imjoey changed the title 构建的rpm包apisix不能用 bug: the generated rpm package cannot be started due to incorrect shebang Oct 28, 2021
@imjoey
Copy link
Contributor

imjoey commented Oct 29, 2021

Hi @Chinaxiang, this issue has been fixed via #125 . Thank you very much for your report. Please use the latest code for building apisix 2.10.x. Meanwhile, you can install the latest apisix 2.10.1 via https://repos.apiseven.com/packages/centos/7/x86_64/apisix-2.10.1-0.el7.x86_64.rpm. Your feedback is much appreciated.

@fbartels
Copy link

Hi @imjoey,

thanks for the new release with a freshly built 2.10.1 apisix is now starting for me.

@imjoey
Copy link
Contributor

imjoey commented Oct 29, 2021

Hi @imjoey,

thanks for the new release with a freshly built 2.10.1 apisix is now starting for me.

@fbartels very glad to see it works. Thanks you again for reporting. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants