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

Minetest fails to link JSONCPP on Debian 9.x if -DENABLE_SYSTEM_JSONCPP=1 #4306

Closed
Megaf opened this issue Jul 10, 2016 · 16 comments · Fixed by #10407
Closed

Minetest fails to link JSONCPP on Debian 9.x if -DENABLE_SYSTEM_JSONCPP=1 #4306

Megaf opened this issue Jul 10, 2016 · 16 comments · Fixed by #10407
Labels
Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible

Comments

@Megaf
Copy link
Contributor

Megaf commented Jul 10, 2016

Might be some problem on Debian itself, I tried with Minetest Stable 0.4 branch too and got the same result.
cmake /home/user/Documents/games/minetest -DWARN_ALL=0 -DRUN_IN_PLACE=0 -DENABLE_GETTEXT=0 -DENABLE_CURL=0 -DCMAKE_BUILD_TYPE=MinSizeRel -DENABLE_LEVELDB=0 -DENABLE_POSTGRESQL=0 -DENABLE_REDIS=0 -DENABLE_SPATIAL=0 -DENABLE_SYSTEM_GMP=1 -DENABLE_SYSTEM_JSONCPP=1 -DENABLE_CURSES=0 -DENABLE_GLES=1 -DRUN_IN_PLACE=1

