AwakeMUD icon indicating copy to clipboard operation
AwakeMUD copied to clipboard

Unable to compile on Ubuntu 20·04

Open celtichawk opened this issue 4 years ago • 9 comments

As the subject says. Ubuntu 20.04 LTS on my system errors out.

Log below

scott@scott-System-Product-Name:~$ cd AwakeMUD/
scott@scott-System-Product-Name:~/AwakeMUD$ cd src/
scott@scott-System-Product-Name:~/AwakeMUD/src$ ./make
bash: ./make: No such file or directory
scott@scott-System-Product-Name:~/AwakeMUD/src$ make -s
/usr/bin/ld: newdb.o: in function `idle_delete()':
/home/scott/AwakeMUD/src/newdb.cpp:1968: undefined reference to `mysql_host'
/usr/bin/ld: /home/scott/AwakeMUD/src/newdb.cpp:1968: undefined reference to `mysql_user'
/usr/bin/ld: /home/scott/AwakeMUD/src/newdb.cpp:1968: undefined reference to `mysql_password'
/usr/bin/ld: /home/scott/AwakeMUD/src/newdb.cpp:1968: undefined reference to `mysql_db'
/usr/bin/ld: comm.o: in function `game_loop(int)':
/home/scott/AwakeMUD/src/comm.cpp:605: undefined reference to `gettimeofday(timeval*, timezone*)'
/usr/bin/ld: /home/scott/AwakeMUD/src/comm.cpp:631: undefined reference to `gettimeofday(timeval*, timezone*)'
/usr/bin/ld: /home/scott/AwakeMUD/src/comm.cpp:664: undefined reference to `gettimeofday(timeval*, timezone*)'
/usr/bin/ld: /home/scott/AwakeMUD/src/comm.cpp:683: undefined reference to `gettimeofday(timeval*, timezone*)'
/usr/bin/ld: /home/scott/AwakeMUD/src/comm.cpp:700: undefined reference to `gettimeofday(timeval*, timezone*)'
/usr/bin/ld: db.o: in function `initialize_and_connect_to_mysql()':
/home/scott/AwakeMUD/src/db.cpp:271: undefined reference to `mysql_host'
/usr/bin/ld: /home/scott/AwakeMUD/src/db.cpp:271: undefined reference to `mysql_user'
/usr/bin/ld: /home/scott/AwakeMUD/src/db.cpp:271: undefined reference to `mysql_password'
/usr/bin/ld: /home/scott/AwakeMUD/src/db.cpp:271: undefined reference to `mysql_db'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:128: ../bin/awake.new] Error 1
scott@scott-System-Product-Name:~/AwakeMUD/src$ make clean
rm -f *.o ../test/*.o *.d ../bin/awake.new
scott@scott-System-Product-Name:~/AwakeMUD/src$ make -s
transport.cpp:405:9: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
        act("The door shuts as the taxi begins to accelerate.",
        ^
transport.cpp:402:7: note: previous statement is here
      if (world[real_room_num].people)
      ^
1 warning generated.
In file included from debug.cpp:10:
./awake.h:18:17: warning: using directive refers to implicitly-defined namespace 'std'
using namespace std;
                ^
1 warning generated.
utils.cpp:190:28: warning: overlapping comparisons always evaluate to false [-Wtautological-overlap-compare]
  if ((time_info.hours < 6 && time_info.hours > 19) && (room->vision[0] > LIGHT_MINLIGHT || room->vision[0] <= LIGHT_NORMALNOLIT))
       ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
act.informative.cpp:792:13: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
            already_printed = TRUE;
            ^
act.informative.cpp:790:11: note: previous statement is here
          if (GET_TRADITION(ch) != TRAD_MUNDANE)
          ^
act.informative.cpp:798:13: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
            already_printed = TRUE;
            ^
act.informative.cpp:796:11: note: previous statement is here
          if (GET_TRADITION(ch) == TRAD_ADEPT)
          ^
act.informative.cpp:804:13: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
            already_printed = TRUE;
            ^
act.informative.cpp:802:11: note: previous statement is here
          if (GET_TRADITION(ch) != TRAD_MUNDANE && GET_TRADITION(ch) != TRAD_ADEPT)
          ^
3 warnings generated.
In file included from file.cpp:10:
./awake.h:18:17: warning: using directive refers to implicitly-defined namespace 'std'
using namespace std;
                ^
1 warning generated.
/usr/bin/ld: comm.o: in function `game_loop(int)':
/home/scott/AwakeMUD/src/comm.cpp:605: undefined reference to `gettimeofday(timeval*, timezone*)'
/usr/bin/ld: /home/scott/AwakeMUD/src/comm.cpp:631: undefined reference to `gettimeofday(timeval*, timezone*)'
/usr/bin/ld: /home/scott/AwakeMUD/src/comm.cpp:664: undefined reference to `gettimeofday(timeval*, timezone*)'
/usr/bin/ld: /home/scott/AwakeMUD/src/comm.cpp:683: undefined reference to `gettimeofday(timeval*, timezone*)'
/usr/bin/ld: /home/scott/AwakeMUD/src/comm.cpp:700: undefined reference to `gettimeofday(timeval*, timezone*)'
/usr/bin/ld: db.o: in function `initialize_and_connect_to_mysql()':
/home/scott/AwakeMUD/src/db.cpp:271: undefined reference to `mysql_host'
/usr/bin/ld: /home/scott/AwakeMUD/src/db.cpp:271: undefined reference to `mysql_user'
/usr/bin/ld: /home/scott/AwakeMUD/src/db.cpp:271: undefined reference to `mysql_password'
/usr/bin/ld: /home/scott/AwakeMUD/src/db.cpp:271: undefined reference to `mysql_db'
/usr/bin/ld: newdb.o: in function `idle_delete()':
/home/scott/AwakeMUD/src/newdb.cpp:1968: undefined reference to `mysql_host'
/usr/bin/ld: /home/scott/AwakeMUD/src/newdb.cpp:1968: undefined reference to `mysql_user'
/usr/bin/ld: /home/scott/AwakeMUD/src/newdb.cpp:1968: undefined reference to `mysql_password'
/usr/bin/ld: /home/scott/AwakeMUD/src/newdb.cpp:1968: undefined reference to `mysql_db'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:128: ../bin/awake.new] Error 1
scott@scott-System-Product-Name:~/AwakeMUD/src$ 

celtichawk avatar Jan 16 '21 18:01 celtichawk

The undefined references to MYSQL are caused by you not having installed the mysql_config.cpp file the script generated for you yet-- run the script from the SQL directory and follow the instructions there. Also, can you confirm if you changed the makefile to comment the OSX lines and uncomment the Linux lines?

luciensadi avatar Jan 16 '21 18:01 luciensadi

I have indeed uncommented the Linux/other in the makefile yes. However, on a fresh 20.04 install, the ./gensql script hangs at searching for mysql once ysql and mysql-dev are installed

celtichawk avatar Jan 16 '21 18:01 celtichawk

That's odd, I'll have to take a look at that. In the meantime, #include <sys/time.h> in comm.cpp might fix your undefined references for gettimeofday, and you can run the script commands manually to generate your database. The game won't run without that.

luciensadi avatar Jan 16 '21 18:01 luciensadi

Nope, no luck with that...but idisabling mysql version checks sorted the script hanging.

celtichawk avatar Jan 16 '21 19:01 celtichawk

Note: I have similar issues with the MySQL generation (probably because it hard-searches for 'Distrib' in the version string and throws up on its shoes when the return string doesn't have that). I'm using WSL2 for my build environment and have a similar issue with getting the 'right' time.h header.

tuxkamen avatar Aug 30 '21 20:08 tuxkamen

Yeah, this game uses some seriously out of date calls. It may be necessary to mark Ubuntu 20 as non-supported, since I wasn't able to build there as well.

luciensadi avatar Aug 31 '21 01:08 luciensadi

Did you have any thought about updating the calls to use something that's not so deprecated, like one of the more modern clock libraries that uses monotonic calls? There are only ~10 calls of this function in the codebase, it seems.

tuxkamen avatar Aug 31 '21 02:08 tuxkamen

Ah, wait, I just realized something--your Cygwin block has the stub that will fix the problem for Ubuntu 20 (I guess). I'll try providing that and seeing if it helps.

tuxkamen avatar Aug 31 '21 02:08 tuxkamen

This will work for Ubuntu 20:

LIBS = -lcrypt -L/usr/local/lib -L/usr/local/include -L/usr/include -L/usr/include/x86_64-linux-gnu/ -L/usr/include/mysql $(COMMON_FLAGS) -lnsl -lcurl
MYFLAGS = -DDEBUG_CRYPTO -DDEBUG -DSELFADVANCE -DIDLEDELETE_DRYRUN -Dlinux -I /usr/local/include/ -I /usr/include -I /usr/include/x86_64-linux-gnu/ -I /usr/include/mysql/ -Wall -Wextra -Wno-unused-parameter

Plus the <sys/time.h> include change you mentioned. <- Actually, if you include the arch-specific directory as I am, it looks like it works without this change as well, so that's good. Maybe we can add another block for Ubuntu directives.

tuxkamen avatar Aug 31 '21 20:08 tuxkamen