awesome icon indicating copy to clipboard operation
awesome copied to clipboard

Undefined reference errors on build.

Open yannosmoust opened this issue 4 years ago • 16 comments

Hello,

After I cloned the repo and installed a few dependencies manually and the rest via (apt build-dep awesome) I try to run make and get this:

` Building… [ 1%] Built target test-gravity

[ 4%] Built target generated_icons

[ 4%] Linking C executable lgi-check

/usr/bin/ld: CMakeFiles/lgi-check.dir/build-utils/lgi-check.c.o: in function `main':

lgi-check.c:(.text+0x1f): undefined reference to `luaL_newstate'

/usr/bin/ld: lgi-check.c:(.text+0x2f): undefined reference to `luaL_openlibs'

/usr/bin/ld: lgi-check.c:(.text+0x42): undefined reference to `luaL_loadstring'

/usr/bin/ld: lgi-check.c:(.text+0x6d): undefined reference to `lua_pcallk'

/usr/bin/ld: lgi-check.c:(.text+0x87): undefined reference to `lua_tolstring'

collect2: error: ld returned 1 exit status

make[3]: *** [CMakeFiles/lgi-check.dir/build.make:86: lgi-check] Error 1

make[2]: *** [CMakeFiles/Makefile2:8267: CMakeFiles/lgi-check.dir/all] Error 2

make[1]: *** [Makefile:152: all] Error 2

make: *** [Makefile:15: cmake-build] Error 2

`

I opened another issue earlier about a different error which was resolved after tweaking around with the lua modules, don't think they are related. Any help is greatly appreciated. Thank you

yannosmoust avatar Apr 26 '21 09:04 yannosmoust

tweaking around with the lua modules

This may have resulted in mixing different versions of Lua and LGI. What's the output of running cmake -B build -L in the project root?

sclu1034 avatar Apr 26 '21 10:04 sclu1034

@sclu1034 Here's the output:

-- lua -> /usr/bin/lua -- git -> /usr/bin/git -- asciidoctor -> /usr/bin/asciidoctor -- gzip -> /usr/bin/gzip -- ldoc -> /usr/bin/ldoc -- convert -> /usr/bin/convert -- Using version from git: v4.3-1005-g35e0acbc -- checking for execinfo -- found -- checking for round -- in libm -- Checking for module 'xcb-errors' -- No package 'xcb-errors' found -- xcb-errors not found. -- Disabled. -- busted -> /usr/bin/busted -- luacheck not found. -- Package version will be set to 4.3.0.0~git1005-g35e0acbc. -- Configuring done -- Generating done -- Build files have been written to: /home/name/awesome/build -- Cache values ASCIIDOCTOR_EXECUTABLE:FILEPATH=/usr/bin/asciidoctor AWESOME_DATA_PATH:PATH=/usr/local/share/awesome AWESOME_DOC_PATH:PATH=/usr/local/share/doc/awesome AWESOME_MAN_PATH:PATH=/usr/local/share/man AWESOME_XSESSION_PATH:PATH=/usr/local/share/xsessions BUSTED_EXECUTABLE:FILEPATH=/usr/bin/busted CMAKE_BUILD_TYPE:STRING= CMAKE_INSTALL_PREFIX:PATH=/usr/local COMPRESS_MANPAGES:BOOL=ON CONVERT_EXECUTABLE:FILEPATH=/usr/bin/convert CPACK_GENERATOR:STRING=DEB DO_COVERAGE:BOOL=OFF GENERATE_DOC:BOOL=ON GENERATE_MANPAGES:STRING=AUTO GIT_EXECUTABLE:FILEPATH=/usr/bin/git GZIP_EXECUTABLE:FILEPATH=/usr/bin/gzip LDOC_EXECUTABLE:FILEPATH=/usr/bin/ldoc LUACHECK_EXECUTABLE:FILEPATH=LUACHECK_EXECUTABLE-NOTFOUND LUA_EXECUTABLE:FILEPATH=/usr/bin/lua SYSCONFDIR:PATH=/usr/local/etc WITH_DBUS:STRING=AUTO WITH_XCB_ERRORS:STRING=AUTO XDG_CONFIG_DIR:PATH=/usr/local/etc/xdg dpkg_path:FILEPATH=/usr/bin/dpkg rpmbuild_path:FILEPATH=rpmbuild_path-NOTFOUND

