Problem With Make
Hello. I think I have installed the necessary requirements correctly already, but it seems I have something serious missing (like maybe a lib or include path messed up somehow?).
Running: ./configure checking for pkg-config... yes checking for C compiler... after checking cc checking whether C compiler works... yes checking whether compiler accepts -pipe... yes checking whether compiler accepts -Wall... yes checking whether compiler accepts -O2... yes checking whether compiler accepts -ffunction-sections... yes checking whether compiler accepts -fdata-sections... yes checking whether linker accepts -Wl,--gc-sections... yes creating config.mk... done checking for liblua >= 5.1 ... checking for luajit... yes checking for lpeg... yes checking for luautf8... no checking for lua... no checking for lua5.4... no checking for lua5.3... yes checking for lpeg... yes checking for luautf8... yes checking for pcre2...no completing config.mk... done
Then running: make
cc cli.c -pipe -Wall -O2 -ffunction-sections -fdata-sections -Wall -pedantic -I /home/pip/dvl/t8/shl/clp/include -I/usr/include/lua5.3 -DCLP_PATH="/usr/local/share/clp" -DSRC_LUA_PATH="/home/pip/dvl/t8/shl/clp/lua" -llua5.3 clp.o -o clp
/usr/bin/ld: clp.o: in function lua_path_add.part.0': clp.c:(.text.lua_path_add.part.0+0x15): undefined reference to lua_getglobal'
/usr/bin/ld: clp.c:(.text.lua_path_add.part.0+0x20): undefined reference to lua_pushstring' /usr/bin/ld: clp.c:(.text.lua_path_add.part.0+0x2f): undefined reference to lua_pushstring'
/usr/bin/ld: clp.c:(.text.lua_path_add.part.0+0x43): undefined reference to lua_getfield' /usr/bin/ld: clp.c:(.text.lua_path_add.part.0+0x50): undefined reference to lua_concat'
/usr/bin/ld: clp.c:(.text.lua_path_add.part.0+0x64): undefined reference to lua_setfield' /usr/bin/ld: clp.c:(.text.lua_path_add.part.0+0x71): undefined reference to lua_settop'
/usr/bin/ld: clp.o: in function bail': clp.c:(.text.bail+0x11): undefined reference to lua_tolstring'
/usr/bin/ld: clp.o: in function print_lua_path': clp.c:(.text.print_lua_path+0x10): undefined reference to lua_getglobal'
/usr/bin/ld: clp.c:(.text.print_lua_path+0x24): undefined reference to lua_getfield' /usr/bin/ld: clp.c:(.text.print_lua_path+0x33): undefined reference to lua_tolstring'
/usr/bin/ld: clp.o: in function lua_paths_get': clp.c:(.text.lua_paths_get+0x22): undefined reference to lua_getglobal'
/usr/bin/ld: clp.c:(.text.lua_paths_get+0x36): undefined reference to lua_getfield' /usr/bin/ld: clp.c:(.text.lua_paths_get+0x45): undefined reference to lua_tolstring'
/usr/bin/ld: clp.c:(.text.lua_paths_get+0x6a): undefined reference to lua_getfield' /usr/bin/ld: clp.c:(.text.lua_paths_get+0x79): undefined reference to lua_tolstring'
/usr/bin/ld: clp.o: in function lua_init': clp.c:(.text.lua_init+0x9): undefined reference to luaL_newstate'
/usr/bin/ld: clp.c:(.text.lua_init+0x14): undefined reference to luaL_openlibs' /usr/bin/ld: clp.o: in function clp_init':
clp.c:(.text.clp_init+0xc): undefined reference to luaL_newstate' /usr/bin/ld: clp.c:(.text.clp_init+0x17): undefined reference to luaL_openlibs'
/usr/bin/ld: clp.o: in function clp_run': clp.c:(.text.clp_run+0xe6): undefined reference to luaL_loadstring'
/usr/bin/ld: clp.c:(.text.clp_run+0x12e): undefined reference to lua_pushstring' /usr/bin/ld: clp.c:(.text.clp_run+0x148): undefined reference to lua_pcallk'
/usr/bin/ld: clp.c:(.text.clp_run+0x15d): undefined reference to lua_settop' /usr/bin/ld: clp.c:(.text.clp_run+0x16c): undefined reference to lua_getglobal'
/usr/bin/ld: clp.c:(.text.clp_run+0x17b): undefined reference to lua_pushstring' /usr/bin/ld: clp.c:(.text.clp_run+0x195): undefined reference to lua_pcallk'
/usr/bin/ld: clp.c:(.text.clp_run+0x1b5): undefined reference to lua_getglobal' /usr/bin/ld: clp.c:(.text.clp_run+0x1c9): undefined reference to lua_pcallk'
/usr/bin/ld: clp.c:(.text.clp_run+0x208): undefined reference to lua_getglobal' /usr/bin/ld: clp.c:(.text.clp_run+0x214): undefined reference to lua_createtable'
/usr/bin/ld: clp.c:(.text.clp_run+0x242): undefined reference to lua_pushstring' /usr/bin/ld: clp.c:(.text.clp_run+0x251): undefined reference to lua_pushstring'
/usr/bin/ld: clp.c:(.text.clp_run+0x25e): undefined reference to lua_settable' /usr/bin/ld: clp.c:(.text.clp_run+0x277): undefined reference to lua_pushstring'
/usr/bin/ld: clp.c:(.text.clp_run+0x286): undefined reference to lua_pushinteger' /usr/bin/ld: clp.c:(.text.clp_run+0x293): undefined reference to lua_settable'
/usr/bin/ld: clp.c:(.text.clp_run+0x2ac): undefined reference to lua_pushstring' /usr/bin/ld: clp.c:(.text.clp_run+0x2bb): undefined reference to lua_pushstring'
/usr/bin/ld: clp.c:(.text.clp_run+0x2c8): undefined reference to lua_settable' /usr/bin/ld: clp.c:(.text.clp_run+0x2d7): undefined reference to lua_pushstring'
/usr/bin/ld: clp.c:(.text.clp_run+0x2e6): undefined reference to lua_pushstring' /usr/bin/ld: clp.c:(.text.clp_run+0x2f3): undefined reference to lua_settable'
/usr/bin/ld: clp.c:(.text.clp_run+0x30a): undefined reference to lua_pcallk' /usr/bin/ld: clp.c:(.text.clp_run+0x321): undefined reference to lua_tolstring'
/usr/bin/ld: clp.c:(.text.clp_run+0x35b): undefined reference to lua_tolstring' /usr/bin/ld: clp.c:(.text.clp_run+0x393): undefined reference to lua_tolstring'
/usr/bin/ld: clp.c:(.text.clp_run+0x3b1): undefined reference to lua_toboolean' /usr/bin/ld: clp.c:(.text.clp_run+0x3c6): undefined reference to lua_settop'
/usr/bin/ld: clp.o: in function clp_cleanup': clp.c:(.text.clp_cleanup+0x8): undefined reference to lua_close'
collect2: error: ld returned 1 exit status
make: *** [Makefile:22: clp] Error 1
Please let me know if you need any further information to help diagnose my issue. Thanks!
-Pip
Hello, sorry for the trouble!
I see ./configure scans your system, determines luajit is missing luautf8, then finds all dependencies in your system installation of lua 5.3. But strangely, even though it finds 5.3, it's failing to link against it. What OS/distro are you on? How is lua 5.3 installed, and are you sure it's working properly?
Hi jpe90, no worries about the trouble.
Here's most of my neofetch output:
pip@Oni OS: Ubuntu 20.04.6 LTS x86_64 Kernel: 5.4.0-152-generic Uptime: 34 days, 14 hours, 51 mins Packages: 6373 (dpkg), 6 (snap) Shell: zsh 5.8 Resolution: 1920x1080, 1920x1080, 1920x1080 DE: Unity WM: Compiz WM Theme: DarkCold Theme: DarkCold [GTK2/3] Icons: ubuntu-mono-dark [GTK2/3] Terminal: gnome-terminal CPU: AMD Ryzen 7 2700 (16) @ 3.200GHz GPU: AMD ATI Radeon RX 470/480/570/570X/580/580X/590 Memory: 17937MiB / 64298MiB
Back last Friday AfterNoon, on July 21st of 2023 I ran commands which produced the following [distilled] entries in my /var/log/apt/history.log
Commandline: apt install libboost-regex1.71-dev Install: libboost-regex1.71-dev:amd64 (1.71.0-6ubuntu6)
Commandline: apt install libluajit-5.1-dev lua-lpeg-dev lua-lpeg-patterns libsource-highlight-dev Install: libluajit-5.1-dev:amd64 (2.1.0~beta3+dfsg-5.1build1), libsource-highlight-dev:amd64 (3.1.8-1.2build5), lua-lpeg-dev:amd64 (1.0.2-1), libboost-regex-dev:amd64 (1.71.0.0ubuntu2, automatic), lua-lpeg-patterns:amd64 (0.4-1)
Commandline: apt install liblua5.1-0-dev liblua5.3-dev liblua5.3-0 lua5.3 luarocks Install: liblua5.3-dev:amd64 (5.3.3-1.1ubuntu2), lua5.3:amd64 (5.3.3-1.1ubuntu2), lua-any:amd64 (25, automatic), luarocks:amd64 (2.4.2+dfsg-1), liblua5.1-0-dev:amd64 (5.1.5-8.1build4), lua-sec:amd64 (0.9-3, automatic)
After those installed, (If I Remember Correctly) I think I tried running: luarocks install pcre2 but it said the version of luarocks itself was too old (something like v2.4.2-1) to be able to work successfully, so I manually compiled and installed a latest v3.9.2 of luarocks from the GitHub repo, then tried again. I also installed lrexlib-pcre2 but neither of those enabled the clp ./configure to detect pcre2.
Since then, I've used luarocks to also install luautf8 and lpeg to see if latest versions of those might help. Following is my current [distilled] output from running: luarocks list
Rocks installed for Lua 5.3 - all say (installed) in: /usr/local/lib/luarocks/rocks-5.3
luautf8 0.1.5-2
lpeg 1.0.2-1
pcre2 0.2.0-1
lrexlib-pcre2 2.9.1-1
Even with these installed, running the clp ./configure again still produces identical results to my initial post above. I am pretty sure lua5.3 was working properly for all lua code I've had it interpret so far.
...
After writing the above, I decided to spend some hours installing and configuring a fresh lua5.4.6 on my system and did everything I thought necessary to get luarocks to switch from 5.3 to 5.4, then I installed the dependencies again so following is after I run: luarocks --lua-version 5.4 list
Rocks installed for Lua 5.4
lauxhlib 0.5.0-1 (installed) - /usr/local/lib/luarocks/rocks-5.4
lpeg 1.0.2-1 (installed) - /usr/local/lib/luarocks/rocks-5.4
luautf8 0.1.5-2 (installed) - /usr/local/lib/luarocks/rocks-5.4
pcre2 0.2.0-1 (installed) - /usr/local/lib/luarocks/rocks-5.4
So now I'm finally again trying to run: ./configure
checking for pkg-config... yes checking for C compiler... after checking cc checking whether C compiler works... yes checking whether compiler accepts -pipe... yes checking whether compiler accepts -Wall... yes checking whether compiler accepts -O2... yes checking whether compiler accepts -ffunction-sections... yes checking whether compiler accepts -fdata-sections... yes checking whether linker accepts -Wl,--gc-sections... yes creating config.mk... done checking for liblua >= 5.1 ... checking for luajit... yes checking for lpeg... no checking for luautf8... no checking for lua... no checking for lua5.4... no checking for lua5.3... yes checking for lpeg... no checking for luautf8... yes
checking for lua5.2... no checking for lua-5.4... no checking for lua-5.3... yes checking for lpeg... no checking for luautf8... yes
checking for lua-5.2... no checking for lua54... no checking for lua53... yes checking for lpeg... no checking for luautf8... yes
checking for lua52... no Error: Lua dependency LPEG was not found in any Lua installation.
This is too damn tedious and frustrating. It's now not finding any 5.4 or lpeg, so I'm giving up on this for a while.
Thanks very much for your quick response to my issue. Hopefully we can resolve it eventually. Have a good day!
-Pip
I just set up ubuntu 20.04 in a VM, installed lua5.3 and got all dependencies like you had originally, and was able to reproduce this.
I think it's some kind of issue with the GCC version that ships with 20.04, but I'm at a loss as to what's going on. I’ll try to dig into it when I get some spare time, but for the time being I got it to build by installing clang via sudo apt install clang, then export CC=clang, ./configure, and make, and it runs correctly for me. Really sorry for the trouble.
Thanks jpe90!
I have clang installed so tried exporting CC=clang, then running ./configure again but it still couldn't find any lua5.4 or lpeg (even though I've just apt reinstalled lua-lpeg, lua-lpeg-dev, and lua-lpeg-patterns in addition to running luarocks install lpeg again too). I don't understand what's so messed up about my configuration but maybe I'll try again later with just lua5.1 or 5.2 instead and see if one of those could work.
I greatly appreciate the time you've taken to try to help me with this vexing issue. Peace!
-Pip
sudo apt install tcc
sudo luarocks install luautf8
CC=tcc ./configure
make
works too.