Error when running luarocks install for kong 1.0.3

I’ve been looking to create a local development environment akin to Kong Enterprise 0.35-4 for custom plugin development. The enterprise changelogs indicate that the Kong Community Edition which corresponds to this version of enterprise is Kong 1.0.3. As part of the steps for installing from source, I’m supposed to run the following command:

luarocks install kong 1.0.3

When doing so (even working around the lyaml weirdness that should probably be mentioned in the documentation), I get the following error when luarocks is installing lua_system_constants 0.1.2:

gcc -shared -L -o lua_system_constants.so lua_system_constants.o
gcc: error: lua_system_constants.so: No such file or directory

The error seems to come from the blank -L passed into the linker command. It seems that 0.1.3, a new version of the lua_system_constants published by Marco eight months ago, fixes that by refactoring the build steps for the module to be more standard. Using 0.1.3 would fix the issue, but currently the Kong Community 1.0.3 luarock hard requires lua_system_constants 0.1.2. Is this something we can fix, is there a reasonable workaround, or is there another suitable luarock to install instead of 1.0.3 when developing against enterprise 0.35? Thanks!

I’d recommend using github.com/kong/kong-vagrant to do custom plugin development.
That sets up Luarocks and OpenResty for you.

I’d like to use Vagrant, but my company’s security policy dictates that I’m not allowed to use vagrant virtual machines on my laptop. This is on top of my company’s setup having me used shared Jenkins build boxes for my CI/CD pipeline, boxes which also can’t use vagrant, meaning I need a local development environment one way or another.

In that case, you could follow the developer doc in the Kong repository to setup your local environment:

And then use that to build and test custom plugins.

Thanks for the link. I have two thoughts here:

  1. Should the Kong install from source docs be updated to use information from that link?
  2. If I’m doing plugin development against Kong, I should probably be developing against roughly the version of Kong Enterprise I’m using (which can be solved by checking out one of the Kong tags) but then, if I do that, I’m going to want to luarocks install that version of Kong, to pick up the appropriate luarock dependencies, right? If I do that with the community version of Kong corresponding to Kong Enterprise 0.35, namely Kong Community 1.0.3, I run in the package issue I describe above.

If I shouldn’t be luarocks installing anything I apologize, but I’ve found that developing plugins and running plugin unit tests doesn’t work quite right without running the luarocks install, but maybe I’m doing something wrong.

@tyree731 if not able to use Vagrant, can you use Docker? or is that also unavailable in your env?

If you can use Docker, then you might want to have a look at Pongo: https://github.com/Kong/kong-pongo It was recently released specifically for plugin development against Enterprise versions of Kong.

Unfortunately no when it comes to Docker as well. This would all be a lot easier if I could use Vagrant or Docker.

Then probably look at Pongo, and follow along the same lines, but without Docker. It’s based on a regular package/image, and then adds the development files (which are in the pongo repo). At least you won’t have to install Kong from source but can use a package

For the record, I ended up getting this working by passing in the following argument to luarocks install

CFLAGS="-O2 -fPIC -I<path to local include directory> -L<path to local lib directory>"