Thanks for the fast response! It's much appreciated.

yannosmoust avatar Apr 26 '21 10:04 yannosmoust

Oh, I just realized, this isn't the LGI step yet, just lgi-check.c. Since you mentioned APT, I assume you're on a Debian-based system. Have you made sure to install both the Lua runtime and Lua headers packages?

You're likely missing the latter, which is named liblua${version}-dev, where ${version} is your current Lua version (e.g. 5.3).

sclu1034 avatar Apr 26 '21 12:04 sclu1034

@sclu1034 Yes I'm on Ubuntu 20.10. I did a quick sudo apt install liblua${version}-dev I had liblua5.3, liblua5.2 and liblua50 already installed. Again, thanks for the reply! Any other ideas?

yannosmoust avatar Apr 26 '21 12:04 yannosmoust

@sclu1034 So managed to make some progress but now I think I'm at the lgi step you mentioned. I get the error on make

The lgi check failed.

Awesome needs lgi to run.

Add AWESOME_IGNORE_LGI=1 to your environment to continue.

make[3]: *** [CMakeFiles/lgi-check-run.dir/build.make:58: CMakeFiles/lgi-check-run] Error 1

make[2]: *** [CMakeFiles/Makefile2:702: CMakeFiles/lgi-check-run.dir/all] Error 2

make[1]: *** [Makefile:152: all] Error 2

make: *** [Makefile:15: cmake-build] Error 2

running lua -e 'print(package.cpath)' outputs:

/usr/local/lib/lua/5.3/?.so;/usr/lib/x86_64-linux-gnu/lua/5.3/?.so;/usr/lib/lua/5.3/?.so;/usr/local/lib/lua/5.3/loadall.so;./?.so

lua -v is Lua 5.3.3 and whereis lua outputs:

lua: /usr/bin/lua5.3 /usr/bin/lua5.1 /usr/bin/lua /usr/include/lua5.3 /usr/share/lua5.3 /usr/share/lua /usr/share/man/man1/lua.1.gz

Thanks again!

yannosmoust avatar Apr 26 '21 16:04 yannosmoust

cmake -B build -L outputs:

-- lua -> /usr/bin/lua -- git -> /usr/bin/git -- asciidoctor -> /usr/bin/asciidoctor -- gzip -> /usr/bin/gzip -- ldoc -> /usr/bin/ldoc -- convert -> /usr/bin/convert -- Using version from git: v4.3-1012-g42d241c7 -- checking for execinfo -- found -- checking for round -- in libm -- Checking for module 'xcb-errors' -- No package 'xcb-errors' found -- xcb-errors not found. -- Disabled. -- busted -> /usr/bin/busted -- luacheck not found. -- Package version will be set to 4.3.0.0~git1012-g42d241c7. -- Configuring done -- Generating done -- Build files have been written to: /home/name/awesome/build -- Cache values ASCIIDOCTOR_EXECUTABLE:FILEPATH=/usr/bin/asciidoctor AWESOME_DATA_PATH:PATH=/usr/local/share/awesome AWESOME_DOC_PATH:PATH=/usr/local/share/doc/awesome AWESOME_MAN_PATH:PATH=/usr/local/share/man AWESOME_XSESSION_PATH:PATH=/usr/local/share/xsessions BUSTED_EXECUTABLE:FILEPATH=/usr/bin/busted CMAKE_BUILD_TYPE:STRING= CMAKE_INSTALL_PREFIX:PATH=/usr/local COMPRESS_MANPAGES:BOOL=ON CONVERT_EXECUTABLE:FILEPATH=/usr/bin/convert CPACK_GENERATOR:STRING=DEB DO_COVERAGE:BOOL=OFF GENERATE_DOC:BOOL=ON GENERATE_MANPAGES:STRING=AUTO GIT_EXECUTABLE:FILEPATH=/usr/bin/git GZIP_EXECUTABLE:FILEPATH=/usr/bin/gzip LDOC_EXECUTABLE:FILEPATH=/usr/bin/ldoc LUACHECK_EXECUTABLE:FILEPATH=LUACHECK_EXECUTABLE-NOTFOUND LUA_EXECUTABLE:FILEPATH=/usr/bin/lua SYSCONFDIR:PATH=/usr/local/etc WITH_DBUS:STRING=AUTO WITH_XCB_ERRORS:STRING=AUTO XDG_CONFIG_DIR:PATH=/usr/local/etc/xdg dpkg_path:FILEPATH=/usr/bin/dpkg rpmbuild_path:FILEPATH=rpmbuild_path-NOTFOUND

