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

docs: 'how-to-build' add a troubleshooting of luasocket #3282

Closed
wants to merge 1 commit into from

Conversation

fukiki
Copy link
Contributor

@fukiki fukiki commented Jan 14, 2021

Signed-off-by: fukiki one.fhh@163.com

What this PR does / why we need it:

Document how-to-build.md should add a troubleshooting of luasocket

fix #3281
fix #3216

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@fukiki fukiki changed the title doc: 'how-to-build' add a troubleshooting of luasocket docs: 'how-to-build' add a troubleshooting of luasocket Jan 14, 2021
### Troubleshooting
**Compile and install luasocket**

If you run `make init` or `make run` to get an issue `Symbol not found: _luaL_openlib`, make sure to use the right version of luaSocket and lua. You can change lua 5.3.5 using LuaJIT or lua 5.1, if it still doesn't work, you can manually compile and install luasocket.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The English version is different from the Chinese one?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the makefile has processed this problem. so we call make deps should be enough for users.

https://github.com/apache/apisix/blob/master/Makefile#L55

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spacewander It should be unclear for my expression, I will modify it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@membphis This problem occurs after make deps, I will complete the detail and environments

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the version of your Lua and Luarocks? @fukiki

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@membphis macosx Lua 5.3.5 Luarocks 3.4.0

make: *** [linux] Error 2
```

Lua.h file was not found at compile time, installed in the system is lua 5.3.5_1, modify the compiler parameters:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is recommended to use LuaJIT if Lua 5.1 doesn't work.
Using Lua 5.3 may cause more problems, since we don't test it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Lua 5.3.5 is just for compile luasocket, not for the apisix

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The binary compiled with Lua 5.3 might not work properly with APISIX which runs under LuaJIT. We don't want to deal with weird problem.

Copy link
Contributor Author

@fukiki fukiki Jan 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be the setting of OS environment variables. The default Lua version of the operating system may not be 5.1 (maxos: Lua 5.4, fedora32: Lua 5.3).
But In APISIX some modules or dependencies require Lua 5.1, such as luasocket.
Therefore, you need to modify the local environment to install Lua 5.1.
If you want to continue to use Lua 5.3 or 5.4, you must use Lua 5.3 or 5.4 to recompile and install dependencies.
I think it's better to remind users in the document : APISIX is recommended to use LuaJIT or Lua 5.1.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for APISIX, we should use luajit or Lua 5.1 always.

For Luarocks 2.* , it works with Lua 5.1 normally, that is fine.
For Luarocks 3.*, it may work with Lua 5.1, 5.2 or 5.3. so we use luarocks install --lua-dir=$(LUAJIT_DIR) rockspec/apisix-master-0.rockspec --tree=deps --only-deps --local in makefile . It means we will use Luajit.

@Firstsawyou
Copy link
Contributor

ci failed,you need to deal with the spaces at the end of the line.

Scan detected 7 error(s) in 2 file(s):
  [./doc/how-to-build.md]:
     121: line has trailing whitespace.
     122: line has trailing whitespace.
     144: line has trailing whitespace.
  [./doc/zh-cn/how-to-build.md]:
     111: line has trailing whitespace.
     117: line has trailing whitespace.
     118: line has trailing whitespace.
     141: line has trailing whitespace.

### Troubleshooting
**Compile and install luasocket**

If you run `make init` or `make run` to get an issue `Symbol not found: _luaL_openlib`, make sure to use the right version of luaSocket and lua. You can change lua 5.3.5 using LuaJIT or lua 5.1, if it still doesn't work, you can manually compile and install luasocket.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the makefile has processed this problem. so we call make deps should be enough for users.

https://github.com/apache/apisix/blob/master/Makefile#L55

@fukiki
Copy link
Contributor Author

fukiki commented Jan 14, 2021

ci failed,you need to deal with the spaces at the end of the line.

Scan detected 7 error(s) in 2 file(s):
  [./doc/how-to-build.md]:
     121: line has trailing whitespace.
     122: line has trailing whitespace.
     144: line has trailing whitespace.
  [./doc/zh-cn/how-to-build.md]:
     111: line has trailing whitespace.
     117: line has trailing whitespace.
     118: line has trailing whitespace.
     141: line has trailing whitespace.

@Firstsawyou Thanks for your review, I will modify it.

@fukiki fukiki force-pushed the doc_improve branch 2 times, most recently from 9324b79 to f4e811e Compare January 14, 2021 07:21
Signed-off-by: fukiki <one.fhh@163.com>
@membphis
Copy link
Member

image

if the lua version is not 5.1, then the bin/apisix will wrong. we need a way to run the CLI with openresty-luajit always.

@fukiki
Copy link
Contributor Author

fukiki commented Jan 18, 2021

Resolved after discussion: using LuaJIT or Lua 5.1 instead is the best solution.
This pr is not too suitable to solve this problem, then close it.

@fukiki fukiki closed this Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants