PROTOBUF_INLINE_NOT_IN_HEADERS - protocol-buffers

I'm trying to install Open Transactions, the open-source project, on a debian 8. I've installed all the dependencies and am having an issue when compiling (make). The following error is showing at my terminal, even though i made sure to install the protobuf project:
In file included from /root/opentxs/src/../include/opentxs/core/OTStoragePB.hpp:64:0,
from /root/opentxs/src/core/OTStorage.cpp:47:
/root/opentxs/build/src/core/otprotob/Generics.pb.h:501:6: error: "PROTOBUF_INLINE_NOT_IN_HEADERS" is not defined [-Werror=undef]
#if !PROTOBUF_INLINE_NOT_IN_HEADERS
^
In file included from /root/opentxs/src/../include/opentxs/core/OTStoragePB.hpp:65:0,
from /root/opentxs/src/core/OTStorage.cpp:47:
/root/opentxs/build/src/core/otprotob/Markets.pb.h:2062:6: error: "PROTOBUF_INLINE_NOT_IN_HEADERS" is not defined [-Werror=undef]
#if !PROTOBUF_INLINE_NOT_IN_HEADERS
^
In file included from /root/opentxs/src/../include/opentxs/core/OTStoragePB.hpp:66:0,
from /root/opentxs/src/core/OTStorage.cpp:47:
/root/opentxs/build/src/core/otprotob/Bitcoin.pb.h:833:6: error: "PROTOBUF_INLINE_NOT_IN_HEADERS" is not defined [-Werror=undef]
#if !PROTOBUF_INLINE_NOT_IN_HEADERS
^
In file included from /root/opentxs/src/../include/opentxs/core/OTStoragePB.hpp:67:0,
from /root/opentxs/src/core/OTStorage.cpp:47:
/root/opentxs/build/src/core/otprotob/Moneychanger.pb.h:1026:6: error: "PROTOBUF_INLINE_NOT_IN_HEADERS" is not defined [-Werror=undef]
#if !PROTOBUF_INLINE_NOT_IN_HEADERS
^
cc1plus: all warnings being treated as errors
src/core/CMakeFiles/opentxs-core.dir/build.make:1368: recipe for target 'src/core/CMakeFiles/opentxs-core.dir/OTStorage.cpp.o' failed
make[2]: *** [src/core/CMakeFiles/opentxs-core.dir/OTStorage.cpp.o] Error 1
make[2]: Leaving directory '/root/opentxs/build'
CMakeFiles/Makefile2:586: recipe for target 'src/core/CMakeFiles/opentxs-core.dir/all' failed
make[1]: *** [src/core/CMakeFiles/opentxs-core.dir/all] Error 2
make[1]: Leaving directory '/root/opentxs/build'
Makefile:150: recipe for target 'all' failed
make: *** [all] Error 2
Any ideas on how to deal with this? Couldn't find any help online.

I had the same problem on Ubuntu 14.04 and I fix it as you said . But I am just writing to explain more the issue.
So , After googling the error I found this discussion . In which they describe that the problem arises from the fact that the google coders are relying on the fact that the C++ standard allows you to treat an undefined preprocessor symbol as evaluating to 0. So there is a bunch of #if directives testing the value of PROTOBUF_INLINE_NOT_IN_HEADERS when it hasn’t been defined anywhere; this is legal and should be treated as if it’s a zero.
I fixed this by adding -DPROTOBUF_INLINE_NOT_IN_HEADERS=0 into CCFLAGS in the the top-level SConstruct and CXXFLAGS in src/SConscript (CXXFLAGS) and that seemed to catch it.
So to fix this , you should add this line in the CMakeList.txt that you find in opentxs main folder :
add_definitions(-DPROTOBUF_INLINE_NOT_IN_HEADERS=0)
And don't forget to repeat the cmake step .
Hope this is more clear and helpful .

Fixed this by adding this line at the top of the CMakelists.txt
add_definitions(-DPROTOBUF_INLINE_NOT_IN_HEADERS=0)

Related

GRUB build fails to compile

