Page 1 of 1

Cannot compile - lubuntu / Raspbian

Posted: Tue May 12, 2015 6:14 pm
by MasterShizzle
I've tried to compile on both of my test systems now, with no success. Both systems give the same error.
  1. I've read the README.txt and other stuff I could find, and I've installed the libraries I think I need (libjansson4, libjansson-dev, build-essential, etc)
  2. I cloned the source from https://gitlab.com/tome2/tome2.git
  3. I've gone into the src directory and run "cmake ."
  4. When I try to run "make" or even "sudo make" it builds the source files just fine, but I get the following:

    Code: Select all

    Linking C executable tome
    CMakeFiles/tome.dir/util.o: In function `path_temp':
    util.c:(.text+0x139): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
    CMakeFiles/tome.dir/squeltch.o: In function `json_decref':
    squeltch.c:(.text+0x4a): undefined reference to `json_delete'
    CMakeFiles/tome.dir/squeltch.o: In function `condition_to_json':
    squeltch.c:(.text+0x1ccc): undefined reference to `json_null'
    squeltch.c:(.text+0x1cd6): undefined reference to `json_object'
    squeltch.c:(.text+0x1cef): undefined reference to `json_string'
    squeltch.c:(.text+0x1d03): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x1d2b): undefined reference to `json_array'
    squeltch.c:(.text+0x1d6d): undefined reference to `json_array_append_new'
    squeltch.c:(.text+0x1d99): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x1dc3): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x1dd8): undefined reference to `json_string'
    squeltch.c:(.text+0x1dec): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x1e01): undefined reference to `json_string'
    squeltch.c:(.text+0x1e15): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x1e3e): undefined reference to `json_string'
    squeltch.c:(.text+0x1e52): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x1e67): undefined reference to `json_string'
    squeltch.c:(.text+0x1e7b): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x1e91): undefined reference to `json_integer'
    squeltch.c:(.text+0x1ea5): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x1eb6): undefined reference to `json_integer'
    squeltch.c:(.text+0x1eca): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x1ee2): undefined reference to `json_integer'
    squeltch.c:(.text+0x1ef6): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x1f0e): undefined reference to `json_integer'
    squeltch.c:(.text+0x1f22): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x1f35): undefined reference to `json_integer'
    squeltch.c:(.text+0x1f49): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x1f64): undefined reference to `json_string'
    squeltch.c:(.text+0x1f78): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x1f93): undefined reference to `json_string'
    squeltch.c:(.text+0x1fa7): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x1fbc): undefined reference to `json_string'
    squeltch.c:(.text+0x1fd0): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x1fe5): undefined reference to `json_string'
    squeltch.c:(.text+0x1ff9): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x200e): undefined reference to `json_string'
    squeltch.c:(.text+0x2022): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x2038): undefined reference to `json_integer'
    squeltch.c:(.text+0x204c): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x205d): undefined reference to `json_integer'
    squeltch.c:(.text+0x2071): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x20a9): undefined reference to `json_string'
    squeltch.c:(.text+0x20bd): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x20d1): undefined reference to `json_integer'
    squeltch.c:(.text+0x20e5): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x20f9): undefined reference to `json_integer'
    squeltch.c:(.text+0x210d): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x214d): undefined reference to `json_string'
    squeltch.c:(.text+0x2161): undefined reference to `json_object_set_new'
    CMakeFiles/tome.dir/squeltch.o: In function `rule_to_json':
    squeltch.c:(.text+0x28bc): undefined reference to `json_object'
    squeltch.c:(.text+0x28cf): undefined reference to `json_string'
    squeltch.c:(.text+0x28e3): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x28f9): undefined reference to `json_string'
    squeltch.c:(.text+0x290d): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x293c): undefined reference to `json_string'
    squeltch.c:(.text+0x2950): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x296d): undefined reference to `json_string'
    squeltch.c:(.text+0x2981): undefined reference to `json_object_set_new'
    squeltch.c:(.text+0x29a5): undefined reference to `json_object_set_new'
    CMakeFiles/tome.dir/squeltch.o: In function `rules_to_json':
    squeltch.c:(.text+0x29b8): undefined reference to `json_array'
    squeltch.c:(.text+0x29ec): undefined reference to `json_array_append_new'
    CMakeFiles/tome.dir/squeltch.o: In function `automatizer_save_rules':
    squeltch.c:(.text+0x4736): undefined reference to `json_dump_file'
    CMakeFiles/tome.dir/squeltch.o: In function `parse_condition':
    squeltch.c:(.text+0x593b): undefined reference to `json_unpack'
    squeltch.c:(.text+0x59b3): undefined reference to `json_object_get'
    squeltch.c:(.text+0x5a30): undefined reference to `json_array_get'
    squeltch.c:(.text+0x5a74): undefined reference to `json_array_size'
    squeltch.c:(.text+0x5aa7): undefined reference to `json_object_get'
    squeltch.c:(.text+0x5b4b): undefined reference to `json_unpack'
    squeltch.c:(.text+0x5b9e): undefined reference to `json_unpack'
    squeltch.c:(.text+0x5bf1): undefined reference to `json_unpack'
    squeltch.c:(.text+0x5c8c): undefined reference to `json_unpack'
    squeltch.c:(.text+0x5ce4): undefined reference to `json_unpack'
    CMakeFiles/tome.dir/squeltch.o:squeltch.c:(.text+0x5d32): more undefined references to `json_unpack' follow
    CMakeFiles/tome.dir/squeltch.o: In function `parse_rule':
    squeltch.c:(.text+0x61e1): undefined reference to `json_object_get'
    squeltch.c:(.text+0x628c): undefined reference to `json_string_value'
    squeltch.c:(.text+0x62ca): undefined reference to `json_object_get'
    CMakeFiles/tome.dir/squeltch.o: In function `parse_rules':
    squeltch.c:(.text+0x6341): undefined reference to `json_array_get'
    squeltch.c:(.text+0x6367): undefined reference to `json_array_size'
    CMakeFiles/tome.dir/squeltch.o: In function `automatizer_init':
    squeltch.c:(.text+0x63cf): undefined reference to `json_load_file'
    CMakeFiles/tome.dir/skills.o: In function `wrs_without_replacement':
    skills.c:(.text+0x3450): undefined reference to `pow'
    collect2: error: ld returned 1 exit status
    CMakeFiles/tome.dir/build.make:1960: recipe for target 'tome' failed
    make[2]: *** [tome] Error 1
    CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/tome.dir/all' failed
    make[1]: *** [CMakeFiles/tome.dir/all] Error 2
    Makefile:117: recipe for target 'all' failed
    make: *** [all] Error 2
    