[100%] Linking CXX executable /home/user/Documents/games/minetest/bin/minetest
CMakeFiles/minetest.dir/client/clientlauncher.cpp.o: In function `ClientLauncher::launch_game(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool, GameParams&, Settings const&)':
clientlauncher.cpp:(.text+0x1c6a): undefined reference to `Json::Value::operator=(Json::Value const&)'
clientlauncher.cpp:(.text+0x1ca9): undefined reference to `Json::Value::operator=(Json::Value const&)'
clientlauncher.cpp:(.text+0x1ce8): undefined reference to `Json::Value::operator=(Json::Value const&)'
clientlauncher.cpp:(.text+0x1d27): undefined reference to `Json::Value::operator=(Json::Value const&)'
CMakeFiles/minetest.dir/script/common/c_content.cpp.o: In function `read_json_value(lua_State*, Json::Value&, int, unsigned char)':
c_content.cpp:(.text+0x1c74): undefined reference to `Json::Value::operator=(Json::Value const&)'
CMakeFiles/minetest.dir/script/common/c_content.cpp.o:c_content.cpp:(.text+0x1ca6): more undefined references to `Json::Value::operator=(Json::Value const&)' follow
collect2: error: ld returned 1 exit status
src/CMakeFiles/minetest.dir/build.make:5330: recipe for target '/home/user/Documents/games/minetest/bin/minetest' failed
make[2]: *** [/home/user/Documents/games/minetest/bin/minetest] Error 1
CMakeFiles/Makefile2:142: recipe for target 'src/CMakeFiles/minetest.dir/all' failed
make[1]: *** [src/CMakeFiles/minetest.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2

Debian Stretch x86_64.

@Zeno-
Copy link
Contributor

Zeno- commented Jul 10, 2016

Well, it's certainly not caused by 4c530de because that commit only changes comments.

@Fixer-007
Copy link
Contributor

GCC 4.9.2 cross-compilation was successful on that build.

@Megaf Megaf changed the title 4c530de failing to compile (link CXX executable) with GCC 5 and Clang 3. Minetest failing to compile (link CXX executable) on Debian Stretch Jul 11, 2016
@Megaf
Copy link
Contributor Author

Megaf commented Jul 11, 2016

@Zeno- Stable 0.4 doesnt link either, maybe a problem with Debian itself?

@Rogier-5
Copy link
Contributor

From superficial examination, I guess that minetest may be using the wrong header files, or linking against the incorrect jsoncpp library. See also this information and this issue. Most people probably don't use -DENABLE_SYSTEM_JSONCPP=1, so that might be the reason that the problem has remained undetected.

If that is the problem, maybe that removing src/json might make a difference (workaround-type).

@Megaf
Copy link
Contributor Author

Megaf commented Jul 12, 2016

@Rogier-5 Indeed it links with -DENABLE_SYSTEM_JSONCPP=0

@Megaf Megaf changed the title Minetest failing to compile (link CXX executable) on Debian Stretch Minetest fails to link JSONCPP on Debian 9.x if -DENABLE_SYSTEM_JSONCPP=1 Jul 12, 2016
@Rogier-5
Copy link
Contributor

Indeed it links with -DENABLE_SYSTEM_JSONCPP=0

Then, from the information, it seems that minetest either still uses the included version of the json include file (instead of the system version) when compiling with -DENABLE_SYSTEM_JSONCPP=1, or it uses the correct include file, but links with the included version of the json library anyway, instead of using the system version.

@Rogier-5
Copy link
Contributor

The primary problem turns out to be that minetest uses #include "json/json.h", where it should use #include <json/json.h>. I fixed that - see PR #4429

@sfan5 sfan5 closed this as completed Apr 9, 2017
@Megaf
Copy link
Contributor Author

Megaf commented Apr 16, 2017

@sfan5 Why you closed this if it wasnt fixed?

@sfan5
Copy link
Member

sfan5 commented Apr 16, 2017

The PR that was supposed to fix this was merged.

@paramat
Copy link
Contributor

paramat commented Jul 30, 2017

Similar problem reported by rdococ and others have recently mentioned problems with JSON.

@rdococ
Copy link

rdococ commented Jul 30, 2017

For me, using Debian 8.6, neither -DENABLE_SYSTEM_JSONCPP=1 nor -DENABLE_SYSTEM_JSONCPP=0 seems to work.

@stujones11
Copy link
Contributor

Solution for me here: https://forum.minetest.net/viewtopic.php?f=6&t=18147

Not sure if this is debian or MT related so did not open an issue.

@paramat paramat added the Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible label Jul 30, 2017
@Megaf
Copy link
Contributor Author

Megaf commented Sep 24, 2017

Fixed.

@Megaf Megaf closed this as completed Sep 24, 2017
@ne-vlezay80
Copy link

ne-vlezay80 commented Oct 29, 2017

[ 35%] Building CXX object src/CMakeFiles/minetest.dir/script/scripting_client.cpp.o
/usr/src/minetest/src/script/lua_api/l_util.cpp: In static member function ‘static int ModApiUtil::l_parse_json(lua_State*)’:
/usr/src/minetest/src/script/lua_api/l_util.cpp:101:3: error: ‘CharReaderBuilder’ is not a member of ‘Json’
   Json::CharReaderBuilder builder;
   ^
/usr/src/minetest/src/script/lua_api/l_util.cpp:102:3: error: ‘builder’ was not declared in this scope
   builder.settings_["collectComments"] = false;
   ^
/usr/src/minetest/src/script/lua_api/l_util.cpp:105:8: error: ‘parseFromStream’ is not a member of ‘Json’
   if (!Json::parseFromStream(builder, stream, &root, &errs)) {
        ^
[ 35%] Building CXX object src/CMakeFiles/minetest.dir/script/scripting_mainmenu.cpp.o
src/CMakeFiles/minetest.dir/build.make:1434: ошибка выполнения рецепта для цели «src/CMakeFiles/minetest.dir/script/lua_api/l_util.cpp.o»
make[2]: *** [src/CMakeFiles/minetest.dir/script/lua_api/l_util.cpp.o] Ошибка 1
make[2]: *** Ожидание завершения заданий…
CMakeFiles/Makefile2:193: ошибка выполнения рецепта для цели «src/CMakeFiles/minetest.dir/all»
make[1]: *** [src/CMakeFiles/minetest.dir/all] Ошибка 2
Makefile:137: ошибка выполнения рецепта для цели «all»
make: *** [all] Ошибка 2

EDIT by SmallJoker: Added code block around to display it correctly

@Megaf
Copy link
Contributor Author

Megaf commented Nov 5, 2017

Not sure if that is related to this issue.

@Megaf
Copy link
Contributor Author

Megaf commented Nov 6, 2017

I just built Minetest Server 0.4 stable on Debian Buster/Testing/10. With systemjson, no problem at all. @ne-vlezay80 @SmallJoker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants