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

xml luarocks does not compile C++17 compiler ( i.e. Ubuntu 22.04 LTS gcc) #19

Open
4mig4 opened this issue Jan 15, 2023 · 2 comments · May be fixed by #20
Open

xml luarocks does not compile C++17 compiler ( i.e. Ubuntu 22.04 LTS gcc) #19

4mig4 opened this issue Jan 15, 2023 · 2 comments · May be fixed by #20

Comments

@4mig4
Copy link

4mig4 commented Jan 15, 2023

When installing from Luarocks:

$ sudo luarocks install xml
Installing https://luarocks.org/xml-1.1.3-1.src.rock

xml 1.1.3-1 depends on lua >= 5.1, < 5.4 (5.1-1 provided by VM)
xml 1.1.3-1 depends on lub >= 1.0.3, < 2 (1.1.0-1 installed)
gcc -O2 -fPIC -I/usr/include/lua5.1 -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: Build error: Failed compiling object src/Parser.o

Compiler I am using is

$ gcc --version
gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
@4mig4 4mig4 changed the title xml luarocks does not compile with xml luarocks does not compile C++17 compiler ( i.e. Ubuntu 22.04 LTS gcc) Jan 15, 2023
@ossie-git
Copy link

ossie-git commented Jan 22, 2023

I ran into this issue as well. After some digging, I found out how to send CXXLAGS flags to the compiler to tell it to run in C++14 mode by updating the .rockspec file. The updated .rockspec file can be found here: https://gist.github.com/ossie-git/ffddb4fd619c93db6baa45b62a65b89b which compiles on newer distributions (including Ubuntu 22.04). Below is a local copy if you prefer to copy/paste:

package = "xml"
version = "1.1.3-1"
source = {
  url = 'git://github.com/lubyk/xml',
  tag = 'REL-1.1.3',
  dir = 'xml',
}
description = {
  summary = "Very fast xml parser based on RapidXML",
  detailed = [[
    This module is part of the Lubyk project.

    Main features are:
     - Fast and easy to use
     - Complete documentation
     - Based on proven code (RapidXML)
     - Full test coverage

    Read the documentation at http://doc.lubyk.org/xml.html.
  ]],
  homepage = "http://doc.lubyk.org/xml.html",
  license = "MIT"
}

dependencies = {
  "lua >= 5.1, < 5.4",
  "lub >= 1.0.3, < 2",
  "luarocks-build-extended"
}
build = {
  type = 'extended',
  modules = {
    -- Plain Lua files
    ['xml'            ] = 'xml/init.lua',
    ['xml.Parser'     ] = 'xml/Parser.lua',
    -- C module
    ['xml.core'       ] = {
      sources = {
        'src/Parser.cpp',
        'src/bind/dub/dub.cpp',
        'src/bind/xml_Parser.cpp',
        'src/bind/xml_core.cpp',
      },
      incdirs   = {'include', 'src/bind', 'src/vendor'},
    },
  },
  platforms = {
    freebsd = {
      modules = {
        ['xml.core'] = {
          sources = {
          },
          libraries = {'c++'},
        },
      },
    },
    linux = {
      modules = {
        ['xml.core'] = {
          sources = {
          },
	  variables = {
            CXXFLAG_EXTRAS = { "-std=c++14" }
	  },
          libraries = {'stdc++'},
        },
      },
    },
    macosx = {
      modules = {
        ['xml.core'] = {
          sources = {
          },
          libraries = {'stdc++'},
        },
      },
    },
  },
}

@ElGrats
Copy link

ElGrats commented Dec 11, 2023

After this solution for installing lua-requests (Debian 12, lua 5.3) 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

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

Where is my mistake?

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