yannosmoust avatar Apr 26 '21 17:04 yannosmoust

Yeah, this now looks you're missing LGI. It's lua-lgi in the repositories or luarocks install lgi.

sclu1034 avatar Apr 26 '21 20:04 sclu1034

@sclu1034 Yes I saw that so I tried installing via luarocks, after multiple errors I just uninstalled and re-installed luarocks, installed lgi, tried to make awesome but got a "generating API documentation" error. I downgraded from lua 5.3 to 5.2 to work around the error but not I, again, get the "lgi not found" error when I try to make awesome, despite luarocks install lgi exiting succesfully. I am at a complete loss.

yannosmoust avatar Apr 26 '21 21:04 yannosmoust

tried to make awesome but got a "generating API documentation" error.

Do you have this error somewhere?

Elv13 avatar Apr 26 '21 21:04 Elv13

Hi @Elv13

I upgraded again to lua 5.3.5 and re installed luarocks to see if I'll get the error again. Here it is:

[ 81%] Generating API documentation

Error: no suitable Lua interpreter found

Error: supported versions are: 5.2 5.1

make[3]: *** [CMakeFiles/ldoc.dir/build.make:290: doc/index.html] Error 1

make[2]: *** [CMakeFiles/Makefile2:621: CMakeFiles/ldoc.dir/all] Error 2

make[1]: *** [Makefile:152: all] Error 2

make: *** [Makefile:15: cmake-build] Error 2

I saw the "Error: supported versions are: 5.2 5.1" line, that's why I downgraded my lua version. liblua.3-dev is also installed.

lua and luarocks are installed per the luarocks wiki.

lua -v --> Lua 5.3.5 luarocks --version --> /usr/local/bin/luarocks 3.3.1

whereis lua --> /usr/local/bin/lua /usr/local/lib/lua

whereis luarocks --> /usr/local/bin/luarocks /usr/local/etc/luarocks /usr/local/lib/luarocks

and the output for cmake -B build -L asked earlier, is:

  • lua -> /usr/local/bin/lua -- git -> /usr/bin/git -- asciidoctor -> /usr/bin/asciidoctor -- gzip -> /usr/bin/gzip -- ldoc -> /usr/bin/ldoc -- convert -> /usr/bin/convert -- Using version from git: v4.3-1012-g42d241c7 -- checking for execinfo -- found -- checking for round -- in libm -- Checking for module 'xcb-errors' -- No package 'xcb-errors' found -- xcb-errors not found. -- Disabled. -- busted -> /usr/bin/busted -- luacheck not found. -- Package version will be set to 4.3.0.0~git1012-g42d241c7. -- Configuring done -- Generating done -- Build files have been written to: /home/nameee/awesome/build -- Cache values ASCIIDOCTOR_EXECUTABLE:FILEPATH=/usr/bin/asciidoctor

AWESOME_DATA_PATH:PATH=/usr/local/share/awesome

AWESOME_DOC_PATH:PATH=/usr/local/share/doc/awesome

AWESOME_MAN_PATH:PATH=/usr/local/share/man

AWESOME_XSESSION_PATH:PATH=/usr/local/share/xsessions

BUSTED_EXECUTABLE:FILEPATH=/usr/bin/busted

CMAKE_BUILD_TYPE:STRING=

CMAKE_INSTALL_PREFIX:PATH=/usr/local

COMPRESS_MANPAGES:BOOL=ON

CONVERT_EXECUTABLE:FILEPATH=/usr/bin/convert

CPACK_GENERATOR:STRING=DEB

DO_COVERAGE:BOOL=OFF

GENERATE_DOC:BOOL=ON

GENERATE_MANPAGES:STRING=AUTO

GIT_EXECUTABLE:FILEPATH=/usr/bin/git

GZIP_EXECUTABLE:FILEPATH=/usr/bin/gzip

LDOC_EXECUTABLE:FILEPATH=/usr/bin/ldoc

