project-navigation
Personal tools

Author Topic: Can't compile source with Arch Linux  (Read 9456 times)

Offline cmmps

  • Rookie
  • ***
  • Posts: 18
    • View Profile
Can't compile source with Arch Linux
« on: March 19, 2017, 11:45:59 pm »
Hi there!
I was trying to update ufoai 2.6-dev and now I can't compile it anymore. I tried to delete the folder, clone it again from git but the problem remains.

This is what I get from ./configure (maybe there's a clue here but I'm not sure):
Code: [Select]
use c compiler: cc
use c++ compiler: c++
Debug build
Compile for linux
Compile for x86_64
Disable ccache
Using default CFLAGS
Using default LDFLAGS
Found cc cc
Found cxx c++
Using bindir /usr/local/bin/
Using datadir /usr/local/games/ufo/
Using libdir /usr/local/lib/
Using prefix /usr/local
Enable hard linked cgame
Use signal handler
Setting custom data directory
Setting custom library directory
Found zip from zip
Found python from python
Found doxygen from doxygen
Found xvid.h
Found theora/theora.h
Found execinfo.h
Could not find bfd.h
Found sys/utsname.h
Found link.h
Found jpeglib.h
Found zlib.h
Found png.h
Found curl/curl.h
Found lua.h
Could not find mxml.h
Found SDL.h
Found SDL_mixer.h
Found SDL_ttf.h
Found SDL.h
Found SDL_mixer.h
Found SDL_ttf.h
Could not find picomodel.h
Found gtk/gtk.h
Could not find gtksourceview/gtksourceview.h
Found libxml/parser.h
Found AL/al.h
Found gtk/gtkglwidget.h
Build modules:
Build cgame-campaign
Build cgame-multiplayer
Build cgame-skirmish
Build game
Build memory
Build testall
Build ufo2map
Build ufoded
Build ufo
Build ufomodel
Disable uforadiant
Build ufoslicer

And the error (lua related, I believe):
Code: [Select]
===> LD [base/game.so]
debug-linux-x86_64/game/game/g_ai_lua.cpp.o: In function `actorL_shoot(lua_State*)':
/mnt/games/ufoai/src/game/g_ai_lua.cpp:534: undefined reference to `lua_tonumberx'
debug-linux-x86_64/game/game/g_ai_lua.cpp.o: In function `actorL_throwgrenade(lua_State*)':
/mnt/games/ufoai/src/game/g_ai_lua.cpp:598: undefined reference to `lua_tonumberx'
/mnt/games/ufoai/src/game/g_ai_lua.cpp:609: undefined reference to `lua_tonumberx'
debug-linux-x86_64/game/game/g_ai_lua.cpp.o: In function `AIL_positionshoot(lua_State*)':
/mnt/games/ufoai/src/game/g_ai_lua.cpp:1323: undefined reference to `lua_tonumberx'
debug-linux-x86_64/game/game/g_ai_lua.cpp.o: In function `AIL_positionhide(lua_State*)':
/mnt/games/ufoai/src/game/g_ai_lua.cpp:1461: undefined reference to `lua_tonumberx'
debug-linux-x86_64/game/game/g_ai_lua.cpp.o:/mnt/games/ufoai/src/game/g_ai_lua.cpp:1502: more undefined references to `lua_tonulow
debug-linux-x86_64/game/game/g_ai_lua.cpp.o: In function `AIL_ActorThink(Player&, Actor*)':
/mnt/games/ufoai/src/game/g_ai_lua.cpp:2114: undefined reference to `lua_getglobal'
/mnt/games/ufoai/src/game/g_ai_lua.cpp:2117: undefined reference to `lua_pcallk'
debug-linux-x86_64/game/game/g_ai_lua.cpp.o: In function `AIL_TeamThink(Player&)':
/mnt/games/ufoai/src/game/g_ai_lua.cpp:2163: undefined reference to `lua_getglobal'
/mnt/games/ufoai/src/game/g_ai_lua.cpp:2166: undefined reference to `lua_pcallk'
debug-linux-x86_64/game/game/g_ai_lua.cpp.o: In function `AIL_InitActor(Actor*)':
/mnt/games/ufoai/src/game/g_ai_lua.cpp:2221: undefined reference to `lua_getglobal'
/mnt/games/ufoai/src/game/g_ai_lua.cpp:2231: undefined reference to `lua_pcallk'
/mnt/games/ufoai/src/game/g_ai_lua.cpp:2237: undefined reference to `lua_setglobal'
collect2: error: ld returned 1 exit status
make: *** [Makefile:173: base/game.so] Error 1

