How to install libgtk2.0-dev on NixOS? - gtk2

I'm trying to build this application from source: https://gitlab.com/TheFrozenWatchers/LeagueDisplays
Whenever I try running the make command, it fails with 'gtk/gtk.h' file not found. Is there a known way to install libgtk2.0-dev in Nix (the lack of which I'm assuming is the issue here)?
For reference, I'm using these nix-shell arguments: nix-shell -p xorg.libX11 gtk2. I imagine libgtk2 isn't included in the gtk2 package, but I'm not sure how to actually get the proper headers into the environment for this to work.

Here's a shell.nix you can use:
with import <nixpkgs> {};
stdenv.mkDerivation rec {
name = "league-displays-${version}";
version = "master";
src = ./.;
doCheck = true;
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ gtk2-x11 clang rapidjson ];
preBuild = ''
substituteAllInPlace src/themes_service.h --replace "include/rapidjson/document.h" "rapidjson/document.h"
substituteInPlace Makefile --replace "pkg-config --libs --cflags gtk+-2.0" "pkg-config --libs --cflags gtk+-2.0 RapidJSON"
'';
}
When you enter the shell, instead of make run buildPhase. That way the preBuild step runs and applies some patches.
Even though I've accounted for all known dependencies, the project still doesn't build due to what appears to be some app-specific errors:
build flags: SHELL=/nix/store/mcyvp1s45scjkkhyb1m16aqlsb8wr6hs-bash-interactive-4.4-p23/bin/bash
clang++ -O3 -g -w -I. -I./src/ -Wl,-rpath,. -L./bin/ -std=c++14 -Wall -lX11 -lXt -lcef -pthread -lrt -lz `pkg-config --libs --cflags gtk+-2.0 RapidJSON` -I./thirdparty/ -c src/background_daemon.cc
src/background_daemon.cc:23:9: error: unknown type name 'AppConfig'
AppConfig* cfg = AppConfig::Acquire();
^
src/background_daemon.cc:23:26: error: use of undeclared identifier 'AppConfig'
AppConfig* cfg = AppConfig::Acquire();
^
src/background_daemon.cc:26:9: error: use of undeclared identifier 'AppConfig'
AppConfig::Release();
^
src/background_daemon.cc:71:9: error: unknown type name 'AppConfig'
AppConfig* cfg;
^
src/background_daemon.cc:76:19: error: use of undeclared identifier 'AppConfig'
cfg = AppConfig::Acquire();
^
src/background_daemon.cc:110:37: error: use of undeclared identifier 'fnvHash'
unsigned int hash = fnvHash(wp.c_str());
^
src/background_daemon.cc:133:13: error: use of undeclared identifier 'AppConfig'
AppConfig::Release();
^
7 errors generated.
make: *** [Makefile:37: background_daemon.o] Error 1

Related

Unable to build OpenCV with CUDA on RHEL 7

