Unable to build flatc compiler flatbuffer v1.3.0
Questions : Unable to build flatc compiler flatbuffer v1.3.0
We are using flatbuffer v1.3.0 and seeing in4codes_flatbuffers error building flatc compiler. Same error in4codes_flatbuffers for flatbuffer version v1.3.0 to in4codes_flatbuffers v1.12.1 Build is successful for version in4codes_flatbuffers 2.0.0
Should we use a particular version of make in4codes_flatbuffers to build the flatc compiler? If so how to do in4codes_flatbuffers it?
- git clone https://github.com/google/flatbuffers/tree/v1.3.0
- cd flatbuffers
- cmake -G “Unix Makefiles” -DCMAKE_BUILD_TYPE=Release –Success
- make —Error
Versions installed on MacOS BigSur Version in4codes_flatbuffers 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 18.104.22.16800029 -- The CXX compiler identification is AppleClang 22.214.171.12400029 -- 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```
Answers 1 : of Unable to build flatc compiler flatbuffer v1.3.0
Flatbuffer requires a specific version in4codes_gnu-make 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 in4codes_gnu-make 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