I cloned grub from Github https://github.com/coreos/grub, however it fails to compile and gives error. The error seems obvious but the point is how the upstream code is not compiling. Am I doing anything wrong?
I did below things to compile :
./autogen.sh
./configure --target=x86_64 --with-platform=efi
make
I get this error :
grub_script.yy.c: In function ‘yy_fatal_error’:
grub_script.yy.c:19:22: error: statement with no effect [-Werror=unused-value]
#define fprintf(...) 0
^
grub_script.yy.c:2367:2: note: in expansion of macro ‘fprintf’
fprintf( stderr, "%s\n", msg );
^
cc1: all warnings being treated as errors
Makefile:35746: recipe for target 'normal_module-grub_script.yy.o' failed
make[3]: *** [normal_module-grub_script.yy.o] Error 1
make[3]: Leaving directory '/tmp/grub-2.02/grub-core'
Makefile:23531: recipe for target 'all' failed
make[2]: *** [all] Error 2
make[2]: Leaving directory '/tmp/grub-2.02/grub-core'
Makefile:10904: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/tmp/grub-2.02'
Makefile:3130: recipe for target 'all' failed
make: *** [all] Error 2
I tried with gcc 4.8,5 as well as 7, but the same error. My host machine is Ubuntu-18 64-bit.
As #jens comments, the upstream maintainers should fix this build break. On the
face of it the fix seems simple. Meantime a workaround is simple too, and almost certainly safe.
As you see from the failing build log, you get this compilation error only
because the -Werror flag is in effect, to promote all warnings to errors.
The promoted warning that is breaking your build occurs in file grub_script.yy.c at line 2367.
It is in fact innocuous warning. You can cause it not to be promoted in either of two ways:-
The ./configure script has an option --disable-werror, which removes the -Werror
flag from all compilations. So you can run:
$ ./configure --target=x86_64 --with-platform=efi --disable-werror
$ make
This solution will cause no compilation warnings to be promoted to errors, and
is likely what you are "supposed" to be content with. You might prefer a somewhat more focussed workaround that disables
error-promotion only for the type of warning that actually broke your build:
statement with no effect [-Werror=unused-value]
You can accomplish that with:
$ ./configure --target=x86_64 --with-platform=efi CPPFLAGS=-Wno-error=unused-value
$ make

error while compiling gcc

