undefined reference when linking libgrpc.a when building with -std=c++11 - c++11

We were using grpc 1.15.0 for long time and linked to application compiled with C++11.
We try to upgrade grpc to 1.46.5 (base on documentation gRPC C++ 1.46 will be the last release supporting C++11)
I had simple test program that only calls
std::shared_ptr<grpc::Channel> channel = grpc::CreateChannel("https://127.0.0.1:9999", ssl_creds);
With 1.15.0 it was compiled without any errors
g++ adam_test1.cpp -std=c++11 -I/home/adam/grpc1.15.0/obj/linux_x86-64/3rd/include -L/home/adam/grpc1.15.0/obj/linux_x86-64/3rd/lib64 -l:libgrpc++.a -l:libgrpc.a -l:libgpr.a -l:libaddress_sorting.a -lcrypto -lssl -lcares -lz -pthread -o adam_test1
The same with 1.46.5 show many undefined reference.
Tried even add some libabsl but still failing
g++ adam_test1.cpp -std=c++11 -I/home/adam/grpc1.46.5/obj/linux_x86-64/3rd/include -L/usr/lib64 -L/home/adam/grpc1.46.6/obj/linux_x86-64/3rd/lib64 -l:libgrpc++.a -l:libgrpc.a -l:libgpr.a -l:libaddress_sorting.a -l:libabsl_base.a -l:libabsl_cord.a -l:libabsl_status.a -l:libabsl_strings.a -l:libabsl_synchronization.a -lcrypto -lssl -lcares -lz -pthread -lstdc++ -o adam_test2
some logs
/home/adam/grpc1.46.5/obj/linux_x86-64/3rd/lib64/libgrpc.a(client_channel.cc.o): In function `grpc_core::ClientChannel::CreateOrUpdateLbPolicyLocked(grpc_core::RefCountedPtr<grpc_core::LoadBalancingPolicy::Config>, absl::lts_20211102::optional<std::string> const&, grpc_core::Resolver::Result)':
client_channel.cc:(.text+0x8c01): undefined reference to `absl::lts_20211102::internal_statusor::Helper::HandleInvalidStatusCtorArg(absl::lts_20211102::Status*)'
/home/adam/grpc1.46.5/obj/linux_x86-64/3rd/lib64/libgrpc.a(client_channel.cc.o): In function `std::_Function_handler<void (), grpc_core::ClientChannel::SubchannelWrapper::WatcherWrapper::OnConnectivityStateChange()::{lambda()#1}>::_M_invoke(std::_Any_data const&)':
client_channel.cc:(.text._ZNSt17_Function_handlerIFvvEZN9grpc_core13ClientChannel17SubchannelWrapper14WatcherWrapper25OnConnectivityStateChangeEvEUlvE_E9_M_invokeERKSt9_Any_data[_ZNSt17_Function_handlerIFvvEZN9grpc_core13ClientChannel17SubchannelWrapper14WatcherWrapper25OnConnectivityStateChangeEvEUlvE_E9_M_invokeERKSt9_Any_data]+0x4ce): undefined reference to `absl::lts_20211102::optional_internal::throw_bad_optional_access()'
/home/adam/grpc1.46.5/obj/linux_x86-64/3rd/lib64/libgrpc.a(client_channel.cc.o): In function `absl::lts_20211102::StatusOr<absl::lts_20211102::InlinedVector<grpc_core::ServerAddress, 1ul, std::allocator<grpc_core::ServerAddress> > >::StatusOr()':
client_channel.cc:(.text._ZN4absl12lts_202111028StatusOrINS0_13InlinedVectorIN9grpc_core13ServerAddressELm1ESaIS4_EEEEC2Ev[_ZN4absl12lts_202111028StatusOrINS0_13InlinedVectorIN9grpc_core13ServerAddressELm1ESaIS4_EEEEC5Ev]+0x44): undefined reference to `absl::lts_20211102::internal_statusor::Helper::HandleInvalidStatusCtorArg(absl::lts_20211102::Status*)'
/home/adam/grpc1.46.5/obj/linux_x86-64/3rd/lib64/libgrpc.a(lb_policy.cc.o): In function `grpc_core::LoadBalancingPolicy::UpdateArgs::operator=(grpc_core::LoadBalancingPolicy::UpdateArgs&&)':
lb_policy.cc:(.text+0x69e): undefined reference to `absl::lts_20211102::internal_statusor::Helper::HandleInvalidStatusCtorArg(absl::lts_20211102::Status*)'
/home/adam/grpc1.46.5/obj/linux_x86-64/3rd/lib64/libgrpc.a(lb_policy.cc.o): In function `grpc_core::LoadBalancingPolicy::UpdateArgs::operator=(grpc_core::LoadBalancingPolicy::UpdateArgs const&)':
lb_policy.cc:(.text+0x9ac): undefined reference to `absl::lts_20211102::internal_statusor::Helper::HandleInvalidStatusCtorArg(absl::lts_20211102::Status*)'
/home/adam/grpc1.46.5/obj/linux_x86-64/3rd/lib64/libgrpc.a(lb_policy_registry.cc.o): In function `grpc_core::LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(grpc_core::Json const&, grpc_error**)':
The grpc and absl are also compiled with -std=c++11. What should be the correct cmake command to build libgrpc.a with C++11 and what other abls libs need to be linked when using it ?
git submodule update --init ${GRPC_SOURCE}/third_party/re2/ ${GRPC_SOURCE}/third_party/abseil-cpp/
# Install absl
mkdir -p "third_party/abseil-cpp/cmake/build"
pushd "third_party/abseil-cpp/cmake/build"
cmake -std=c++11 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PROD_DIR} -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE ../..
make -j4 install
popd
cmake \
-std=c++11 \
-DPKG_CONFIG_USE_CMAKE_PREFIX_PATH=1 \
-DCMAKE_BUILD_TYPE=Release \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_ABSL_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-DgRPC_ABSL_PROVIDER=module \
-DgRPC_INSTALL_SUPPORTED_FROM_MODULE=ON \
-Dc-ares_DIR=${CARES_DIR}/lib/cmake/c-ares \
-DgRPC_INSTALL_LIBDIR=${SYS_LIB_DIR} \
-D_gRPC_PROTOBUF_PROTOC=${PROTO_DIR} \
-DCMAKE_PREFIX_PATH=${OPENSSL_DIR}\\;${PROTO_DIR}\\;${ZLIB_DIR} \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-R/opt/3rd/lib64 -lprotoc -lprotobuf" \
-DCMAKE_INSTALL_PREFIX=${PROD_DIR} \
-DCMAKE_CXX_FLAGS="-I${PROTO_DIR}/include -I${OPENSSL_DIR}/include -I./third_party/cares -L${PROTO_DIR}/lib -L${OPENSSL_DIR}/lib" \
-DCMAKE_C_FLAGS="-I${PROTO_DIR}/include -I${OPENSSL_DIR}/include -L${PROTO_DIR}/lib -L${OPENSSL_DIR}/lib" \
-LAH \
../..
make && make install

I was able to build after adding libabsl in correct order and also need to run on server with newer libstdc++.so that knows __cxa_throw_bad_array_length
g++ adam_test1.cpp -std=c++11 -I/home/adam/obj/linux_x86-64/3rd/include -L/usr/lib64 -L/home/adam/obj/linux_x86-64/3rd/lib64 -l:libgrpc++.a -l:libgrpc.a -l:libgpr.a -l:libaddress_sorting.a -l:libabsl_cord.a -l:libabsl_status.a -l:libabsl_strings.a -l:libabsl_synchronization.a -l:libabsl_statusor.a -l:libabsl_bad_optional_access.a -l:libabsl_bad_variant_access.a -l:libabsl_time.a -l:libabsl_time_zone.a -l:libabsl_throw_delegate.a -l:libabsl_hash.a -l:libabsl_raw_logging_internal.a -l:libabsl_log_severity.a -l:libabsl_strings_internal.a -l:libabsl_malloc_internal.a -l:libre2.a -l:libupb.a -l:libabsl_base.a -l:libabsl_spinlock_wait.a -l:libabsl_symbolize.a -l:libabsl_str_format_internal.a -l:libabsl_random_internal_randen.a -l:libabsl_random_internal_randen_hwaes.a -l:libabsl_random_internal_randen_hwaes_impl.a -l:libabsl_random_internal_randen_slow.a -l:libabsl_random_internal_pool_urbg.a -l:libabsl_random_internal_platform.a -l:libabsl_random_internal_seed_material.a -l:libabsl_random_seed_gen_exception.a -l:libabsl_cord.a -l:libabsl_cord_internal.a -l:libabsl_cordz_functions.a -l:libabsl_cordz_info.a -l:libabsl_int128.a -l:libabsl_demangle_internal.a -l:libabsl_stacktrace.a -l:libabsl_debugging_internal.a -l:libabsl_cordz_handle.a -l:libabsl_city.a -l:libabsl_low_level_hash.a -l:libabsl_exponential_biased.a -lcrypto -lssl -lcares -lz -pthread -lstdc++ -o adam_test2
bash-4.4# nm -D /usr/lib64/libstdc++.so.6.0.25 | grep throw_bad
00000000000c02c0 T _ZSt16__throw_bad_castv
00000000000c0280 T _ZSt17__throw_bad_allocv
00000000000c0300 T _ZSt18__throw_bad_typeidv
00000000000c0240 T _ZSt21__throw_bad_exceptionv
00000000000c0720 T _ZSt25__throw_bad_function_callv
00000000000949e0 T __cxa_throw_bad_array_length
00000000000954e0 T __cxa_throw_bad_array_new_length

Related

When I compiling llvm, /usr/local/bin/ar has too many threads, taking up too much memory

My computer: 4G memory + 4G swap
My cmake parameter:
cmake -G "Ninja" \
-DCMAKE_C_COMPILER=/usr/local/bin/gcc-8.3.0 \
-DCMAKE_CXX_COMPILER=/usr/local/bin/g++-8.3.0 \
-DCMAKE_INSTALL_PREFIX=/usr/local/llvm-7.0.1 \
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;libcxx;libcxxabi;libunwind;lldb;compiler-rt;lld;polly" \
-DCMAKE_C_FLAGS="-march=native -mtune=native -O3 -pipe -fstack-protector-strong -fno-plt -fuse-ld=gold -ffat-lto-objects" \
-DCMAKE_CXX_FLAGS="-march=native -mtune=native -O3 -pipe -fstack-protector-strong -fno-plt -fuse-ld=gold -ffat-lto-objects" \
-DLLVM_TARGETS_TO_BUILD="X86" \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_OPTIMIZED_TABLEGEN=ON \
-DLLVM_CCACHE_BUILD=ON \
-DLLVM_ENABLE_LTO=ON \
-DLLVM_USE_LINKER=gold \
-DLLVM_BUILD_LLVM_DYLIB=OFF \
-DLLVM_LINK_LLVM_DYLIB=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DLLVM_ENABLE_DOXYGEN=OFF \
-DLLVM_ENABLE_SPHINX=OFF ../llvm
When I compile LLVM 9, /usr/local/bin/ar takes up a lot of threads, runs out of memory, and the following error occurs:
[138/6015] Linking CXX static library lib/libLLVMTableGen.a
FAILED: lib/libLLVMTableGen.a
: && /usr/local/cmake/bin/cmake -E remove lib/libLLVMTableGen.a && /usr/local/bin/ar qc lib/libLLVMTableGen.a lib/TableGen/CMakeFiles/LLVMTableGen.dir/Error.cpp.o lib/TableGen/CMakeFiles/LLVMTableGen.dir/JSONBackend.cpp.o lib/TableGen/CMakeFiles/LLVMTableGen.dir/Main.cpp.o lib/TableGen/CMakeFiles/LLVMTableGen.dir/Record.cpp.o lib/TableGen/CMakeFiles/LLVMTableGen.dir/SetTheory.cpp.o lib/TableGen/CMakeFiles/LLVMTableGen.dir/StringMatcher.cpp.o lib/TableGen/CMakeFiles/LLVMTableGen.dir/TableGenBackend.cpp.o lib/TableGen/CMakeFiles/LLVMTableGen.dir/TGLexer.cpp.o lib/TableGen/CMakeFiles/LLVMTableGen.dir/TGParser.cpp.o && /usr/bin/ranlib lib/libLLVMTableGen.a && :
Error running /usr/local/bin/ar: vfork
[139/6015] Linking CXX static library lib/libLLVMSupport.a
FAILED: lib/libLLVMSupport.a
: && /usr/local/cmake/bin/cmake -E remove lib/libLLVMSupport.a && /usr/local/bin/ar qc lib/libLLVMSupport.a lib/Support/CMakeFiles/LLVMSupport.dir/AArch64TargetParser.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ARMTargetParser.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/AMDGPUMetadata.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/APFloat.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/APInt.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/APSInt.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ARMBuildAttrs.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ARMAttributeParser.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ARMWinEH.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Allocator.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/BinaryStreamError.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/BinaryStreamReader.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/BinaryStreamRef.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/BinaryStreamWriter.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/BlockFrequency.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/BranchProbability.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/BuryPointer.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/CachePruning.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/circular_raw_ostream.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Chrono.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/COM.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/CodeGenCoverage.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/CommandLine.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Compression.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ConvertUTF.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ConvertUTFWrapper.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/CrashRecoveryContext.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/DataExtractor.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Debug.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/DebugCounter.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/DeltaAlgorithm.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/DAGDeltaAlgorithm.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/DJB.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Error.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ErrorHandling.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/FileCheck.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/FileUtilities.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/FileOutputBuffer.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/FoldingSet.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/FormattedStream.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/FormatVariadic.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/GlobPattern.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/GraphWriter.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Hashing.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/InitLLVM.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/IntEqClasses.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/IntervalMap.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ItaniumManglingCanonicalizer.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/JamCRC.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/JSON.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/KnownBits.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/LEB128.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/LineIterator.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Locale.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/LockFileManager.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/LowLevelType.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ManagedStatic.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/MathExtras.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/MemoryBuffer.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/MD5.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/NativeFormatting.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Optional.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Options.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Parallel.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/PluginLoader.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/PrettyStackTrace.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/RandomNumberGenerator.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Regex.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ScaledNumber.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ScopedPrinter.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/SHA1.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Signposts.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/SmallPtrSet.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/SmallVector.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/SourceMgr.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/SpecialCaseList.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Statistic.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/StringExtras.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/StringMap.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/StringPool.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/StringSaver.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/StringRef.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/SymbolRemappingReader.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/SystemUtils.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/TarWriter.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/TargetParser.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ThreadPool.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Timer.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ToolOutputFile.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/TrigramIndex.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Triple.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Twine.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Unicode.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/UnicodeCaseFold.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/VersionTuple.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/VirtualFileSystem.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/WithColor.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/YAMLParser.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/YAMLTraits.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/raw_os_ostream.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/raw_ostream.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/regcomp.c.o lib/Support/CMakeFiles/LLVMSupport.dir/regerror.c.o lib/Support/CMakeFiles/LLVMSupport.dir/regexec.c.o lib/Support/CMakeFiles/LLVMSupport.dir/regfree.c.o lib/Support/CMakeFiles/LLVMSupport.dir/regstrlcpy.c.o lib/Support/CMakeFiles/LLVMSupport.dir/xxhash.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Atomic.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/DynamicLibrary.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Errno.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Host.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Memory.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Mutex.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Path.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Process.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Program.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/RWMutex.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Signals.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/TargetRegistry.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/ThreadLocal.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Threading.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Valgrind.cpp.o lib/Support/CMakeFiles/LLVMSupport.dir/Watchdog.cpp.o && /usr/bin/ranlib lib/libLLVMSupport.a && :
Error running /usr/local/bin/ar: vfork
[140/6015] Linking CXX static library lib/libLLVMDemangle.a
FAILED: lib/libLLVMDemangle.a
: && /usr/local/cmake/bin/cmake -E remove lib/libLLVMDemangle.a && /usr/local/bin/ar qc lib/libLLVMDemangle.a lib/Demangle/CMakeFiles/LLVMDemangle.dir/Demangle.cpp.o lib/Demangle/CMakeFiles/LLVMDemangle.dir/ItaniumDemangle.cpp.o lib/Demangle/CMakeFiles/LLVMDemangle.dir/MicrosoftDemangle.cpp.o lib/Demangle/CMakeFiles/LLVMDemangle.dir/MicrosoftDemangleNodes.cpp.o && /usr/bin/ranlib lib/libLLVMDemangle.a && :
Error running /usr/local/bin/ar: vfork
ninja: build stopped: subcommand failed.
I tried to search this error codes on the web:
Error running /usr/local/bin/ar: vfork
But I found nothing.
My gcc version is:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc-8.3.0/libexec/gcc/x86_64-pc-linux-gnu/8.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/usr/local/gcc-8.3.0 --disable-bootstrap --disable-checking --disable-multilib --enable-threads=posix --enable-languages=c,c++
Thread model: posix
gcc version 8.3.0 (GCC)
My Cmake version:
cmake version 3.13.4
CMake suite maintained and supported by Kitware (kitware.com/cmake).
These are pictures that are monitored with htop:
htop screenshot 1
htop screenshot 2

can't find NDK camera and media native API symbols when linking libavdevice.a to libffmpeg.so

I'm using NDK tools to build ffmpeg shared lib which will be used in my
android rtsp project.All needed components are compiled/linked as seperate
static libs, and at last these libs will be linked as a single shared lib.
Everything goes well except the last step. error happens when linking
libavdevice, all symbols in NDK camera and media can not be found, error
log:
libavdevice/android_camera.c:702: error: undefined reference
to 'ACameraCaptureSession_stopRepeating'
libavdevice/android_camera.c:706: error: undefined reference
to 'ACameraCaptureSession_close'
libavdevice/android_camera.c:711: error: undefined reference
to 'ACaptureRequest_removeTarget'
libavdevice/android_camera.c:712: error: undefined reference
to 'ACaptureRequest_free'
libavdevice/android_camera.c:717: error: undefined reference
to 'ACameraOutputTarget_free'
libavdevice/android_camera.c:722: error: undefined reference
to 'ACaptureSessionOutputContainer_remove'
libavdevice/android_camera.c:724: error: undefined reference
to 'ACaptureSessionOutput_free'
libavdevice/android_camera.c:729: error: undefined reference
to 'ANativeWindow_release'
libavdevice/android_camera.c:734: error: undefined reference
to 'ACaptureSessionOutputContainer_free'
libavdevice/android_camera.c:739: error: undefined reference
to 'ACameraDevice_close'
libavdevice/android_camera.c:744: error: undefined reference
to 'AImageReader_delete'
libavdevice/android_camera.c:749: error: undefined reference
to 'ACameraMetadata_free'
libavdevice/android_camera.c:756: error: undefined reference
to 'ACameraManager_delete'
libavdevice/android_camera.c:172: error: undefined reference
to 'ACameraDevice_getId'
libavdevice/android_camera.c:163: error: undefined reference
to 'ACameraDevice_getId'
libavdevice/android_camera.c:392: error: undefined reference
to 'AImageReader_acquireLatestImage'
libavdevice/android_camera.c:483: error: undefined reference
to 'AImage_delete'
libavdevice/android_camera.c:345: error: undefined reference
to 'AImage_getPlanePixelStride'
libavdevice/android_camera.c:346: error: undefined reference
to 'AImage_getPlaneData'
...
Here is my build script which is ran on my Windows 7 x86_64 PC.
#!/bin/bash
export TMPDIR=D:/other/AndroidDevelopment/ffmpeg-4.0.2/ffmpegtemp
NDK=D:/software/app/android_sdk/ndk-bundle
SYSROOT=$NDK/platforms/android-28/arch-x86_64/
TOOLCHAIN=$NDK/toolchains/x86_64-4.9/prebuilt/windows-x86_64
CPU=x86_64
PREFIX=./android/$CPU
function build_one
{
./configure \
--prefix=$PREFIX \
--enable-static \
--enable-jni \
--enable-pthreads \
--enable-mediacodec \
--disable-asm \
--disable-shared \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-doc \
--disable-symver \
--cross-prefix=$TOOLCHAIN/bin/x86_64-linux-android- \
--target-os=android \
--arch=x86_64 \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags=" -isysroot $NDK/sysroot -I$NDK/sysroot/usr/include/x86_64-linux-android" \
--extra-ldflags=-pie
make clean
make -j4
make install
$TOOLCHAIN/bin/x86_64-linux-android-ld \
-rpath-link=$SYSROOT/usr/lib64 \
-L$SYSROOT/usr/lib64 \
-L$PREFIX/lib \
-soname libffmpeg.so -shared -nostdlib -Bsymbolic --whole-archive --no- undefined -o \
$PREFIX/libffmpeg.so \
libavcodec/libavcodec.a \
libavfilter/libavfilter.a \
libswresample/libswresample.a \
libavformat/libavformat.a \
libavutil/libavutil.a \
libswscale/libswscale.a \
libavdevice/libavdevice.a \
-lc -lm -lz -ldl -llog --dynamic-linker=/system/bin/linker \
$TOOLCHAIN/lib/gcc/x86_64-linux-android/4.9.x/libgcc.a \
}
build_one
Your …-ld command needs explicit references to the Android native libraries:
-lcamera2ndk -lmediandk -lnativewindow
Actually, I don't understand this obsession with the build_one shell function. Here is the minimal script that works for me, with NDK r18b2 and ffmpeg 4.0.2:
export NDK=whatever
export CPU=x86_64
export CROSS=$NDK/toolchains/$CPU-4.9/prebuilt/darwin-x86_64/bin/$CPU-linux-android-
mkdir android_$CPU
cd android_$CPU
../configure --enable-static --enable-jni --enable-pthreads --enable-mediacodec \
--disable-asm --disable-shared --disable-doc --disable-ffmpeg --disable-ffplay \
--disable-ffprobe --disable-doc --disable-symver \
--cross-prefix=$CROSS --target-os=android --arch=$CPU --enable-cross-compile \
--sysroot=$NDK/platforms/android-28/arch-$CPU \
--extra-cflags="-isysroot $NDK/sysroot -I $NDK/sysroot/usr/include -I $NDK/sysroot/usr/include/$CPU-linux-android" \
--extra-ldflags="-pie -L$NDK/platforms/android-28/arch-$CPU/usr/lib64 -lc -lm" \
--ld=$CROSS-ld
make CONFIG_V4L2_OUTDEV=no
$CROSS-ld -soname libffmpeg.so -shared -nostdlib -Bsymbolic \
--whole-archive --no-undefined -o libffmpeg.so \
libavcodec/libavcodec.a libavfilter/libavfilter.a \
libswresample/libswresample.a libavformat/libavformat.a \
libavutil/libavutil.a libswscale/libswscale.a libavdevice/libavdevice.a \
-L$NDK/platforms/android-28/arch-$CPU/usr/lib64 \
-lc -lm -lz -lcamera2ndk -lmediandk -lnativewindow
Note that I disabled v4l2 output. My compilation failed for libavdevice/v4l2.c, because the NDK definition of ioctl() was not compatible with ffmpeg.

Getting the error "cc1plus: error: unrecognized command line option "-std=c++11"" when I run code on Qt creator

I have taken the code from the following source on Github and am trying to run it from Qt on RHEL Red Hat 4.4.7-17:
https://github.com/neveraway/oclJPEGDecoder
I extracted the project folder and ran qmake -projectin it. I opened the files in Qt creator and further modified my .pro file to link OpenCL sources and add the CXX and CFLAGS.
My .pro file looks like this:
######################################################################
# Automatically generated by qmake (1.07a) Tue Mar 28 14:51:49 2017
######################################################################
TEMPLATE = app
DEPENDPATH += src \
/usr/local/cuda-7.0/lib64/
INCLUDEPATH += . src \
/usr/local/cuda-7.0/lib64/\
/usr/local/cuda-7.0/include/
# Input
HEADERS += src/bitstream.h \
src/bmp.h \
src/decoder.h \
src/huffman.h \
src/idct.h \
src/jpeg.h \
src/macro.h \
src/stdafx.h \
src/targetver.h \
src/zigzag.h
SOURCES += src/bitstream.cpp \
src/cpuIDCT8x8.cpp \
src/decoder.cpp \
src/huffman.cpp \
src/main.cpp \
src/oclDCT8x8.cpp \
src/parser.cpp \
src/stdafx.cpp \
src/main.cpp
LIBS += -L/usr/local/cuda-7.0/lib64/ -lOpenCL
QMAKE_CXXFLAGS += -std=c++11
QMAKE_CFLAGS += -std=c99
DISTFILES += \
src/idct8x8.cl \
oclJPEGDecoder.sln \
oclJPEGDecoder.vcxproj \
oclJPEGDecoder.vcxproj.filters \
README.md \
test/JPEG_example_JPG_RIP_050.jpg
When I clicked on Run qmake and then Build All, this is what I saw under "Compile Output":
18:08:23: Configuration unchanged, skipping qmake step.
18:08:23: Starting: "/usr/bin/make"
Makefile:634: warning: overriding commands for target `main.o'
Makefile:603: warning: ignoring old commands for target `main.o'
g++ -c -pipe -std=c++11 -g -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I../oclJPEGDecoder-master -I. -I../oclJPEGDecoder-master -I../oclJPEGDecoder-master/src -I/usr/local/cuda-7.0/lib64 -I/usr/local/cuda-7.0/include -I/opt/Qt5.6.2/5.6/gcc_64/include -I/opt/Qt5.6.2/5.6/gcc_64/include/QtGui -I/opt/Qt5.6.2/5.6/gcc_64/include/QtCore -I. -I/opt/Qt5.6.2/5.6/gcc_64/mkspecs/linux-g++ -o bitstream.o ../oclJPEGDecoder-master/src/bitstream.cpp
cc1plus: error: unrecognized command line option "-std=c++11"
make: *** [bitstream.o] Error 1
18:08:23: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project oclJPEGDecoder-master (kit: Desktop Qt 5.6.2 GCC 64bit)
When executing step "Make"
18:08:23: Elapsed time: 00:00.
My Makefile has the following contents:
#############################################################################
# Makefile for building: oclJPEGDecoder-master
# Generated by qmake (3.0) (Qt 5.6.2)
# Project: ../oclJPEGDecoder-master/oclJPEGDecoder-master.pro
# Template: app
# Command: /opt/Qt5.6.2/5.6/gcc_64/bin/qmake -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug -o Makefile ../oclJPEGDecoder-master/oclJPEGDecoder-master.pro
#############################################################################
MAKEFILE = Makefile
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DQT_QML_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB
CFLAGS = -pipe -g -Wall -W -D_REENTRANT -fPIC $(DEFINES)
CXXFLAGS = -pipe -std=c++11 -g -std=gnu++0x -Wall -W -D_REENTRANT -fPIC $(DEFINES)
INCPATH = -I../oclJPEGDecoder-master -I. -I../oclJPEGDecoder-master -I../oclJPEGDecoder-master/src -I/usr/local/cuda-7.0/lib64 -I/usr/local/cuda-7.0/include -I/opt/Qt5.6.2/5.6/gcc_64/include -I/opt/Qt5.6.2/5.6/gcc_64/include/QtGui -I/opt/Qt5.6.2/5.6/gcc_64/include/QtCore -I. -I/opt/Qt5.6.2/5.6/gcc_64/mkspecs/linux-g++
QMAKE = /opt/Qt5.6.2/5.6/gcc_64/bin/qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = cp -f -R
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
TAR = tar -cf
COMPRESS = gzip -9f
DISTNAME = oclJPEGDecoder-master1.0.0
DISTDIR = /root/Downloads/build-oclJPEGDecoder-master-Desktop_Qt_5_6_2_GCC_64bit-Debug/.tmp/oclJPEGDecoder-master1.0.0
LINK = g++
LFLAGS = -Wl,-rpath,/opt/Qt5.6.2/5.6/gcc_64/lib
LIBS = $(SUBLIBS) -L/usr/local/cuda-7.0/lib64/ -lOpenCL -L/opt/Qt5.6.2/5.6/gcc_64/lib -lQt5Gui -L/usr/lib64 -lQt5Core -lGL -lpthread
AR = ar cqs
RANLIB =
SED = sed
STRIP = strip
My .o files look like this:
####### Compile
bitstream.o: ../oclJPEGDecoder-master/src/bitstream.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/bitstream.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o bitstream.o ../oclJPEGDecoder-master/src/bitstream.cpp
cpuIDCT8x8.o: ../oclJPEGDecoder-master/src/cpuIDCT8x8.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/idct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o cpuIDCT8x8.o ../oclJPEGDecoder-master/src/cpuIDCT8x8.cpp
decoder.o: ../oclJPEGDecoder-master/src/decoder.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/jpeg.h \
../oclJPEGDecoder-master/src/bmp.h \
../oclJPEGDecoder-master/src/bitstream.h \
../oclJPEGDecoder-master/src/huffman.h \
../oclJPEGDecoder-master/src/zigzag.h \
../oclJPEGDecoder-master/src/idct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o decoder.o ../oclJPEGDecoder-master/src/decoder.cpp
huffman.o: ../oclJPEGDecoder-master/src/huffman.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/huffman.h \
../oclJPEGDecoder-master/src/bitstream.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o huffman.o ../oclJPEGDecoder-master/src/huffman.cpp
main.o: ../oclJPEGDecoder-master/src/main.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/bitstream.h \
../oclJPEGDecoder-master/src/huffman.h \
../oclJPEGDecoder-master/src/idct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ../oclJPEGDecoder-master/src/main.cpp
oclDCT8x8.o: ../oclJPEGDecoder-master/src/oclDCT8x8.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
/usr/local/cuda-7.0/include/CL/opencl.h \
/usr/local/cuda-7.0/include/CL/cl.h \
/usr/local/cuda-7.0/include/CL/cl_platform.h \
/usr/local/cuda-7.0/include/CL/cl_gl.h \
/usr/local/cuda-7.0/include/CL/cl_gl_ext.h \
/usr/local/cuda-7.0/include/CL/cl_ext.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/idct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o oclDCT8x8.o ../oclJPEGDecoder-master/src/oclDCT8x8.cpp
parser.o: ../oclJPEGDecoder-master/src/parser.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/jpeg.h \
../oclJPEGDecoder-master/src/decoder.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o parser.o ../oclJPEGDecoder-master/src/parser.cpp
stdafx.o: ../oclJPEGDecoder-master/src/stdafx.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o stdafx.o ../oclJPEGDecoder-master/src/stdafx.cpp
main.o: ../oclJPEGDecoder-master/src/main.cpp ../oclJPEGDecoder-master/src/stdafx.h \
../oclJPEGDecoder-master/src/targetver.h \
../oclJPEGDecoder-master/src/macro.h \
../oclJPEGDecoder-master/src/bitstream.h \
../oclJPEGDecoder-master/src/huffman.h \
../oclJPEGDecoder-master/src/idct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o ../oclJPEGDecoder-master/src/main.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:
2nd ATTEMPT WITH -std=c++0x:
I changed the CXX_FLAGS command to QMAKE_CXXFLAGS += -std=c++0x and kept everything else unchanged in my .pro file.
When I clicked on Build All after making the change, this is the output I got under "Compile Output":
18:38:06: Running steps for project oclJPEGDecoder-master...
18:38:06: Configuration unchanged, skipping qmake step.
18:38:06: Starting: "/usr/bin/make"
Makefile:634: warning: overriding commands for target `main.o'
Makefile:603: warning: ignoring old commands for target `main.o'
g++ -c -pipe -std=c++0x -g -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I../oclJPEGDecoder-master -I. -I../oclJPEGDecoder-master -I../oclJPEGDecoder-master/src -I/usr/local/cuda-7.0/lib64 -I/usr/local/cuda-7.0/include -I/opt/Qt5.6.2/5.6/gcc_64/include -I/opt/Qt5.6.2/5.6/gcc_64/include/QtGui -I/opt/Qt5.6.2/5.6/gcc_64/include/QtCore -I. -I/opt/Qt5.6.2/5.6/gcc_64/mkspecs/linux-g++ -o bitstream.o ../oclJPEGDecoder-master/src/bitstream.cpp
In file included from ../oclJPEGDecoder-master/src/bitstream.cpp:4:
../oclJPEGDecoder-master/src/bitstream.h:368: error: 'nullptr' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h:368: error: ISO C++ forbids initialization of member 'mBitReservoir'
../oclJPEGDecoder-master/src/bitstream.h:368: error: making 'mBitReservoir' static
../oclJPEGDecoder-master/src/bitstream.h:368: error: invalid in-class initialization of static data member of non-integral type 'uint8_t*'
../oclJPEGDecoder-master/src/bitstream.h:369: error: ISO C++ forbids initialization of member 'mCapacity'
../oclJPEGDecoder-master/src/bitstream.h:369: error: making 'mCapacity' static
../oclJPEGDecoder-master/src/bitstream.h:369: error: ISO C++ forbids in-class initialization of non-const static member 'mCapacity'
../oclJPEGDecoder-master/src/bitstream.h: In member function 'void BitStream::free()':
../oclJPEGDecoder-master/src/bitstream.h:96: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h:96: error: 'nullptr' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h:98: error: type '<type error>' argument given to 'delete', expected pointer
../oclJPEGDecoder-master/src/bitstream.h: In member function 'void BitStream::trim()':
../oclJPEGDecoder-master/src/bitstream.h:110: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'bool BitStream::reserve(size_t)':
../oclJPEGDecoder-master/src/bitstream.h:137: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'bool BitStream::frontBit() const':
../oclJPEGDecoder-master/src/bitstream.h:209: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'uint8_t BitStream::frontFullByte() const':
../oclJPEGDecoder-master/src/bitstream.h:214: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'uint32_t BitStream::front9b(uint8_t) const':
../oclJPEGDecoder-master/src/bitstream.h:219: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'uint32_t BitStream::front17b(uint8_t) const':
../oclJPEGDecoder-master/src/bitstream.h:227: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'uint32_t BitStream::front25b(uint8_t) const':
../oclJPEGDecoder-master/src/bitstream.h:235: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'void BitStream::writeBit(bool)':
../oclJPEGDecoder-master/src/bitstream.h:246: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h:248: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'const uint8_t* BitStream::frontData() const':
../oclJPEGDecoder-master/src/bitstream.h:307: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'uint32_t BitStream::cachedFrontBits(int)':
../oclJPEGDecoder-master/src/bitstream.h:340: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.h: In member function 'void BitStream::moveDataTo(uint8_t*)':
../oclJPEGDecoder-master/src/bitstream.h:398: error: 'mBitReservoir' was not declared in this scope
../oclJPEGDecoder-master/src/bitstream.cpp: In member function 'size_t BitStream::append(const uint8_t*, size_t)':
../oclJPEGDecoder-master/src/bitstream.cpp:22: error: 'mBitReservoir' was not declared in this scope
make: *** [bitstream.o] Error 1
18:38:06: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project oclJPEGDecoder-master (kit: Desktop Qt 5.6.2 GCC 64bit)
When executing step "Make"
18:38:06: Elapsed time: 00:00.
I got errors in bitstream.c due to incompatibility with the compiler.
How can I get around this issue? Do I absolutely need to install a new version of g++ to get this code to work? Do I need to include anything in my Makefile?
Please guide me in this matter.
EDIT:
My output for g++ --version:
g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)
Copyright (C) 2010 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.
I typed yum install rpmdevtools rpm-build and it gave me the following response:
Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security,
: subscription-manager
Setting up Install Process
Package rpmdevtools-7.5-2.el6.noarch already installed and latest version
Package rpm-build-4.8.0-55.el6.x86_64 already installed and latest version
Nothing to do
I wanted to obtain more information about gcc on my system so I typed this command:
yum list available |grep gcc
It gave me this response:
compat-gcc-34.x86_64 3.4.6-19.el6 rhel-6-workstation-rpms
compat-gcc-34-c++.x86_64 3.4.6-19.el6 rhel-6-workstation-rpms
compat-gcc-34-g77.x86_64 3.4.6-19.el6 rhel-6-workstation-rpms
gcc-gnat.x86_64 4.4.7-18.el6 rhel-6-workstation-rpms
gcc-java.x86_64 4.4.7-18.el6 rhel-6-workstation-rpms
gcc-objc.x86_64 4.4.7-18.el6 rhel-6-workstation-rpms
gcc-objc++.x86_64 4.4.7-18.el6 rhel-6-workstation-rpms
Your 4.4.7 version of gcc is too old to fully enable C++11 features.
You need to upgrade the compiler to a version superior to 4.6 ( at least ) or if it's possible for you, upgrade your distro (let's say RHEL 7) which includes a more recent compiler.

Makefile loops endless

My makefile loops endless but can't figure out why? Here is it further informations at sf.net/p/ags
AUTOMAKE_OPTIONS = foreign
top_srcdir = $(shell pwd)/src/ags
SUBDIRS = src/ags \
doc
-include ./src/ags/Makefile.am \
$(top_srcdir)/util/Makefile.am \
$(top_srcdir)/lib/Makefile.am \
$(top_srcdir)/object/Makefile.am \
$(top_srcdir)/widget/Makefile.am \
$(top_srcdir)/audio/Makefile.am \
$(top_srcdir)/audio/task/Makefile.am \
$(top_srcdir)/audio/file/Makefile.am \
$(top_srcdir)/audio/recall/Makefile.am \
$(top_srcdir)/audio/task/recall/Makefile.am \
$(top_srcdir)/file/Makefile.am \
$(top_srcdir)/X/Makefile.am \
$(top_srcdir)/X/editor/Makefile.am \
$(top_srcdir)/X/machine/Makefile.am \
$(top_srcdir)/file/Makefile.am \
$(top_srcdir)/server/Makefile.am \
./doc/Makefile.am
CC = gcc
# what flags you want to pass to the C compiler & linker
CFLAGS = -g --pedantic -Wall -O -I./src -I/usr/include
LDFLAGS = -L/lib -L/usr/lib -L/usr/X11/lib -lm -pthread -lrt -lgmp
# this lists the binaries to produce, the (non-PHONY, binary) targets in
# the previous manual Makefile
noinst_LIBRARIES = libags.a libags-thread.a libags-audio.a
bin_PROGRAMS = gsequencer
# library
libags_a_CFLAGS=
libags_a_LDFLAGS =
# application
gsequencer_CFLAGS=
gsequencer_LDFLAGS=
gsequencer_LDADD=libags.a libags-thread.a libags-audio.a
#
libags_audio_h_sources = $(ags_recall_audio_h_sources) $(ags_audio_task_h_sources) $(ags_xorg_task_h_sources) $(ags_audio_file_h_sources) $(ags_audio_recall_task_h_sources)
libags_audio_c_sources = $(ags_recall_audio_c_sources) $(ags_audio_task_c_sources) $(ags_xorg_task_c_sources) $(ags_audio_file_c_sources) $(ags_audio_recall_task_c_sources)
gsequencer_h_sources = $(ags_xorg_h_sources) $(ags_machine_h_sources) $(ags_editor_h_sources)
gsequencer_c_sources = $(ags_xorg_c_sources) $(ags_machine_c_sources) $(ags_editor_c_sources)
libags_a_SOURCES = $(ags_lib_c_sources) $(ags_object_c_sources) $(ags_util_c_sources)
libags_thread_a_SOURCES = $(ags_thread_c_sources)
libags_audio_a_SOURCES = $(ags_audio_c_sources)
libags_gui_a_SOURCES = $(ags_widget_c_sources)
gsequencer_SOURCES = $(gsequencer_c_sources) $(ags_server_c_sources) $(ags_file_c_sources)
Wiping all build scripts
rm *
Touching all files
find . -type f | xargs touch
Running the following to rebuild build scripts did it finally
aclocal
autoheader
libtoolize --force --copy
automake --add-missing --copy --foreign
autoconf
./configure
make
PROBLEM: empty Makefile.am caused infinite loop
SOLUTION: add an empty variable to it

building a 32 bit application on 64 bit debian 6 (Make)

i wanted to build an application in 64 bit mode, here is my Makefile.am
i use debian 6 amd64 for 64 bit
and this make file is for a project call theforgottenserver which is for tibia (game)
noinst_PROGRAMS = theforgottenserver
CXXFLAGS = -g -O2 -pipe
AM_CXXFLAGS = $(XML_CPPFLAGS) $(OTSERV_FLAGS) $(LUA_CFLAGS) $(DEBUG_FLAGS)\
$(MYSQL_FLAGS) $(SQLITE_FLAGS) $(PGSQL_FLAGS) $(PROFILER_FLAGS)\
$(OPTIONAL_FLAGS) -D_THREAD_SAFE -D_REENTRANT -Wall -Wextra -Wno-strict-aliasing
theforgottenserver_LDADD = $(LUA_LIBS)
if USE_MYSQL
MAYBE_MYSQL = databasemysql.cpp databasemysql.h
endif
if USE_SQLITE
MAYBE_SQLITE = databasesqlite.cpp databasesqlite.h
endif
if USE_PGSQL
MAYBE_PGSQL = databasepgsql.cpp databasepgsql.h
endif
if LOGIN_SERVER
MAYBE_LOGIN = gameservers.cpp gameservers.h
endif
if OT_ADMIN
MAYBE_OTADMIN = admin.cpp admin.h
endif
theforgottenserver_SOURCES = account.h actions.cpp actions.h $(MAYBE_OTADMIN) \
allocator.cpp allocator.h baseevents.cpp baseevents.h beds.cpp \
beds.h chat.cpp chat.h combat.cpp combat.h condition.cpp condition.h \
config.h configmanager.cpp configmanager.h connection.cpp connection.h \
const.h container.cpp container.h creature.cpp creature.h \
creatureevent.cpp creatureevent.h cylinder.cpp cylinder.h database.cpp \
database.h databasemanager.cpp databasemanager.h $(MAYBE_MYSQL) \
$(MAYBE_SQLITE) $(MAYBE_PGSQL) depot.cpp depot.h dispatcher.cpp \
dispatcher.h exception.cpp exception.h fileloader.cpp fileloader.h \
game.cpp game.h $(MAYBE_LOGIN) globalevent.cpp globalevent.h group.cpp \
group.h house.cpp house.h housetile.cpp housetile.h ioban.cpp ioban.h \
ioguild.cpp ioguild.h iologindata.cpp iologindata.h iomap.cpp iomap.h \
iomapserialize.cpp iomapserialize.h item.cpp item.h itemattributes.cpp \
itemattributes.h items.cpp items.h luascript.cpp luascript.h \
mailbox.cpp mailbox.h manager.cpp manager.h map.cpp map.h monster.cpp \
monster.h monsters.cpp monsters.h movement.cpp movement.h \
networkmessage.cpp networkmessage.h npc.cpp npc.h otpch.h otserv.cpp \
otsystem.h outfit.cpp outfit.h outputmessage.cpp outputmessage.h \
party.cpp party.h player.cpp player.h position.cpp position.h \
protocol.cpp protocol.h protocolgame.cpp protocolgame.h \
protocolhttp.cpp protocolhttp.h protocollogin.cpp protocollogin.h \
protocolold.cpp protocolold.h quests.cpp quests.h raids.cpp raids.h \
rsa.cpp rsa.h scheduler.cpp scheduler.h scriptmanager.cpp \
scriptmanager.h server.cpp server.h spawn.cpp spawn.h spells.cpp \
spells.h status.cpp status.h talkaction.cpp talkaction.h teleport.cpp \
teleport.h templates.h textlogger.cpp textlogger.h thing.cpp thing.h \
tile.cpp tile.h tools.cpp tools.h town.h trashholder.cpp trashholder.h \
waitlist.cpp waitlist.h waypoints.h weapons.cpp weapons.h vocation.cpp \
vocation.h
when i try to use 'make' command it gives me this error
/usr/bin/ld: i386 architecture of input file `allocator.o' is incompatible with i386:x86-64 output
/usr/bin/ld: i386 architecture of input file `exception.o' is incompatible with i386:x86-64 output
collect2: ld returned 1 exit status
make[1]: *** [theforgottenserver] Error 1
make[1]: Leaving directory `/home/theunkown/Downloads/TFS'
make: *** [all] Error 2

Resources