1

We are using flatbuffer v1.3.0 and seeing error building flatc compiler. Same error for flatbuffer version v1.3.0 to v1.12.1 Build is successful for version 2.0.0

Should we use a particular version of make to build the flatc compiler? If so how to do it?

Steps

  1. git clone https://github.com/google/flatbuffers/tree/v1.3.0
  2. cd flatbuffers
  3. cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -Success
  4. make --Error

Versions installed on MacOS BigSur Version 11.6

$ cmake --version
cmake version 3.19.4
CMake suite maintained and supported by Kitware (kitware.com/cmake).

$ make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for i386-apple-darwin11.3.0

$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin


$ cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/abcd/Documents/FlatBuffer/flatbuffers

$ make
Scanning dependencies of target flatc
[  2%] Building CXX object CMakeFiles/flatc.dir/src/idl_parser.cpp.o
In file included from /Users/abcd/Documents/FlatBuffer/flatbuffers/src/idl_parser.cpp:28:
In file included from /Users/abcd/Documents/FlatBuffer/flatbuffers/include/flatbuffers/idl.h:25:
/Users/abcd/Documents/FlatBuffer/flatbuffers/include/flatbuffers/flatbuffers.h:1086:25: error: definition of implicit copy constructor for 'TableKeyComparator<reflection::Object>' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy]
    TableKeyComparator& operator= (const TableKeyComparator&);
                        ^
/Users/abcd/Documents/FlatBuffer/flatbuffers/include/flatbuffers/flatbuffers.h:1100:27: note: in implicit copy constructor for 'flatbuffers::FlatBufferBuilder::TableKeyComparator<reflection::Object>' first required here
    std::sort(v, v + len, TableKeyComparator<T>(buf_));
                          ^
/Users/abcd/Documents/FlatBuffer/flatbuffers/include/flatbuffers/flatbuffers.h:1113:12: note: in instantiation of function template specialization 'flatbuffers::FlatBufferBuilder::CreateVectorOfSortedTables<reflection::Object>' requested here
    return CreateVectorOfSortedTables(v->data(), v->size());
           ^
/Users/abcd/Documents/FlatBuffer/flatbuffers/src/idl_parser.cpp:2008:35: note: in instantiation of function template specialization 'flatbuffers::FlatBufferBuilder::CreateVectorOfSortedTables<reflection::Object>' requested here```

  • 1
    So... what's the question? SO is a place to get answers to questions, but there is no question here. Clearly there was some incorrect code in the older versions of this project that were complained about by this newer compiler. It appears those problems were fixed in later releases of the project. – MadScientist Sep 27 '21 at 21:27
  • Yup, always test with latest version / master preferably.. and these kinds of things might work better as github issues. – Aardappel Sep 27 '21 at 21:28
  • @MadScientist i have updated the post with a question. Do you say all the releases from v1.3.0 to v1.12.1 have issues ? I have posted the error which i am seeing after executing make command – Sujan Davangere Sunil Sep 28 '21 at 14:15
  • The problem has nothing to do with make. Make is just a tool used to run the compiler. The issue is between the code you're trying to compile and the version of the compiler (not make) you're using. Presumably older versions of the compiler compiled this older code properly. Newer versions of the compiler require changes in the code which were apparently applied to newer releases. I have never heard of flatbuffers before so I have no idea which versions do or do not have these changes. – MadScientist Sep 28 '21 at 14:20
  • flatc compiler was successfully built for Version 1.3.0 using windows executable, which is precompiled . https://github.com/google/flatbuffers/releases/tag/v1.3.0 – Sujan Davangere Sunil Sep 29 '21 at 14:07

1 Answers1

0

Flatbuffer requires a specific version of clang to compile the 1.12.1.

Installing the required version.

sudo apt-get install clang-6.0 lld-6.0 clang-tidy-6.0

use update-alternatives to link the clang.

sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-6.0 10

sudo update-alternatives --install /usr/bin/clang++ clang++
/usr/bin/clang++-6.0 10
Flair
  • 2,609
  • 1
  • 29
  • 41
Fizn-Ahmd
  • 69
  • 5