I've tried this on a Raspberry Pi running Raspbian, and on an Lubuntu machine. Both give the same result. What am I missing here? No doubt that it's something simple, like a link missing or something else that can be fixed by a simple command, if only I knew C++. I'm a Java / Lua / Python kind of guy, so this is foreign to me. Obviously something is funky with my JSON libraries, but aside from making sure they're installed I don't know what else to do.

Anyone have this problem compiling on Ubuntu or similar? I get the same error on the v2.3.x, cpp, and master branches, though I admit I don't know what the real difference is between any of them. Any help would be appreciated. Thank you!

Re: Cannot compile - lubuntu / Raspbian

Posted: Fri May 15, 2015 4:27 pm
by MasterShizzle
Now I feel silly. Just had to do two days' worth of digging through forum posts.

The mistake: I was trying to compile from the tome2/src directory, instead of the root tome2 directory. I was also leaving all the options at default, which wasn't right for the intended build (I want the curses version only). Here's what ended up working for me:
  1. I deleted the whole directory and cloned fresh from the repo, checked out v2.3.11-ah.
  2. I edited the CMakeLists.txt to comment out the SDL, GTK, and X11 options, leaving just the curses version.
  3. The "cmake ." and "make" worked just fine, but running the executable from the src directory gave a fatal error right after selecting the ToME module. Compiling with "cmake -DSYSTEM_INSTALL:BOOL=true ." then running "make" and "sudo make install" worked fine.
So... still not perfect, but it's at least working on Lubuntu. Hopefully I should be able to follow the same steps on the Raspberry Pi.

Re: Cannot compile - lubuntu / Raspbian

Posted: Fri May 15, 2015 5:04 pm
by AnonymousHero
(EDIT: Nvm. Replied before you self-replied :))

Re: Cannot compile - lubuntu / Raspbian

Posted: Fri May 15, 2015 5:09 pm
by AnonymousHero
MasterShizzle wrote: [*]The "cmake ." and "make" worked just fine, but running the executable from the src directory gave a fatal error right after selecting the ToME module.[/list]
This is almost certainly because you did something like

Code: Select all

  $ cd src
  $ ./tome
When running directly from the build directory, it should be run exactly as stated in the README, namely with

Code: Select all

$ ./src/tome ...
(when in no-install mode, tome searches for its files using relative paths, and if you use "cd", it'll wind up looking in ./src/lib/... instead of ./lib/... for its files.)

Re: Cannot compile - lubuntu / Raspbian

Posted: Fri May 15, 2015 8:45 pm
by MasterShizzle
AnonymousHero wrote: This is almost certainly because you did something like

Code: Select all

  $ cd src
  $ ./tome
That is indeed the something that I did. Thanks for your help, and for all the work you've done to maintain my favorite 'band variant. Now I just have to get it working with DGameLaunch, and we'll be set!