I'm running an updated system with Arch Linux x86_64 on an AMD FX6000 (6 core) CPU.

Any ideas?

Thanks,
Carlos Santos

Offline Norby

  • Rookie
  • ***
  • Posts: 43
    • View Profile
Re: Can't compile source with Arch Linux
« Reply #1 on: March 20, 2017, 01:48:22 am »
Hi!

Try to eliminate the "Could not find" lines from configure by installing the packages which contain the missing .h files. This helped me in Debian, I seached in packages.debian.org after all files, the only what I could not find is picomodel.h but since I fixed all others the game compile witthout errors.

Offline cmmps

  • Rookie
  • ***
  • Posts: 18
    • View Profile
Re: Can't compile source with Arch Linux
« Reply #2 on: March 20, 2017, 04:32:55 pm »
Thank you Norby

I believe the problem is more "lua related". However I checked the "could not find" files and installed the packages "mxml" and "gtksourceview2" that were missing. For "bfd.h", the strangest thing is that it belongs to the "binutils" package which is installed already. For "picomodel.h", I believe it's a project hosted on github and it's essentially for "uforadiant".

Now the "Could not find" lines appear for "bfd.h" and "picomodel.h".

It still crashes with the same errors :(

Offline Namerutan

  • Rookie
  • ***
  • Posts: 11
    • View Profile
Re: Can't compile source with Arch Linux
« Reply #3 on: March 20, 2017, 05:50:55 pm »
Hola Carlos:

I'm not an expert in this area, but I guess the problem with lua could be related to not finding the binutils lib, so I would double check it.
Just in case it helps, in source code bfd.h is located under /src/shared/bfd.h

but I think it should be enough to install the lib the usual way:
sudo apt-get install binutils-dev

Suerte!

Offline cmmps

  • Rookie
  • ***
  • Posts: 18
    • View Profile
Re: Can't compile source with Arch Linux
« Reply #4 on: March 20, 2017, 09:55:26 pm »
Thank you Namerutan but this is Arch Linux. The header files here are under /usr/include and bfd.h is there, what makes it more weird.
And this files comes with the package "binutils" so, when you install it with:
Code: [Select]
sudo pacman -S binutils/usr/include/bfd.h will be created.

However, I believe that this is not the problem as the cpp files are compiled and the error is with lua when the build performs a "LD" on "game.so". It seems it is not looking for lua in the right place.

With some more further search I found the very same problem reported on Arch Linux forums:
https://bbs.archlinux.org/viewtopic.php?id=208203

And it seems there is a patch uploaded into UFO AI Issue tracker here:
http://ufoai.org/bugs/ufoalieninvasion/issues/5632

However, it does not work. Indeed, I have lua5.3 and the lua.h file is directly below /usr/include but for lua5.1 it can be found under /usr/include/lua5.1
So I manually changed the configure file according to the following patch:
Code: [Select]
diff --git a/configure b/configure
index c1f9379..2ca8e02 100755
--- a/configure
+++ b/configure
@@ -238,7 +238,7 @@ check_headers() {
        check_header "zlib.h" "zlib"
        check_header "png.h" "libpng"
        check_header_bundled "curl/curl.h" "libcurl"
-       check_header_bundled "lua.h" "lua5.1"
+       check_header_bundled "lua5.1/lua.h" "lua5.1"
        check_header_bundled "mxml.h" "mxml"
        check_header "SDL.h" "sdl"
        check_header "SDL_mixer.h" "SDL_mixer"

I also tried:
Code: [Select]
./configure --with-embedded-lua5.1But it also failed to build.

I'm getting out of ideas... :(

I'm going to place this problem in the Arch forum as well.

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
Re: Can't compile source with Arch Linux
« Reply #5 on: March 22, 2017, 12:12:31 am »
Did you try searching for solution on our bugracker?

Patch#5632 seems to be the very same problem that you have. (The patch wasn't merged in because it fixes LUA detection on Arch but breaks it on other distros.)

-geever

Offline cmmps

  • Rookie
  • ***
  • Posts: 18
    • View Profile
Re: Can't compile source with Arch Linux
« Reply #6 on: March 23, 2017, 12:46:24 pm »
Hi Geever! Long time! :)

That's exactly what I tried. I wrote it down on my post...  :P

Here:
Quote
And it seems there is a patch uploaded into UFO AI Issue tracker here:
http://ufoai.org/bugs/ufoalieninvasion/issues/5632

I've been trying other ideas without success. It seems the only solution will be to downgrade Lua to 5.1.

Thanks anyway. :)
Cheers!

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Can't compile source with Arch Linux
« Reply #7 on: March 25, 2017, 10:08:40 pm »
Is it the same error if you use the --with-embedded-lua5.1 configure option?

