Bug 255512 - databases/tarantool: Bundled src/json/json.h clashes with devel/jsoncpp /usr/local/include/json/json.h thus crashing the build
Summary: databases/tarantool: Bundled src/json/json.h clashes with devel/jsoncpp /usr/...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-30 11:38 UTC by Eugene M. Zheganin
Modified: 2021-05-10 17:03 UTC (History)
2 users (show)

See Also:


Attachments
suggested patch (570 bytes, patch)
2021-05-01 01:11 UTC, Yuri Victorovich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene M. Zheganin 2021-04-30 11:38:09 UTC
Build log:

===Cut===
[ 32%] Building C object src/box/CMakeFiles/tuple.dir/tuple.c.o
cd /usr/ports/databases/tarantool/work/.build/src/box && /usr/bin/cc -DCORO_ASM -DLUAJIT_SMART_STRINGS=1 -DNDEBUG -DNVALGRIND -DNVALGRIND=1 -DSQL_TEST=1 -D__STDC_CONSTANT_MACROS=1 -D__STDC_FORMAT_MACROS=1 -D__STDC_LIMIT_MACROS=1 -I/usr/local/include -I/usr/ports/databases/tarantool/work/tarantool-2.6.2/src -I/usr/ports/databases/tarantool/work/.build/src -I/usr/ports/databases/tarantool/work/tarantool-2.6.2/src/lib -I/usr/ports/databases/tarantool/work/tarantool-2.6.2/src/lib/small -I/usr/ports/databases/tarantool/work/tarantool-2.6.2/src/lib/small/third_party -I/usr/ports/databases/tarantool/work/tarantool-2.6.2/src/lib/core -I/usr/ports/databases/tarantool/work/tarantool-2.6.2 -I/usr/ports/databases/tarantool/work/.build/third_party -I/usr/ports/databases/tarantool/work/tarantool-2.6.2/third_party -I/usr/ports/databases/tarantool/work/tarantool-2.6.2/third_party/coro -I/usr/ports/databases/tarantool/work/tarantool-2.6.2/third_party/luajit/src -I/usr/ports/databases/tarantool/work/.build/third_party/decNumber -I/usr/ports/databases/tarantool/work/tarantool-2.6.2/third_party/libutil_freebsd -I/usr/ports/databases/tarantool/work/.build/src/box/sql -I/usr/ports/databases/tarantool/work/.build/src/box -I/usr/ports/databases/tarantool/work/tarantool-2.6.2/src/box/sql -O2 -pipe  -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing -fexceptions -funwind-tables -fno-common -fopenmp -std=c11 -Wall -Wextra -Wno-strict-aliasing -Wno-char-subscripts -Wno-gnu-alignof-expression -O2 -pipe  -DLIBICONV_PLUG -fstack-protector-strong -fno-strict-aliasing -o CMakeFiles/tuple.dir/tuple.c.o -c /usr/ports/databases/tarantool/work/tarantool-2.6.2/src/box/tuple.c
In file included from /usr/ports/databases/tarantool/work/tarantool-2.6.2/src/box/tuple.c:31:
In file included from /usr/ports/databases/tarantool/work/tarantool-2.6.2/src/box/tuple.h:39:
In file included from /usr/ports/databases/tarantool/work/tarantool-2.6.2/src/box/tuple_format.h:37:
In file included from /usr/local/include/json/json.h:9:
/usr/local/include/json/config.h:8:10: fatal error: 'cstddef' file not found
#include <cstddef>
         ^~~~~~~~~
1 error generated.
gmake[4]: *** [src/box/CMakeFiles/tuple.dir/build.make:85: src/box/CMakeFiles/tuple.dir/tuple.c.o] Error 1
gmake[4]: Leaving directory '/usr/ports/databases/tarantool/work/.build'
gmake[3]: *** [CMakeFiles/Makefile2:3035: src/box/CMakeFiles/tuple.dir/all] Error 2
gmake[3]: Leaving directory '/usr/ports/databases/tarantool/work/.build'
gmake[2]: *** [Makefile:174: all] Error 2
gmake[2]: Leaving directory '/usr/ports/databases/tarantool/work/.build'
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/databases/tarantool
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/tarantool
===Cut===

Workaround: since jsoncpp is needed by cmake and databases/tarantool is built with cmake, temporarily rename /usr/local/include/json/json.h to something else, install the ports, then revert the renaming.
Comment 1 Yuri Victorovich freebsd_committer 2021-04-30 17:51:29 UTC
If local json/json.h clashes with package-installed json/json.h - this is a bug in tarantool. It should be reported there.

Bundling is bad, this is one of many problems that it causes.
Comment 2 Yuri Victorovich freebsd_committer 2021-05-01 01:11:03 UTC
Created attachment 224583 [details]
suggested patch
Comment 3 Po-Chuan Hsieh freebsd_committer 2021-05-01 10:37:13 UTC
(In reply to Eugene M. Zheganin from comment #0)

I cannot reproduce it. tarantool builds fine in a poudriere jail. It means untouched cmake and jsoncpp.

You have superfluous "-I/usr/local/include" between "-D__STDC_LIMIT_MACROS=1" and all other "-I..." which seems to be the reason of failure.

(In reply to Yuri Victorovich from comment #1)

json.h in tarantool is not json.h from jsoncpp. They are different things. You could read it online [1].

[1] https://github.com/tarantool/tarantool/blob/2.6.2/src/lib/json/json.h

(In reply to Yuri Victorovich from comment #2)

I do not understand why it is related to nlohmann-json.
Comment 5 Yuri Victorovich freebsd_committer 2021-05-01 20:42:22 UTC
(In reply to Sunpoet Po-Chuan Hsieh from comment #3)

> I do not understand why it is related to nlohmann-json.

My bad, I thought that it conflicts with nlohmann-json but it doesn't.