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

Compiling It Successfully on Newer Distributions / g++ Versions #33

Open
ossie-git opened this issue Jan 22, 2023 · 2 comments
Open

Compiling It Successfully on Newer Distributions / g++ Versions #33

ossie-git opened this issue Jan 22, 2023 · 2 comments

Comments

@ossie-git
Copy link

Compiling lua-requests on any modern distribution will fail with the following error on any modern Linux distribution:

$ luarocks install lua-requests
...
gcc -O2 -fPIC -I/usr/include/lua5.3 -c src/Parser.cpp -o src/Parser.o -Iinclude -Isrc/bind -Isrc/vendor
In file included from include/xml/Parser.h:33,
                 from src/Parser.cpp:1:
src/bind/dub/dub.h:298:48: error: ISO C++17 does not allow dynamic exception specifications
  298 | lua_Number checknumber(lua_State *L, int narg) throw(dub::TypeException);
      |                                                ^~~~~
src/bind/dub/dub.h:299:50: error: ISO C++17 does not allow dynamic exception specifications
  299 | lua_Integer checkinteger(lua_State *L, int narg) throw(dub::TypeException);
      |                                                  ^~~~~
src/bind/dub/dub.h:300:63: error: ISO C++17 does not allow dynamic exception specifications
  300 | const char *checklstring(lua_State *L, int narg, size_t *len) throw(dub::TypeException);
      |                                                               ^~~~~
src/bind/dub/dub.h:301:82: error: ISO C++17 does not allow dynamic exception specifications
  301 | void **checkudata(lua_State *L, int ud, const char *tname, bool keep_mt = false) throw(dub::Exception);
      |                                                                                  ^~~~~
src/bind/dub/dub.h:304:82: error: ISO C++17 does not allow dynamic exception specifications
  304 | void **checksdata(lua_State *L, int ud, const char *tname, bool keep_mt = false) throw(dub::Exception);
      |                                                                                  ^~~~~
src/bind/dub/dub.h:307:62: error: ISO C++17 does not allow dynamic exception specifications
  307 | void **checksdata_d(lua_State *L, int ud, const char *tname) throw(dub::Exception);
      |                                                              ^~~~~
src/bind/dub/dub.h:317:56: error: ISO C++17 does not allow dynamic exception specifications
  317 | inline const char *checkstring(lua_State *L, int narg) throw(dub::TypeException) {
      |                                                        ^~~~~

Error: Failed installing dependency: https://luarocks.org/xml-1.1.3-1.src.rock - Build error: Failed compiling object src/Parser.o

The problem is due to a C++ feature that was removed in C++17, which is used by newer versions of gcc. To get around this, you can either:

  • install and use an older version of g++
  • pass in flags to tell it to compile using C++14 mode instead

For more on the second option and how to update your .rockspec to do so, refer to this.

@ElGrats
Copy link

ElGrats commented Dec 12, 2023

Using solution via .rockspec for lua xml to install lua-requests (Debian 12, lua 5.3)
I tried this way:

apt-get install libssl-dev
luarocks install luasec
cd /usr/src
git clone https://github.com/lubyk/xml xml_lua
git clone https://gist.github.com/ossie-git/ffddb4fd619c93db6baa45b62a65b89b rockspec
cp /usr/src/rockspec/xml-1.1.3-1.rockspec /usr/src/xml_lua/xml-1.1.3-1.rockspec
cd /usr/src/xml_lua
luarocks install xml-1.1.3-1.rockspec
luarocks install lua-requests

i'v got the next:

[ERR] mod_lua.cpp:202 /usr/local/share/lua/5.3/requests.lua:8: module 'xml' not found:
        no field package.preload['xml']
        no file '/usr/local/share/lua/5.3/xml.lua'
        no file '/usr/local/lib/lua/5.3/xml.so'
stack traceback:
        [C]: in function 'require'
        /usr/local/share/lua/5.3/requests.lua:8: in main chunk
        [C]: in function 'require'
        [string "line"]:1: in main chunk

Where is my mistake?

@Freed-Wu
Copy link

you can use a fork of xml by this rockspec: lubyk/xml#20 (comment)

This is upstream's bug. please close it.

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

No branches or pull requests

3 participants