Also: do you have lua 5.1 installed? (You should be able to install different versions at the same time)
« Last Edit: March 25, 2017, 10:13:59 pm by DarkRain »

Offline cmmps

  • Rookie
  • ***
  • Posts: 18
    • View Profile
Re: Can't compile source with Arch Linux
« Reply #8 on: April 06, 2017, 11:17:31 am »
Hi DarkRain, thanks.

Yes, I tried that parameter from a forum (check 4 messages above) but it also failed. And I do have Lua 5.1 installed under /usr/lib/lua5.1.

Meantime I tried to downgrade the package lua but I could not because I no longer can find 5.1 in Arch repo. A
nyway I'm willing to try to create a folder "5.3" and copy the lua files directly under /usr/lib to that folder and recreate them with symlinks to point to the files on the folder /usr/lib/lua5.1.
For the sake of my system upgrades I shall add "lua" to the "ignore packages" list on my pacman.conf file and avoid further lua updates and "file exists in filesystem" errors.

I've been away from home due to work but I'll try this by the weekend and I'll post the results.

Thanks again guys!

Carlos
« Last Edit: April 06, 2017, 11:19:08 am by cmmps »

Offline DarkRain

  • Project Coder
  • Captain
  • ***
  • Posts: 746
    • View Profile
Re: Can't compile source with Arch Linux
« Reply #9 on: April 06, 2017, 07:44:53 pm »
Yes, I saw you tried that above, what I wanted to know was if the error is the same as without the parameter. From the looks of it, the game library  is linking to a lua library that doesn't match the header, but if you're using the embedded lua it shouldn't be linking to lua at all, so I wanted to figure what's wrong there.

Also the output of "make Q= game" (without quotes, and notice the space between 'Q=' and 'game') might help figure what's going on.

Offline geever

  • Project Coder
  • PHALANX Commander
  • ***
  • Posts: 2561
    • View Profile
Re: Can't compile source with Arch Linux
« Reply #10 on: April 06, 2017, 08:17:55 pm »
I hope you can make it compile.

FYI: I created a Feature Request ticket for ourselves to upgrade the LUA:

FR#5653 - Upgrade to LUA 5.3

And another about our LUA ecosystem:

FR#5654 - Consolidate LUA APIs and make it easily extensible


Note that it doesn't mean that it will be done soon (I'm not familiar with LUA integration) but it should be on our "roadmap" somewhere.

-geever