Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build flatbuffers on OSX?

I'm trying to build flatbuffers on OSX but I'm not sure how to proceed exactly. According to the doc. I should run cmake -G "Xcode". I did that and got the result:

-- The C compiler identification is Clang 5.1.0
-- The CXX compiler identification is Clang 5.1.0
-- Check for working C compiler using: Xcode
-- Check for working C compiler using: Xcode -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Xcode
-- Check for working CXX compiler using: Xcode -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: Temp/flatbuffers

However from there I'm not sure what to do. I've tried to run make but got the error message make: *** No targets specified and no makefile found. Stop.. Any idea how to build it?

like image 682
laurent Avatar asked Jun 18 '14 01:06

laurent


People also ask

How do you use Flatbuffer in C++?

FlatBuffers supports both reading and writing FlatBuffers in C++. To use FlatBuffers in your code, first generate the C++ classes from your schema with the --cpp option to flatc . Then you can include both FlatBuffers and the generated code to read or write FlatBuffers.

What is Flatbuffer format?

A FlatBuffer is a binary file and in-memory format consisting mostly of scalars of various sizes, all aligned to their own size. Each scalar is also always represented in little-endian format, as this corresponds to all commonly used CPUs today.

What is Flatcc?

The flatcc compiler is implemented as a standalone tool instead of extending Googles flatc compiler in order to have a pure portable C library implementation of the schema compiler that is designed to fail graciously on abusive input in long running processes.


3 Answers

Instead make, just run following command in the shell:

$ cmakexbuild

After it finish you will get flatc in ./Debug folder.

like image 55
pepyakin Avatar answered Sep 17 '22 13:09

pepyakin


When you ran cmake, you generated a project for the Xcode IDE (downloadable from the Apple app store).

If you want to build using make, use this command instead:

cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release

After that,

make

should work as intended.

like image 31
Aardappel Avatar answered Sep 20 '22 13:09

Aardappel


On OSX it's recommended to use Homebrew to install the flatbuffer schema compiler.

brew install flatbuffers

Usage: Using the schema compiler

like image 37
Parav01d Avatar answered Sep 16 '22 13:09

Parav01d