I'm trying to compile gcc-code-assist which has the code completion feature in order to use it with emacs. However i have been getting this error message while compilinng
checking for exception model to use... configure: error: unable to detect exception model
make[1]: *** [configure-target-libstdc++-v3] Error 1
make[1]: Leaving directory `/home/dev/workspace/trash/gcc-code-assist-0.1-4.4.4'
make: *** [all] Error 2
I'm running Ubuntu 12.04 64bit
what can i do to overcome this problem
I found the right way to compile it ...
I really didn't have much knowledge of how to compile gcc (my first time)
after reading through the FAQ of building gcc I found the problem.
it turned out that I had to run the configure script and make from outside the source directory
( I called it gcc-build) so the directory list looked like this
gcc-source/
gcc-build/
then everything compiled smoothly
here's the link to the FAQ http://gcc.gnu.org/wiki/FAQ#configure

Compiling GCC 4.7.3 for i386-elf support on Cygwin

I am trying to compile GCC for Cygwin with support for targeting i386-elf so I can compile some simple OSes (search Benu, by l30nard0, on Github). I've successfully compiled the binutils for i386-elf, and compiled all of GCC's floating-point numbers dependencies.
Problem is, it says windows.h can not be found. I do have w32api successfully installed, and tried including each of those one at a time in the include path for GCC, but none of them work. If I try any of them, I get so many errors and warnings that not all will show up in the Cygwin console. The dozens upon dozens of warnings are most if not all unused parameter.
Does anyone know where the problem might lie?
I've wasted the last three entire days of my life trying to get Linux Mint set up with everything I want, but for reasons I shan't go into I gave up on that. I'd love to be able to get just one thing to work so I can enjoy my life again. :) Thanks!
BTW: The configure arguments I used were --target=i386-elf --enable-threads=win32 --enable-languages=c,c++ Was I supposed to use --enable-targets instead?
And here's part of the log:
In file included from ../../../gcc/libgcc/gthr.h:150:0,
from ../../../gcc/libgcc/unwind-dw2.c:38:
./gthr-default.h:541:21: fatal error: windows.h: No such file or directory
compilation terminated.
../../../gcc/libgcc/static-object.mk:17: recipe for target 'unwind-dw2.o' failed
make[2]: *** [unwind-dw2.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from ../../../gcc/libgcc/gthr.h:150:0,
from ../../../gcc/libgcc/unwind-dw2-fde.c:38:
./gthr-default.h:541:21: fatal error: windows.h: No such file or directory
compilation terminated.
../../../gcc/libgcc/static-object.mk:17: recipe for target 'unwind-dw2-fde.o' failed
make[2]: *** [unwind-dw2-fde.o] Error 1
make[2]: Leaving directory '/home/Sean/gccbuild/i386-elf/libgcc'
Makefile:10055: recipe for target 'all-target-libgcc' failed
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory '/home/Sean/gccbuild'
Makefile:870: recipe for target 'all' failed
make: *** [all] Error 2
Remove the --enable-threads=win32 flag; it is intended to specify thread support on the target system, not the build system.

Protocol buffers version error when trying to make Mosh source code

I've been trying to install Mosh (the mobile shell) on the following system:
[ptedder#ukch-dev-lndt03 mosh-1.2.4]$ cat /etc/*-release
CentOS release 5.3 (Final)
It configures okay, however when I try and make Mosh 1.2.4 (or 1.2.0) I get the following error:
make all-recursive
make[1]: Entering directory `/home/ptedder/bin/mosh-1.2.4'
Making all in src
make[2]: Entering directory `/home/ptedder/bin/mosh-1.2.4/src'
Making all in protobufs
make[3]: Entering directory `/home/ptedder/bin/mosh-1.2.4/src/protobufs'
make all-am
make[4]: Entering directory `/home/ptedder/bin/mosh-1.2.4/src/protobufs'
CXX userinput.pb.o
In file included from userinput.pb.cc:5:
userinput.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
userinput.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
userinput.pb.h:14:2: error: #error your headers.
make[4]: *** [userinput.pb.o] Error 1
make[4]: Leaving directory `/home/ptedder/bin/mosh-1.2.4/src/protobufs'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/ptedder/bin/mosh-1.2.4/src/protobufs'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/ptedder/bin/mosh-1.2.4/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/ptedder/bin/mosh-1.2.4'
make: *** [all] Error 2
This was with Protocol buffers version 2.4.1 (suggested it might be hardcoded into mosh here #import <string> in ios? Protobuf c++ in ios) but I've tried using Protocol buffers version 2.3.0 and 2.5.0 as well and they all give the following error:
"This file was generated by a newer version of protoc which is
userinput.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
userinput.pb.h:14:2: error: #error your headers."
any ideas?
Two years after this question was asked, I still couldn't find a good solution. I had the same problem, and eventually fixed it after some detective work. The problem was this: I had the latest version of protobuf from the git repo, https://github.com/google/protobuf. When I tried to build my project, it was throwing the error shown in qmp's answer,
#if GOOGLE_PROTOBUF_VERSION < 2004000
#error This file was generated by a newer version of protoc which is...
I was building code that someone else wrote, and in their .proto file, they didn't specify a version. The default is syntax = "proto2"; I added syntax = "proto3"; to the .proto file just before the package declaration and removed all instances of the optional and required keywords, as they are not part of version 3 syntax. Then from the command line, I regenerated the protobuf output.
prompt#ubuntu$ protoc --cpp_out=. project.proto
This updated all the files generated by protoc to version 3, which solved the issue.
If you look at userinput.pb.h, you will notice it reads
#if GOOGLE_PROTOBUF_VERSION < 2004000
#error This file was generated by a newer version of protoc which is
So protobuf-2.4.1 is sufficient for mosh-1.2.4. If you still get the error, then there may be a stray protobuf installation, likely something in /usr/local.

Cross compiling from MinGW on Fedora 18 to Windows (64 bits) for Ocaml/TclTk program

everything is in the tittle.
I've made some research on the subject and found this : http://fedoraproject.org/wiki/Features/Windows_cross_compiler.
I've followed the steps one by one, reaching the "How to set" part but when I try to compile (as the Mingw README said make MINGW_HOST=x86_64-w64-mingw32) I obtain this :
...
File "topfind.ml", line 171, characters 4-27:
Error: Unbound module Toploop
make[2]: *** [topfind.cmo] Error 2
make[2]: Leaving directory `/local/aturbin/mingw32-ocaml/build/findlib/src/findlib'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/local/aturbin/mingw32-ocaml/build/findlib'
make: *** [stamp-build-findlib] Error 2
Any ideas about what's going wrong ?
Proper cross-compilation for OCaml currently requires a set of patches which you can find at http://caml.inria.fr/mantis/view.php?id=5737 ; the patches are being integrated in the trunk version of ocaml right now, so I guess that bug report should contain the latest information.

Resources