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

Undefined reference errors on build. #3338

Open
MathematicsUnicorn opened this issue Apr 26, 2021 · 15 comments
Open

Undefined reference errors on build. #3338

MathematicsUnicorn opened this issue Apr 26, 2021 · 15 comments
Milestone

Comments

@MathematicsUnicorn
Copy link

MathematicsUnicorn commented Apr 26, 2021

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

@sclu1034
Copy link
Contributor

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?

@MathematicsUnicorn
Copy link
Author

MathematicsUnicorn commented Apr 26, 2021

@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.

@sclu1034
Copy link
Contributor

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).

@MathematicsUnicorn
Copy link
Author

MathematicsUnicorn commented Apr 26, 2021

@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?

@MathematicsUnicorn
Copy link
Author

MathematicsUnicorn commented Apr 26, 2021

@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!

@MathematicsUnicorn
Copy link
Author

MathematicsUnicorn commented Apr 26, 2021

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

@sclu1034
Copy link
Contributor

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

@MathematicsUnicorn
Copy link
Author

MathematicsUnicorn commented Apr 26, 2021

@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.

@Elv13
Copy link
Member

Elv13 commented Apr 26, 2021

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

Do you have this error somewhere?

@MathematicsUnicorn
Copy link
Author

MathematicsUnicorn commented Apr 27, 2021

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!

@sclu1034
Copy link
Contributor

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.

@MathematicsUnicorn
Copy link
Author

@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.

@Elv13
Copy link
Member

Elv13 commented Apr 28, 2021

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 Elv13 reopened this Apr 28, 2021
@Elv13 Elv13 added this to the v4.4 milestone Apr 28, 2021
@ShayAgros
Copy link
Contributor

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

@sclu1034
Copy link
Contributor

sclu1034 commented May 10, 2021

@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.

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

4 participants