I am trying to build OpenCV tag 4.2 with CUDA 11.1 in an RHEL 7 docker image and are running into issues.
First issue/warning is this:
THRUST_COMPILER_DEPRECATION(C++14, pass -std=c++14 to your compiler);
Which can be resolved by removing --std=c++11 from cmake/OpenCVDetectCUDA.cmake:265.
Alright, simple enough to handle that warning. Although it would have been better to change it using a cmake option/define. The compile errors for gpu_mat.cu are there with or without the above change.
Then main problem is the build errors that are happening for gpu_mat.cu. Here is my current CMake line. I have tried a bunch of different options and at this point I'm just throwing everything and kitchen sink at it.
cmake ../ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DENABLE_CXX11=OFF \ # I have tried it set to ON \
-DCMAKE_CXX_FLAGS="-std=c++14" \ # and without this line.
-DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules/ \
-DWITH_EIGEN=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF \
-DOPENCV_ENABLE_NONFREE:BOOL=ON \
-DWITH_CUDA:BOOL=ON \
-DCMAKE_PREFIX_PATH=/usr/local/cuda-11.1 \
-DCUDA_ARCH_BIN="52 60 61 70 75 80 86" \
-DCUDA_SEPARABLE_COMPILATION=ON \
-DCUDA_VERBOSE_BUILD=ON \
-DCUDA_NVCC_FLAGS="--std=c++14" \ # even passing this didn't resolve THRUST warning
-DCUDA_FAST_MATH=ON \
-DCUDA_PROPAGATE_HOST_FLAGS=OFF \
-DCUDA_BUILD_CUBIN=ON \
-DCUDA_HOST_COMPILER=/opt/rh/devtoolset-8/root/usr/bin/c++
Here is the VERBOSE output for gpu_mat.cu build:
[ 26%] Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o
cd /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda && /usr/bin/cmake -E make_directory /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/.
cd /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda && /usr/bin/cmake -D verbose:BOOL=ON -D build_configuration:STRING=Release -D generated_file:STRING=/opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o -D generated_cubin_file:STRING=/opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o.cubin.txt -P /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.Release.cmake
-- Removing /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o
/usr/bin/cmake -E rm -f /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o
-- Generating dependency file: /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.NVCC-depend
/usr/local/cuda-11.1/bin/nvcc -M -D__CUDACC__ /opt/tmp/opencv/modules/core/src/cuda/gpu_mat.cu -o /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.NVCC-depend -ccbin /opt/rh/devtoolset-8/root/usr/bin/c++ -m64 -D__OPENCV_BUILD=1 -D_USE_MATH_DEFINES -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -DOPENCV_WITH_ITT=1 --std=c++14 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -D_FORCE_INLINES --use_fast_math -Xcompiler -DCVAPI_EXPORTS -Xcompiler -fPIC -DNVCC -I/usr/local/cuda-11.1/include -I/opt/tmp/opencv/build/3rdparty/ippicv/ippicv_lnx/icv/include -I/opt/tmp/opencv/build/3rdparty/ippicv/ippicv_lnx/iw/include -I/opt/tmp/opencv/build -I/opt/tmp/opencv/modules/core/include -I/opt/tmp/opencv/build/modules/core -I/opt/tmp/opencv_contrib/modules/cudev/include -I/opt/tmp/opencv/3rdparty/include/opencl/1.2 -I/opt/tmp/opencv/3rdparty/ittnotify/include
-- Generating temporary cmake readable file: /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp
/usr/bin/cmake -D input_file:FILEPATH=/opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.NVCC-depend -D output_file:FILEPATH=/opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp -D verbose=ON -P /usr/share/cmake-3.18/Modules/FindCUDA/make2cmake.cmake
-- Copy if different /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp to /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend
/usr/bin/cmake -E copy_if_different /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend
-- Removing /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp and /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.NVCC-depend
/usr/bin/cmake -E rm -f /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.depend.tmp /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o.NVCC-depend
-- Generating /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o
/usr/local/cuda-11.1/bin/nvcc /opt/tmp/opencv/modules/core/src/cuda/gpu_mat.cu -dc -o /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o -ccbin /opt/rh/devtoolset-8/root/usr/bin/c++ -m64 -D__OPENCV_BUILD=1 -D_USE_MATH_DEFINES -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -DOPENCV_WITH_ITT=1 --std=c++14 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -D_FORCE_INLINES --use_fast_math -Xcompiler -DCVAPI_EXPORTS -Xcompiler -fPIC -DNVCC -I/usr/local/cuda-11.1/include -I/opt/tmp/opencv/build/3rdparty/ippicv/ippicv_lnx/icv/include -I/opt/tmp/opencv/build/3rdparty/ippicv/ippicv_lnx/iw/include -I/opt/tmp/opencv/build -I/opt/tmp/opencv/modules/core/include -I/opt/tmp/opencv/build/modules/core -I/opt/tmp/opencv_contrib/modules/cudev/include -I/opt/tmp/opencv/3rdparty/include/opencl/1.2 -I/opt/tmp/opencv/3rdparty/ittnotify/include
And a snippet of the errors that immedately follow:
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/functional_hash.h: In member function 'std::size_t std::hash<float>::operator()(float) const':
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/functional_hash.h:232:22: error: expected ')' before numeric constant
return __val != 0.0f ? std::_Hash_impl::hash(__val) : 0;
~ ^~~
)
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/functional_hash.h:232:15: error: invalid operands of types 'float' and 'double(const char*) throw ()' {aka 'double(const char*)'} to binary 'operator!='
return __val != 0.0f ? std::_Hash_impl::hash(__val) : 0;
~~~~~~^~~~~~~~~~
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/functional_hash.h:232:64: error: expected ')' before ';' token
return __val != 0.0f ? std::_Hash_impl::hash(__val) : 0;
~ ^
)
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/functional_hash.h: In member function 'std::size_t std::hash<double>::operator()(double) const':
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/functional_hash.h:244:22: error: expected ')' before numeric constant
return __val != 0.0 ? std::_Hash_impl::hash(__val) : 0;
~ ^~
)
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/functional_hash.h:244:15: error: invalid operands of types 'double' and 'double(const char*) throw ()' {aka 'double(const char*)'} to binary 'operator!='
return __val != 0.0 ? std::_Hash_impl::hash(__val) : 0;
.................................
~~~
/opt/tmp/opencv/modules/core/src/cuda/gpu_mat.cu:382:4: note: to match this '('
if (value[0] == 0.0 && value[1] == 0.0 && value[2] == 0.0 && value[3] == 0.0)
^
/opt/tmp/opencv/modules/core/src/cuda/gpu_mat.cu:415:14: error: 'func_t' does not name a type; did you mean 'fpos_t'?
static const func_t funcs[7][4] =
^~~~~~
fpos_t
/opt/tmp/opencv/modules/core/src/cuda/gpu_mat.cu:426:3: error: 'funcs' was not declared in this scope
funcs[depth()][channels() - 1](*this, value, stream);
^ ~~~
-- Removing /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o
/usr/bin/cmake -E rm -f /opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o
CMake Error at cuda_compile_1_generated_gpu_mat.cu.o.Release.cmake:276 (message):
Error generating file
/opt/tmp/opencv/build/modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_gpu_mat.cu.o
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/build.make:84: modules/core/CMakeFiles/cuda_compile_1.dir/src/cuda/cuda_compile_1_generated_gpu_mat.cu.o] Error 1
make[2]: Leaving directory '/opt/tmp/opencv/build'
make[1]: *** [CMakeFiles/Makefile2:3852: modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make[1]: Leaving directory '/opt/tmp/opencv/build'
make: *** [Makefile:182: all] Error 2
I am running the build process after enabling devtools
scl enable devtoolset-8 bash # also tried with devtoolset-7
I have searched for these errors, but I guess my google-fu is weak for this. I didn't have these errors/problems when I built OpenCV 4.5.1 w/ CUDA in an Ubuntu 18 Docker image.
So I'm totally missing something and have been working on this for a couple of days. I am just out of ideas of what to do next.
Thanks for any input.
I'm seeing some very similar build errors as you are, so you're not alone! I'm told it has something to do with a recent change to centos 7, which has broken nvcc. Hopefully, it gets fixed soon.
https://gitlab.com/nvidia/container-images/cuda/-/issues/109#note_503061879
There was a reported issue with RHEL/CentOS and has since been resolved.
https://access.redhat.com/errata/RHBA-2021:0439

Problem using VariantDir with a SCons Builder that generates a list of files to use as source for Program

I have a SConstruct that build my tool in 3 steps:
build a static library. In my case it's the antlr4 c++ runtime
generate the antlr4 cpp and h files (listener, visitor etc) of an antlr4's grammar
finally build a program using those files and linking to the antlr4 runtime library.
1 and 2 can be built in any order, even together but 3 ahs to be built when the other two have finished.
All this works perfectly when I don't use any VariantDir, however SCons fails when I try to use a variant directory, saying that it can't find the autogenerated files:
cons: *** [build/Parser/CoralBaseListener.o] Source `build/Parser/CoralBaseListener.cpp' not found, needed by target `build/Parser/CoralBaseListener.o'.
this is the whole SConstruct:
import os
import subprocess
env = Environment(
CC = "clang",
CXX = "clang++",
CXXFLAGS = ['-std=c++11', '-stdlib=libc++']
)
env.Append(ENV = {'CLASSPATH': './dependencies/antlr4/antlr-4.8-complete.jar'})
# RelWithDbgInfo
env.Append(CXXFLAGS = ['-O2', '-g', '-DNDEBUG'])
VariantDir('./build', './src')
VariantDir('./build/antlr4Runtime', './dependencies/antlr4Runtime')
#
# Builder for generating grammar files with antlr4 (the java app)
#
def auto_antlr_generated_files(prefix):
return [File(prefix + _file + ext) for _file in [
'CoralBaseListener',
'CoralBaseVisitor',
'CoralLexer',
'CoralListener',
'CoralParser',
'CoralVisitor'] for ext in ['.cpp', '.h']
]
def antlr_emitter(target, source, env):
target = auto_antlr_generated_files('src/Parser/')
return target, source
AntlrBuilder = Builder(
action='java org.antlr.v4.Tool $SOURCE -Dlanguage=Cpp -package Coral -visitor -listener -o src/Parser',
emitter=antlr_emitter
)
env.Append(BUILDERS={'Antlr': AntlrBuilder})
#
# Cloning the Environment for Antlr4 runtime
#
antlrEnv = env.Clone()
antlrEnv.Append(CXXFLAGS = [
'-Wall',
'-pedantic',
'-W',
'-Wno-overloaded-virtual',
'-Wno-dollar-in-identifier-extension',
'-Wno-four-char-constants'
])
#
# Building in 3 steps, first the antlr4 runtime library, then the parser files with Antlr then the final program
#
AntlrRuntime = antlrEnv.StaticLibrary(
'lib/antlr4-runtime',
source =
Glob('./build/antlr4Runtime/*.cpp') + \
Glob('./build/antlr4Runtime/atn/*.cpp') + \
Glob('./build/antlr4Runtime/dfa/*.cpp') + \
Glob('./build/antlr4Runtime/misc/*.cpp') + \
Glob('./build/antlr4Runtime/support/*.cpp') + \
Glob('./build/antlr4Runtime/tree/*.cpp') + \
Glob('./build/antlr4Runtime/tree/pattern/*.cpp') + \
Glob('./build/antlr4Runtime/tree/xpath/*.cpp'),
CPPPATH = './build/antlr4Runtime',
ARFLAGS = 'qc'
)
ParserFiles = env.Antlr(source='./Coral.g4')
CoralLang = env.Program(target = 'coral',
source = Glob('./build/*.cpp') + Glob('./build/Parser/*.cpp'),
CPPPATH = ['./build', './build/antlr4Runtime'],
LIBPATH = './lib',
LIBS = ['antlr4-runtime']
)
Requires(ParserFiles, AntlrRuntime)
Depends(auto_antlr_generated_files('./build/src/Parser/'), ParserFiles)
Depends(CoralLang, ParserFiles)
It is probably worth mentioning that at this point, when I have the error, the autogenerated antlr4 files are not in ./src nor in ./build, So basically the command never generated them in first place.
note that without VariantDir everything works as expected. Everything is build in the right steps without problems
import os
import subprocess
env = Environment(
CC = "clang",
CXX = "clang++",
CXXFLAGS = ['-std=c++11', '-stdlib=libc++']
)
env.Append(ENV = {'CLASSPATH': './dependencies/antlr4/antlr-4.8-complete.jar'})
# RelWithDbgInfo
env.Append(CXXFLAGS = ['-O2', '-g', '-DNDEBUG'])
#
# Builder for generating grammar files with antlr4 (the java app)
#
def auto_antlr_generated_files(prefix):
return [File(prefix + _file + ext) for _file in [
'CoralBaseListener',
'CoralBaseVisitor',
'CoralLexer',
'CoralListener',
'CoralParser',
'CoralVisitor'] for ext in ['.cpp', '.h']
]
def antlr_emitter(target, source, env):
target = auto_antlr_generated_files('src/Parser/')
return target, source
AntlrBuilder = Builder(
action='java org.antlr.v4.Tool $SOURCE -Dlanguage=Cpp -package Coral -visitor -listener -o src/Parser',
emitter=antlr_emitter
)
env.Append(BUILDERS={'Antlr': AntlrBuilder})
#
# Cloning the Environment for Antlr4 runtime
#
antlrEnv = env.Clone()
antlrEnv.Append(CXXFLAGS = [
'-Wall',
'-pedantic',
'-W',
'-Wno-overloaded-virtual',
'-Wno-dollar-in-identifier-extension',
'-Wno-four-char-constants'
])
#
# Building in 3 steps, first the antlr4 runtime library, then the parser files with Antlr then the final program
#
AntlrRuntime = antlrEnv.StaticLibrary(
'lib/antlr4-runtime',
source =
Glob('./dependencies/antlr4Runtime/*.cpp') + \
Glob('./dependencies/antlr4Runtime/atn/*.cpp') + \
Glob('./dependencies/antlr4Runtime/dfa/*.cpp') + \
Glob('./dependencies/antlr4Runtime/misc/*.cpp') + \
Glob('./dependencies/antlr4Runtime/support/*.cpp') + \
Glob('./dependencies/antlr4Runtime/tree/*.cpp') + \
Glob('./dependencies/antlr4Runtime/tree/pattern/*.cpp') + \
Glob('./dependencies/antlr4Runtime/tree/xpath/*.cpp'),
CPPPATH = './dependencies/antlr4Runtime',
ARFLAGS = 'qc'
)
ParserFiles = env.Antlr(source='./Coral.g4')
CoralLang = env.Program(target = 'coral',
source = Glob('./src/*.cpp') + Glob('./src/Parser/*.cpp'),
CPPPATH = ['./src', './dependencies/antlr4Runtime'],
LIBPATH = './lib',
LIBS = ['antlr4-runtime']
)
Requires(ParserFiles, AntlrRuntime)
Depends(CoralLang, ParserFiles)
I have the feeling that I'm doing something remarkably silly but I can't figure out what exactly.
This is what SCons output with the first SConstruct, the one that uses VariantDir:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: *** [build/Parser/CoralBaseListener.o] Source `build/Parser/CoralBaseListener.cpp' not found, needed by target `build/Parser/CoralBaseListener.o'.
scons: building terminated because of errors.
This is really all and if I read this correctly, SCons is jumping straight to point 3 and of course at it fails because point 2 didn't create the files that point 3 needs as source.
This is instead a snippet of the output of the second SConstruct, the one that doesn't use VariantDir. (I cut off some of the similar lines where Scons create the static library, but they are all similar, as you know)
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
clang++ -o dependencies/antlr4Runtime/ANTLRErrorListener.o -c -std=c++11 -stdlib=libc++ -O2 -g -DNDEBUG -Wall -pedantic -W -Wno-overloaded-virtual -Wno-dollar-in-identifier-extension -Wno-four-char-constants -Idependencies/antlr4Runtime dependencies/antlr4Runtime/ANTLRErrorListener.cpp
...
clang++ -o dependencies/antlr4Runtime/tree/xpath/XPathWildcardElement.o -c -std=c++11 -stdlib=libc++ -O2 -g -DNDEBUG -Wall -pedantic -W -Wno-overloaded-virtual -Wno-dollar-in-identifier-extension -Wno-four-char-constants -Idependencies/antlr4Runtime dependencies/antlr4Runtime/tree/xpath/XPathWildcardElement.cpp
ar qc lib/libantlr4-runtime.a dependencies/antlr4Runtime/ANTLRErrorListener.o ... dependencies/antlr4Runtime/tree/xpath/XPathWildcardElement.o
ranlib lib/libantlr4-runtime.a
java org.antlr.v4.Tool Coral.g4 -Dlanguage=Cpp -package Coral -visitor -listener -o src/Parser
clang++ -o src/Parser/CoralListener.o -c -std=c++11 -stdlib=libc++ -O2 -g -DNDEBUG -Isrc -Idependencies/antlr4Runtime src/Parser/CoralListener.cpp
clang++ -o src/Parser/CoralBaseListener.o -c -std=c++11 -stdlib=libc++ -O2 -g -DNDEBUG -Isrc -Idependencies/antlr4Runtime src/Parser/CoralBaseListener.cpp
clang++ -o src/Parser/CoralParser.o -c -std=c++11 -stdlib=libc++ -O2 -g -DNDEBUG -Isrc -Idependencies/antlr4Runtime src/Parser/CoralParser.cpp
clang++ -o src/Parser/CoralLexer.o -c -std=c++11 -stdlib=libc++ -O2 -g -DNDEBUG -Isrc -Idependencies/antlr4Runtime src/Parser/CoralLexer.cpp
clang++ -o src/main.o -c -std=c++11 -stdlib=libc++ -O2 -g -DNDEBUG -Isrc -Idependencies/antlr4Runtime src/main.cpp
clang++ -o src/Parser/CoralVisitor.o -c -std=c++11 -stdlib=libc++ -O2 -g -DNDEBUG -Isrc -Idependencies/antlr4Runtime src/Parser/CoralVisitor.cpp
clang++ -o src/Parser/CoralBaseVisitor.o -c -std=c++11 -stdlib=libc++ -O2 -g -DNDEBUG -Isrc -Idependencies/antlr4Runtime src/Parser/CoralBaseVisitor.cpp
clang++ -o coral src/main.o src/Parser/CoralBaseListener.o src/Parser/CoralBaseVisitor.o src/Parser/CoralLexer.o src/Parser/CoralListener.o src/Parser/CoralParser.o src/Parser/CoralVisitor.o -Llib -lantlr4-runtime
scons: done building targets.
So reading this is obvious that Scons start with building the static library, then he runs antlr to generate the files needed to parse my syntax and finally, when all the dependencies are created, it build the program.

Tracing compiler error "undefined reference" when adding -lrt hasn't worked

Working on a large embedded linux codebase / SDK "Not Invented Here" - invented offshore by Elbonian Code Slaves nailing various things together.
Part of the codebase is Live555 WIS-Streamer. In order to (try to) fix a niggle relating to timestamps I have inserted a couple of calls to clock_gettime(CLOCK_MONOTONIC, &ts); which then caused the compilation to fail with several undefined reference to 'clock_gettime' errors.
I've had this before and it was solved by adding -lrt to the compiler options to include librealtime, however this time round it just isn't helping. I've done a lot of googling and reading SO but I can't see any definitive answer, and the makefiles for the project are a lot more complicated than the examples found across the web.
I need some help either pointing out the blindingly obvious mistake I've made in the makefile(s), or with tracing the compiler's expectations back through the chain to see where I need to make a change.
This project is cross-compiled using a set of libraries for the given hardware, so -lrt is still required (I see it's no longer necessary in later gcc libs) and we can't update or change that stuff easily.
Here's a snippet of failed compiler output, with much verbosity. I have shortened path names just to stay below the post size limit.
make[10]: Entering directory `/ipnc_rdk/ipnc_app/network/live/testProgs'
/ipnc_rdk/../dvsdk_ipnctools/linux-devkit//bin/arm-arago-linux-gnueabi-g++ -c -I../UsageEnvironment/include -I../groupsock/include -I../liveMedia/include -I../BasicUsageEnvironment/include -I. -O3 -v -DSOCKLEN_T=socklen_t -DNO_STRSTREAM=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -Wl,--verbose -lrt -Wall -DBSD=1 testMP3Streamer.cpp
Using built-in specs.
Target: arm-arago-linux-gnueabi
Thread model: posix
gcc version 4.3.3 (GCC)
COLLECT_GCC_OPTIONS='-c' '-I../UsageEnvironment/include' '-I../groupsock/include' '-I../liveMedia/include' '-I../BasicUsageEnvironment/include' '-I.' '-O3' '-v' '-DSOCKLEN_T=socklen_t' '-DNO_STRSTREAM=1' '-D_LARGEFILE_SOURCE=1' '-D_FILE_OFFSET_BITS=64' '-Wall' '-DBSD=1' '-shared-libgcc' '-mfloat-abi=soft'
../libexec/gcc/arm-arago-linux-gnueabi/4.3.3/cc1plus -quiet -v -I../UsageEnvironment/include -I../groupsock/include -I../liveMedia/include -I../BasicUsageEnvironment/include -I. -iprefix ../lib/gcc/arm-arago-linux-gnueabi/4.3.3/ -isysroot ../arm-arago-linux-gnueabi -D_GNU_SOURCE -DSOCKLEN_T=socklen_t -DNO_STRSTREAM=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DBSD=1 testMP3Streamer.cpp -quiet -dumpbase testMP3Streamer.cpp -mfloat-abi=soft -auxbase testMP3Streamer -O3 -Wall -version -o /tmp/cckqq421.s
ignoring duplicate directory "../lib/gcc/../../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/include/c++/4.3.3"
ignoring duplicate directory "../lib/gcc/../../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/include/c++/4.3.3/arm-arago-linux-gnueabi"
ignoring duplicate directory "../lib/gcc/../../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/include/c++/4.3.3/backward"
ignoring nonexistent directory "../arm-arago-linux-gnueabi/usr/local/include"
ignoring duplicate directory "../lib/gcc/../../lib/gcc/arm-arago-linux-gnueabi/4.3.3/include"
ignoring duplicate directory "../lib/gcc/../../lib/gcc/arm-arago-linux-gnueabi/4.3.3/include-fixed"
ignoring duplicate directory "../lib/gcc/../../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/include"
#include "..." search starts here:
#include <...> search starts here:
../UsageEnvironment/include
../groupsock/include
../liveMedia/include
../BasicUsageEnvironment/include
.
../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/include/c++/4.3.3
../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/include/c++/4.3.3/arm-arago-linux-gnueabi
../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/include/c++/4.3.3/backward
../lib/gcc/arm-arago-linux-gnueabi/4.3.3/include
../lib/gcc/arm-arago-linux-gnueabi/4.3.3/include-fixed
../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/include
../arm-arago-linux-gnueabi/usr/include
End of search list.
GNU C++ (GCC) version 4.3.3 (arm-arago-linux-gnueabi)
compiled by GNU C version 4.4.3, GMP version 4.2.4, MPFR version 3.0.0-p7.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 05177eff49440274f3899a250a52b5a7
COLLECT_GCC_OPTIONS='-c' '-I../UsageEnvironment/include' '-I../groupsock/include' '-I../liveMedia/include' '-I../BasicUsageEnvironment/include' '-I.' '-O3' '-v' '-DSOCKLEN_T=socklen_t' '-DNO_STRSTREAM=1' '-D_LARGEFILE_SOURCE=1' '-D_FILE_OFFSET_BITS=64' '-Wall' '-DBSD=1' '-shared-libgcc' '-mfloat-abi=soft'
../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/bin/as -mfloat-abi=soft -meabi=4 -o testMP3Streamer.o /tmp/cckqq421.s
COMPILER_PATH=../libexec/gcc/arm-arago-linux-gnueabi/4.3.3/:../libexec/gcc/:../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/bin/
LIBRARY_PATH=../lib/gcc/arm-arago-linux-gnueabi/4.3.3/:../lib/gcc/:../lib/gcc/arm-arago-linux-gnueabi/4.3.3/../../../../arm-arago-linux-gnueabi/lib/:../arm-arago-linux-gnueabi/lib/:../arm-arago-linux-gnueabi/usr/lib/
COLLECT_GCC_OPTIONS='-c' '-I../UsageEnvironment/include' '-I../groupsock/include' '-I../liveMedia/include' '-I../BasicUsageEnvironment/include' '-I.' '-O3' '-v' '-DSOCKLEN_T=socklen_t' '-DNO_STRSTREAM=1' '-D_LARGEFILE_SOURCE=1' '-D_FILE_OFFSET_BITS=64' '-Wall' '-DBSD=1' '-shared-libgcc' '-mfloat-abi=soft'
/ipnc_rdk/../dvsdk_ipnctools/linux-devkit//bin/arm-arago-linux-gnueabi-g++ -otestMP3Streamer -L. testMP3Streamer.o ../liveMedia/libliveMedia.a ../groupsock/libgroupsock.a ../BasicUsageEnvironment/libBasicUsageEnvironment.a ../UsageEnvironment/libUsageEnvironment.a
../liveMedia/libliveMedia.a: In function `RTPSink::presetNextTimestamp()':
Locale.cpp:(.text+0x3232c): undefined reference to `clock_gettime'
../liveMedia/libliveMedia.a: In function `RTCPInstance::addSR()':
Locale.cpp:(.text+0x36dd8): undefined reference to `clock_gettime'
../BasicUsageEnvironment/libBasicUsageEnvironment.a: In function `TimeNow()':
BasicHashTable.cpp:(.text+0x1edc): undefined reference to `clock_gettime'
../BasicUsageEnvironment/libBasicUsageEnvironment.a: In function `DelayQueue::DelayQueue()':
BasicHashTable.cpp:(.text+0x2378): undefined reference to `clock_gettime'
../BasicUsageEnvironment/libBasicUsageEnvironment.a: In function `DelayQueue::DelayQueue()':
BasicHashTable.cpp:(.text+0x2414): undefined reference to `clock_gettime'
../BasicUsageEnvironment/libBasicUsageEnvironment.a:BasicHashTable.cpp:(.text+0x246c): more undefined references to `clock_gettime' follow
collect2: ld returned 1 exit status
make[10]: *** [testMP3Streamer] Error 1
Unfortunately I can't attach the full output or contents of the makefile as I seem to have hit the post length limit! Here is most of one of the makefiles, I have put ...snip... where I have cut out a lot of similar entries that you can probably guess what was going on:
INCLUDES = -Iinclude -I../UsageEnvironment/include -I../groupsock/include
PREFIX = /usr/local
LIBDIR = $(PREFIX)/lib
##### Change the following for your environment:
CROSS_COMPILE= $(MVTOOL_PREFIX)
COMPILE_OPTS = $(INCLUDES) -I. -v -Wall -O3 -DSOCKLEN_T=socklen_t -DNO_STRSTREAM=1 -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 -Wl,--verbose -lrt
### JU - Added -lrt for MONOTONIC CLOCK in RTPSink.cpp
C = c
C_COMPILER = $(CROSS_COMPILE)gcc
C_FLAGS = $(COMPILE_OPTS)
CPP = cpp
CPLUSPLUS_COMPILER = $(CROSS_COMPILE)g++
CPLUSPLUS_FLAGS = $(COMPILE_OPTS) -DBSD=1
OBJ = o
LINK = $(CROSS_COMPILE)g++ -o
LINK_OPTS = -L.
CONSOLE_LINK_OPTS = $(LINK_OPTS)
LIBRARY_LINK = $(CROSS_COMPILE)ld -o
LIBRARY_LINK_OPTS = $(LINK_OPTS) -r -Bstatic
LIB_SUFFIX = a
LIBS_FOR_CONSOLE_APPLICATION =
LIBS_FOR_GUI_APPLICATION =
EXE =
##### End of variables to change
NAME = libliveMedia
LIVEMEDIA_LIB = $(NAME).$(LIB_SUFFIX)
ALL = $(LIVEMEDIA_LIB)
all: $(ALL)
.$(C).$(OBJ):
$(C_COMPILER) -c $(C_FLAGS) $<
.$(CPP).$(OBJ):
$(CPLUSPLUS_COMPILER) -c $(CPLUSPLUS_FLAGS) $<
MP3_SOURCE_OBJS = MP3FileSource.$(OBJ) ...snip... MP3InternalsHuffman.$(OBJ) MP3InternalsHuffmanTable.$(OBJ) MP3ADURTPSource.$(OBJ)
MPEG_SOURCE_OBJS = MPEG1or2Demux.$(OBJ) ...snip... ADTSAudioFileSource.$(OBJ)
H263_SOURCE_OBJS = H263plusVideoRTPSource.$(OBJ) H263plusVideoStreamFramer.$(OBJ) H263plusVideoStreamParser.$(OBJ)
AC3_SOURCE_OBJS = AC3AudioStreamFramer.$(OBJ) AC3AudioRTPSource.$(OBJ)
DV_SOURCE_OBJS = DVVideoStreamFramer.$(OBJ) DVVideoRTPSource.$(OBJ)
MP3_SINK_OBJS = MP3ADURTPSink.$(OBJ)
MPEG_SINK_OBJS = MPEG1or2AudioRTPSink.$(OBJ) $(MP3_SINK_OBJS) MPEG1or2VideoRTPSink.$(OBJ) MPEG4LATMAudioRTPSink.$(OBJ) MPEG4GenericRTPSink.$(OBJ) MPEG4ESVideoRTPSink.$(OBJ)
H263_SINK_OBJS = H263plusVideoRTPSink.$(OBJ)
H264_OR_5_SINK_OBJS = H264or5VideoRTPSink.$(OBJ) H264VideoRTPSink.$(OBJ) H265VideoRTPSink.$(OBJ)
DV_SINK_OBJS = DVVideoRTPSink.$(OBJ)
AC3_SINK_OBJS = AC3AudioRTPSink.$(OBJ)
MISC_SOURCE_OBJS = MediaSource.$(OBJ) ...snip... StreamReplicator.$(OBJ)
MISC_SINK_OBJS = MediaSink.$(OBJ) ...snip... OutputFile.$(OBJ)
MISC_FILTER_OBJS = uLawAudioFilter.$(OBJ)
TRANSPORT_STREAM_TRICK_PLAY_OBJS = MPEG2IndexFromTransportStream.$(OBJ) MPEG2TransportStreamIndexFile.$(OBJ) MPEG2TransportStreamTrickModeFilter.$(OBJ)
RTP_SOURCE_OBJS = RTPSource.$(OBJ) ...snip... VP9VideoRTPSource.$(OBJ)
RTP_SINK_OBJS = RTPSink.$(OBJ) MultiFramedRTPSink.$(OBJ) AudioRTPSink.$(OBJ) VideoRTPSink.$(OBJ) TextRTPSink.$(OBJ)
RTP_INTERFACE_OBJS = RTPInterface.$(OBJ)
RTP_OBJS = $(RTP_SOURCE_OBJS) $(RTP_SINK_OBJS) $(RTP_INTERFACE_OBJS)
RTCP_OBJS = RTCP.$(OBJ) rtcp_from_spec.$(OBJ)
GENERIC_MEDIA_SERVER_OBJS = GenericMediaServer.$(OBJ)
RTSP_OBJS = RTSPServer.$(OBJ) RTSPClient.$(OBJ) RTSPCommon.$(OBJ) RTSPServerSupportingHTTPStreaming.$(OBJ) RTSPRegisterSender.$(OBJ)
SIP_OBJS = SIPClient.$(OBJ)
SESSION_OBJS = MediaSession.$(OBJ) ...snip... ProxyServerMediaSession.$(OBJ)
QUICKTIME_OBJS = QuickTimeFileSink.$(OBJ) QuickTimeGenericRTPSource.$(OBJ)
AVI_OBJS = AVIFileSink.$(OBJ)
MATROSKA_FILE_OBJS = MatroskaFile.$(OBJ) MatroskaFileParser.$(OBJ) EBMLNumber.$(OBJ) MatroskaDemuxedTrack.$(OBJ)
MATROSKA_SERVER_MEDIA_SUBSESSION_OBJS = MatroskaFileServerMediaSubsession.$(OBJ) MP3AudioMatroskaFileServerMediaSubsession.$(OBJ)
MATROSKA_RTSP_SERVER_OBJS = MatroskaFileServerDemux.$(OBJ) $(MATROSKA_SERVER_MEDIA_SUBSESSION_OBJS)
MATROSKA_OBJS = $(MATROSKA_FILE_OBJS) $(MATROSKA_RTSP_SERVER_OBJS)
OGG_FILE_OBJS = OggFile.$(OBJ) OggFileParser.$(OBJ) OggDemuxedTrack.$(OBJ)
OGG_SERVER_MEDIA_SUBSESSION_OBJS = OggFileServerMediaSubsession.$(OBJ)
OGG_RTSP_SERVER_OBJS = OggFileServerDemux.$(OBJ) $(OGG_SERVER_MEDIA_SUBSESSION_OBJS)
OGG_OBJS = $(OGG_FILE_OBJS) $(OGG_RTSP_SERVER_OBJS)
MISC_OBJS = BitVector.$(OBJ) StreamParser.$(OBJ) DigestAuthentication.$(OBJ) ourMD5.$(OBJ) Base64.$(OBJ) Locale.$(OBJ)
LIVEMEDIA_LIB_OBJS = Media.$(OBJ) $(MISC_SOURCE_OBJS) $(MISC_SINK_OBJS) $(MISC_FILTER_OBJS) $(RTP_OBJS) $(RTCP_OBJS) $(GENERIC_MEDIA_SERVER_OBJS) $(RTSP_OBJS) $(SIP_OBJS) $(SESSION_OBJS) $(QUICKTIME_OBJS) $(AVI_OBJS) $(TRANSPORT_STREAM_TRICK_PLAY_OBJS) $(MATROSKA_OBJS) $(OGG_OBJS) $(MISC_OBJS)
$(LIVEMEDIA_LIB): $(LIVEMEDIA_LIB_OBJS) \
$(PLATFORM_SPECIFIC_LIB_OBJS)
$(LIBRARY_LINK)$# $(LIBRARY_LINK_OPTS) \
$(LIVEMEDIA_LIB_OBJS)
Media.$(CPP): include/Media.hh
include/Media.hh: include/liveMedia_version.hh
MediaSource.$(CPP): include/MediaSource.hh
include/MediaSource.hh: include/Media.hh
FramedSource.$(CPP): include/FramedSource.hh
include/FramedSource.hh: include/MediaSource.hh
...snip...
ourMD5.$(CPP): include/ourMD5.hh
Base64.$(CPP): include/Base64.hh
Locale.$(CPP): include/Locale.hh
include/liveMedia.hh:: include/MPEG1or2AudioRTPSink.hh ...snip... include/VP9VideoRTPSource.hh
include/liveMedia.hh:: include/MPEG2TransportStreamFromPESSource.hh ...snip... include/RTSPRegisterSender.hh
include/liveMedia.hh:: include/RTSPServerSupportingHTTPStreaming.hh ...snip... include/ProxyServerMediaSession.hh
clean:
-rm -rf *.$(OBJ) $(ALL) core *.core *~ include/*~
install: install1 $(INSTALL2)
install1: $(LIVEMEDIA_LIB)
install -d $(DESTDIR)$(PREFIX)/include/liveMedia $(DESTDIR)$(LIBDIR)
install -m 644 include/*.hh $(DESTDIR)$(PREFIX)/include/liveMedia
install -m 644 $(LIVEMEDIA_LIB) $(DESTDIR)$(LIBDIR)
install_shared_libraries: $(LIVEMEDIA_LIB)
ln -fs $(NAME).$(LIB_SUFFIX) $(DESTDIR)$(LIBDIR)/$(NAME).$(SHORT_LIB_SUFFIX)
ln -fs $(NAME).$(LIB_SUFFIX) $(DESTDIR)$(LIBDIR)/$(NAME).so
##### Any additional, platform-specific rules come here:
You have added -lrt - and apparently also -Wl,--verbose - to the
definition of COMPILE_OPTS. That will not work, because the $(COMPILE_OPTS)
are only passed to invocations of the compiler, and -lrt is a linker
option, which you must pass to the invocation of the linker for it have any
effect.
Remove -lrt from the definition of COMPILE_OPTS and add it to the
definition of LIBRARY_LINK_OPTS.
(The same applies to -Wl,--verbose, though you have probably only
introduced it for debugging. You clearly know that -Wl,option means
pass option through to the linker. But this instruction is addressed to
the gcc/g++ tool-driver and is effective when it is invoking the linker,
not when it is invoking the compiler. Hence you have verbose compiler output,
due to -v` option, but no verbose linker output).

Issues compiling Qt project with Google Protocol Buffer

I am building a network application with Qt and Protocol Buffer. I have a server, which can be compiled successfully, and a Qt client, which cannot be compiled with Protocol Buffer.
The server is built by running make on the following Makefile
PWD := $(shell pwd)
CXX := g++
LINKER := g++
INCDIRS := -I. -I$(PWD)/lib -I$(PWD)/lib/protobuf-2.6.1/src
LIBDIRS := $(PWD)/lib/protobuf-2.6.1/src/.libs
LIBS := -l protobuf
CXXFLAGS := -std=c++11 -pthread -g #-Wall -Wextra
BUILD_DIR=build
BIN := $(BUILD_DIR)/bin
PROTO := $(shell bash -c "pwd")/lib/protobuf-2.6.1/src/protoc
MODEL_DIR := model
MODEL_BUILD_DIR := build
BIN := $(BUILD_DIR)/bin
MODELS := $(shell bash -c "cd $(MODEL_DIR) && ls *.proto")
MODELS_SRCFILES := $(patsubst %.proto, %.pb.cc, $(MODELS))
MODELS_OBJFILES := $(addprefix $(MODEL_DIR)/$(MODEL_BUILD_DIR)/, $(patsubst %.cc,%.o,$(MODELS_SRCFILES)))
INCDIRS += -I$(MODEL_DIR)/$(MODEL_BUILD_DIR)
SERVER_DIR := server
SERVER_SRCFILES := $(wildcard $(SERVER_DIR)/*.cpp)
SERVER_OBJFILES := $(addprefix $(BIN)/, $(patsubst %.cpp,%.o,$(SERVER_SRCFILES)))
SERVER_BUILD := $(BUILD_DIR)/server
CLIENT_DIR := client
QMAKE := qmake
LIB_DIR := lib
LIB_SRCFILES := $(wildcard $(LIB_DIR)/*.cpp)
LIB_OBJFILES := $(addprefix $(BIN)/, $(patsubst %.cpp,%.o,$(LIB_SRCFILES)))
.PHONY: init_dir clean client model
all: init_dir model $(SERVER_BUILD)
run:
#export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(LIBDIRS) && ./build/server
run_client:
#export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(LIBDIRS) && ./build/client
init_dir:
#mkdir -p $(BIN)/$(SERVER_DIR) $(BIN)/$(MODEL_DIR) $(MODEL_DIR)/$(MODEL_BUILD_DIR) $(BIN)/$(LIB_DIR)
model: $(addprefix, $(MODEL_DIR)/, $(MODELS))
#cd $(MODEL_DIR) && \
for model in $(MODELS); do echo proto compiling $$model; \
$(PROTO) -I=. --cpp_out=./$(MODEL_BUILD_DIR) $$model; done && \
cd $(MODEL_BUILD_DIR) && \
for modelcc in $(MODELS_SRCFILES); do echo compiling $$modelcc; $(CXX) $(CXXFLAGS) $(INCDIRS) -c $$modelcc ; done
$(SERVER_BUILD): $(LIB_OBJFILES) $(MODELS_OBJFILES) $(SERVER_OBJFILES)
$(LINKER) $^ -L $(LIBDIRS) $(LIBS) -o $#
$(BIN)/$(SERVER_DIR)/%.o: $(SERVER_DIR)/%.cpp
$(CXX) $(CXXFLAGS) $(INCDIRS) -c $< -o $#
$(BIN)/$(LIB_DIR)/%.o: $(LIB_DIR)/%.cpp
$(CXX) $(CXXFLAGS) $(INCDIRS) -c $< -o $#
client:
#cd $(CLIENT_DIR) && $(QMAKE) && $(MAKE)
clean:
rm -rf $(BUILD_DIR) $(MODEL_DIR)/$(MODEL_BUILD_DIR)/*
The client Qt project uses this .pro:
QT += core gui
CONFIG += c++11
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = client
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
../model/build/main.model.pb.cc \
../model/build/guess.model.pb.cc \
../model/build/jack.model.pb.cc \
../model/build/system.model.pb.cc \
changename.cpp
HEADERS += mainwindow.h \
../model/build/main.model.pb.h \
../model/build/guess.model.pb.h \
../model/build/jack.model.pb.h \
../model/build/system.model.pb.h \
FORMS += mainwindow.ui \
DESTDIR=../build
OBJECTS_DIR=../build/bin/client
MOC_DIR=../build/bin/client
unix:!macx: LIBS += -L../lib/protobuf-2.6.1/src/.libs/ -lprotoc
INCLUDEPATH += ../lib/protobuf-2.6.1/src/.libs ../lib ../model/build/
DEPENDPATH += ../lib/protobuf-2.6.1/src/.libs
unix:!macx: PRE_TARGETDEPS += ../lib/protobuf-2.6.1/src/.libs/libprotoc.a
The four protoc generated files, i.e. ../model/build/*.model.pb.h, is generated by make model.
My issue is that running make model alone can successfully compile the protocol buffer implementation files. But including them as SOURCES and compile them with qmake generated Makefile does not work.
The error is as follow:
g++ -c -m64 -pipe -O2 -std=c++0x -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I. -I../lib/protobuf-2.6.1/src/.libs -I../lib -I../model/build -I/usr/include/qt5 -I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I../build/bin/client -I. -o ../build/bin/client/main.o main.cpp
In file included from mainwindow.h:6:0,
from main.cpp:1:
../model/build/main.model.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
#error This file was generated by a newer version of protoc which is
^
../model/build/main.model.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
#error incompatible with your Protocol Buffer headers. Please update
^
../model/build/main.model.pb.h:14:2: error: #error your headers.
#error your headers.
^
In file included from ../model/build/main.model.pb.h:27:0,
from mainwindow.h:6,
from main.cpp:1:
../model/build/jack.model.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
#error This file was generated by a newer version of protoc which is
^
../model/build/jack.model.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
#error incompatible with your Protocol Buffer headers. Please update
^
../model/build/jack.model.pb.h:14:2: error: #error your headers.
#error your headers.
^
In file included from ../model/build/main.model.pb.h:28:0,
from mainwindow.h:6,
from main.cpp:1:
../model/build/system.model.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
#error This file was generated by a newer version of protoc which is
^
../model/build/system.model.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
#error incompatible with your Protocol Buffer headers. Please update
^
../model/build/system.model.pb.h:14:2: error: #error your headers.
#error your headers.
^
In file included from ../model/build/system.model.pb.h:28:0,
from ../model/build/main.model.pb.h:28,
from mainwindow.h:6,
from main.cpp:1:
../model/build/guess.model.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
#error This file was generated by a newer version of protoc which is
^
../model/build/guess.model.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
#error incompatible with your Protocol Buffer headers. Please update
^
../model/build/guess.model.pb.h:14:2: error: #error your headers.
#error your headers.
^
In file included from ../model/build/main.model.pb.h:27:0,
from mainwindow.h:6,
from main.cpp:1:
../model/build/jack.model.pb.h: In member function ‘void BlackJack::Request::clear_command()’:
../model/build/jack.model.pb.h:297:20: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
if (command_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
^
../model/build/jack.model.pb.h: In member function ‘void BlackJack::Request::set_command(const string&)’:
../model/build/jack.model.pb.h:308:20: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
if (command_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
^
../model/build/jack.model.pb.h: In member function ‘void BlackJack::Request::set_command(const char*)’:
../model/build/jack.model.pb.h:316:20: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
if (command_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
^
../model/build/jack.model.pb.h: In member function ‘void BlackJack::Request::set_command(const char*, size_t)’:
../model/build/jack.model.pb.h:324:20: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
if (command_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
^
../model/build/jack.model.pb.h: In member function ‘std::string* BlackJack::Request::mutable_command()’:
../model/build/jack.model.pb.h:332:20: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
if (command_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
^
../model/build/jack.model.pb.h: In member function ‘std::string* BlackJack::Request::release_command()’:
../model/build/jack.model.pb.h:340:20: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
if (command_ == &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
^
../model/build/jack.model.pb.h:344:45: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
command_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
^
../model/build/jack.model.pb.h: In member function ‘void BlackJack::Request::set_allocated_command(std::string*)’:
../model/build/jack.model.pb.h:349:20: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
if (command_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
^
../model/build/jack.model.pb.h:357:45: error: ‘GetEmptyStringAlreadyInited’ is not a member of ‘google::protobuf::internal’
command_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
^
What could be the problem??
Thanks for your help

Disable some feauture while building Gstreamer Lib which cause Error?

I'm build gstreamer, at the step of building gstpgood/ext/aalib
The error log is
make[3]: Entering directory `sigma-gstreamer_1-2-rc5/build/gstpgood/ext'
make -C aalib
make[4]: Entering directory `/sigma-gstreamer_1-2-rc5/build/gstpgood/ext/aalib'
CC libgstaasink_la-gstaasink.lo
cc1: error: include location "/usr/include" is unsafe for cross-compilation [-Werror=poison-system-directories]
cc1: all warnings being treated as errors
make[4]: *** [libgstaasink_la-gstaasink.lo] Error 1
My friend build the same source on the other build host did not get this error. I compared gstpgood makefiles and found that my makefile has:
AALIB_CFLAGS = -I/usr/include
AALIB_CONFIG = /usr/bin/aalib-config
AALIB_LIBS = -L/usr/lib/x86_64-linux-gnu -laa
while my friend's make file has
AALIB_CFLAGS =
AALIB_CONFIG = no
AALIB_LIBS =
This aalib is used by aasink, how can i disable aasink when compiling gstreamer???
Pass --disable-aalib to configure before running make. Check ./configure --help for many other things you could disable.
Thank Sebastian Dröge!
I also find a way to bypass aalib check by editing .m4 file in: gstreamer/ext/gstpgood/m4/aalib.m4 it worked for me
#force disable aalibtes by putting enable_aalibtest=no
AC_ARG_ENABLE(aalibtest,
AC_HELP_STRING([--disable-aalibtest],
[do not try to compile and run a test AALIB program]),
, enable_aalibtest=yes)
enable_aalibtest=no
#comment some code
# AC_PATH_PROG(AALIB_CONFIG, aalib-config, no)
# min_aalib_version=ifelse([$1], ,0.11.0,$1)
# AC_MSG_CHECKING(for AALIB - version >= $min_aalib_version)
no_aalib=""
# if test "$AALIB_CONFIG" = "no" ; then
if test x$aalib_prefix == x ; then#add this line
no_aalib=yes
else
AALIB_CFLAGS="-I$aalib_prefix/include"#add this line
AALIB_LIBS="-L$aalib_prefix/lib -laa"#add this line
# AALIB_CFLAGS=`$AALIB_CONFIG $aalibconf_args --cflags`
# AALIB_LIBS=`$AALIB_CONFIG $aalibconf_args --libs`
# aalib_major_version=`$AALIB_CONFIG $aalib_args --version | \
# sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
# aalib_minor_version=`$AALIB_CONFIG $aalib_args --version | \
# sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
# aalib_micro_version=`$AALIB_CONFIG $aalib_config_args --version | \
# sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`