Re-ported build-error workaround from 1.6.0
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Fri, 27 Mar 2020 00:52:34 +0000 (09:52 +0900)
committerYongjoo Ahn <yongjoo1.ahn@samsung.com>
Fri, 2 Dec 2022 07:37:24 +0000 (16:37 +0900)
There was a build-error fix in flatbuffers-1.6.0, which
was in bash build script. They appear to lose it when
they abandoned the bash build script.

The following is the commit message of the workaround
of flatbuffers 1.6.0 mainline:

Work around flatbuffers flaky build

The flatbuffers build ocasionally fails with the following error:

/flatbuffers/flatbuffers-1.6.0/src/idl_parser.cpp
/mnt/source/flatbuffers/flatbuffers-1.6.0/samples/sample_binary.cpp:19:17:
error: 'MyGame' has not been declared
 using namespace MyGame::Sample;
                 ^
/mnt/source/flatbuffers/flatbuffers-1.6.0/samples/sample_binary.cpp:19:25:
error: 'Sample' is not a namespace-name
 using namespace MyGame::Sample;
                         ^
/mnt/source/flatbuffers/flatbuffers-1.6.0/samples/sample_binary.cpp:19:31:
error: expected namespace-name before ';' token
 using namespace MyGame::Sample;
                               ^
/mnt/source/flatbuffers/flatbuffers-1.6.0/samples/sample_binary.cpp: In
function 'int main(int, const char**)':
/mnt/source/flatbuffers/flatbuffers-1.6.0/samples/sample_binary.cpp:25:3:
error: 'flatbuffers' has not been declared
   flatbuffers::FlatBufferBuilder builder;
   ^
/mnt/source/flatbuffers/flatbuffers-1.6.0/samples/sample_binary.cpp:28:26:
error: 'builder' was not declared in this scope
   auto weapon_one_name = builder.CreateString("Sword");
                          ^
...

Disabling the BUILD_TESTS target removes the flakiness and makes the
compilation faster.

Reviewed-on: http://gerrit.cloudera.org:8080/12886
Reviewed-by: Tim Armstrong <tarmstrong@cloudera.com>
Tested-by: Tim Armstrong <tarmstrong@cloudera.com>
Change-Id: Ica8300d7edad7d10adad311cc22c18b8987b1f9b
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
packaging/flatbuffers.spec

index 609e67d..36debb7 100644 (file)
@@ -29,10 +29,16 @@ This package provides headers and other miscellaneous files required to use flat
 cp %{SOURCE1} .
 
 %build
+# flatbuffers build occasionally fails when using -j${BUILD_THREADS} with an error similar to:
+# /mnt/source/flatbuffers/flatbuffers-1.6.0/samples/sample_binary.cpp:19:17: error: 'MyGame' has not been declared
+# /mnt/source/flatbuffers/flatbuffers-1.6.0/samples/sample_binary.cpp:19:25: error: 'Sample' is not a namespace-name
+# ...
+# Disabling build tests gets rid of this flakiness and makes the compilation faster.
 %{cmake} \
     -DFLATBUFFERS_INSTALL=ON \
     -DFLATBUFFERS_BUILD_SHAREDLIB=ON \
     -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \
+    -DFLATBUFFERS_BUILD_TESTS=OFF \
     -DCMAKE_INSTALL_INCLUDEDIR=%{_includedir} \
     -DCMAKE_INSTALL_LIBDIR=%{_libdir} \
     -DCMAKE_INSTALL_BINDIR=%{_bindir} \
@@ -40,9 +46,6 @@ cp %{SOURCE1} .
     -DCMAKE_BUILD_TYPE=Release .
 %{__make} %{?_smp_mflags}
 
-%check
-make test
-
 %install
 %{__make} DESTDIR=%{?buildroot:%{buildroot}} install