LUACHECK_EXECUTABLE:FILEPATH=LUACHECK_EXECUTABLE-NOTFOUND

LUA_EXECUTABLE:FILEPATH=/usr/local/bin/lua

SYSCONFDIR:PATH=/usr/local/etc

WITH_DBUS:STRING=AUTO

XDG_CONFIG_DIR:PATH=/usr/local/etc/xdg

dpkg_path:FILEPATH=/usr/bin/dpkg

rpmbuild_path:FILEPATH=rpmbuild_path-NOTFOUND

Thanks again for answering!

yannosmoust avatar Apr 27 '21 01:04 yannosmoust

Error: no suitable Lua interpreter found
Error: supported versions are: 5.2 5.1

That error doesn't look like it's generated by Awesome, at least to my knowledge. So my guess is that some part of the build process used Lua 5.2, while the rest tried to use 5.3. Due to the progress into the build process, my guess would be that LDoc is running 5.2, but I'm not sure. And since I'm not running Ubuntu/Debian, I can't set things up to compare.

What I can offer is these commands that we use for our upcoming CI rework:

sudo apt-get install --no-install-recommends \
    asciidoctor \
    cmake \
    dbus-x11 \
    gettext \
    gir1.2-gtk-3.0 \
    gir1.2-pango-1.0 \
    git \
    libdbus-1-dev \
    libgirepository1.0-dev \
    libnotify-bin \
    libpango1.0-dev \
    libstartup-notification0-dev \
    libx11-xcb-dev \
    libxcb-cursor-dev \
    libxcb-icccm4-dev \
    libxcb-keysyms1-dev \
    libxcb-randr0-dev \
    libxcb-shape0-dev \
    libxcb-util0-dev \
    libxcb-xfixes0-dev \
    libxcb-xinerama0-dev \
    libxcb-xkb-dev \
    libxcb-xrm-dev \
    libxcb-xtest0-dev \
    libxdg-basedir-dev \
    libxkbcommon-dev \
    libxkbcommon-x11-dev \
    xutils-dev \
    liblua5.3-dev \
    lua5.3

luarocks install lgi
luarocks install ldoc

This might not be everything you need, since the CI offers some baseline dependencies, but it should cover the majority.

sclu1034 avatar Apr 27 '21 20:04 sclu1034

@sclu1034 That did it! For whatever reason I had installed ldoc (and a few other things) by hand before finding out there was a build-dep. It seems that the version on the repos was oudated. I was also missing markdown. Thanks for your help, it's much appreciated.

yannosmoust avatar Apr 28 '21 00:04 yannosmoust

I will re-open this. I think some recent changes made this problem worst. Since many distro ships lua 5.4 and people are going to install lgi using luarocks more often, I think it is worth investing in the cmake files to be smarter.

Elv13 avatar Apr 28 '21 06:04 Elv13

@Elv13 We have a check for lua5.4 in the cmake. What do you have in mind ?

ShayAgros avatar May 10 '21 18:05 ShayAgros

@ShayAgros The issue is not that something was running with an unsupported version. Instead, OP kept installing and removing various packages in different versions, until they ended up in a situation where their version of LDoc didn't match any of the installed Lua versions.

I assume the "smartness" that @Elv13 wants to add to the CMake files is to make sure that, in addition to the check for version support, everything runs on the same version and to provide an easy-to-understand error message if that's not the case.

sclu1034 avatar May 10 '21 19:05 sclu1034

5 years latter: The lattest LGI release doesn't support Lua 5.4 without patches from LGI's master branch. Since LGI is even less maintained than Awesome, having a new release of LGI will not happen.

Smartness in cmake will not resolve the core issue here.

LGI not having release is going to be a weak point when talking with distribution packagers. There is little to no chance they accept a dependency has to be built from source to package Awesome. I think the proper way forward is to look for alternative, like https://github.com/vtrlx/LuaGObject.

Aire-One avatar Nov 09 '25 23:11 Aire-One

alternative, like https://github.com/vtrlx/LuaGObject

the readme of the repo promotes hate towards robots 😸 so that would give a weird vibe to depend on a project which spends effort into some socio-political manifests and discriminates from contributing people who not falling for it

actionless avatar Dec 19 '25 08:12 actionless