compile simple github fails at ext submodule - c++

i am trying to compile this git https://github.com/yapb/yapb locally
i am using ubuntu 64bit, and it says i must compile 32bit
i am using now
CC=clang CXX=clang meson build-clang
but get this error
FAILED: yapb.so.p/src_chatlib.cpp.o
clang -Iyapb.so.p -I. -I.. -fvisibility=hidden -flto
-fcolor-diagnostics -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall
-Winvalid-pch -Wnon-virtual-dtor -Wextra -Wpedantic -Werror -std=c++14
-fno-exceptions -O3 -DVERSION_GENERATED -fno-threadsafe-statics
-fno-exceptions -fno-rtti -m32 -pedantic -fdata-sections
-ffunction-sections -mtune=generic -fno-builtin -funroll-loops
-fomit-frame-pointer -fno-stack-protector -fvisibility=hidden
-fvisibility-inlines-hidden -msse2 -mfpmath=sse -fPIC
-isystem../ext/crlib -isystem../ext -isystem../inc -isystem..
-isystem. -MD -MQ yapb.so.p/src_chatlib.cpp.o -MF
yapb.so.p/src_chatlib.cpp.o.d -o yapb.so.p/src_chatlib.cpp.o -c
../src/chatlib.cpp
In file included from ../src/chatlib.cpp:8:
In file included from ../inc/yapb.h:10:
In file included from ../ext/hlsdk/extdll.h:28:
In file included from ../ext/crlib/crlib/string.h:17:
../ext/crlib/crlib/array.h:15:10: fatal error: 'initializer_list' file not found
#include <initializer_list>```

Double-check the pre-requisites mentioned in YaPB Building the Bot page.
Try and open a regular CMD (instead of Powershell), making sure it inherits all your previous setups (meaning its %PATH% does reference g++.exe, pip.exe, and so on.

Related

clang-tidy with precompiled headers and cmake does not work

I have a simple setup where CMake produces the following compile command:
cd /workspaces/cmake-general/tests/project/build/examples/hello-world && /usr/local/bin/cmake -E __run_co_compile
--iwyu=/usr/local/bin/include-what-you-use
--tidy="/usr/bin/clang-tidy;-extra-arg=-Wno-unknown-warning-option;-warnings-as-errors=*;--extra-arg-before=--driver-mode=g++"
--source=/workspaces/cmake-general/tests/project/build/examples/hello-world/CMakeFiles/example-hello-world.dir/cmake_pch.hxx.cxx --
/usr/bin/c++
-I/workspaces/cmake-general/tests/project/examples/hello-world/src
-I/workspaces/cmake-general/tests/project/build -O3 -DNDEBUG -stdlib=libc++
-fcolor-diagnostics -Wall -Wextra -Wshadow -Wnon-virtual-dtor -Wold-style-cast -Wcast-align -Wunused -Woverloaded-virtual -Wpedantic -Wconversion
-Wsign-conversion -Wnull-dereference -Wdouble-promotion
-Wformat=2 -Werror -std=c++20 -Winvalid-pch -fpch-instantiate-templates
-Xclang -emit-pch -Xclang -include
-Xclang /workspaces/cmake-general/tests/project/build/examples/hello-world/CMakeFiles/example-hello-world.dir/cmake_pch.hxx
-x c++-header -MD -MT examples/hello-world/CMakeFiles/example-hello-world.dir/cmake_pch.hxx.pch -MF
CMakeFiles/example-hello-world.dir/cmake_pch.hxx.pch.d -o CMakeFiles/example-hello-world.dir/cmake_pch.hxx.pch
-c /workspaces/cmake-general/tests/project/build/examples/hello-world/CMakeFiles/example-hello-world.dir/cmake_pch.hxx.cxx
which errors our with not finding
/workspaces/cmake-general/tests/project/build/examples/example-sanitizer/CMakeFiles/example-sanitizer-address.dir/cmake_pch.hxx:5:10: error: 'iostream' file not found [clang-diagnostic-error]
#include <iostream>
^
3 errors generated.
When I take --tidy="..." stuff out of the command. It fully compiles, (also if I dont specify PCHs in the CMakeLists.txt) it works.
I am not sure what the problem is exactly.
Do PCH and clang-tidy somehow not work? Why are the include directories somehow missing? I am using LLVM-12, clang-12 on Ubuntu.
Also adding -I/usr/lib/llvm-12/include/c++/v1 does not help.

x86_64-conda_cos6-linux-gnu-cc: error trying to exec 'cc1plus': execvp: No such file or directory

I am trying to install a python library but I am getting an error
building '_pyFlask' extension
/home/lisa/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/lisagoh/anaconda3/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/lisa/anaconda3/include -fPIC -DFLASKCOMMIT="33a2752" -DHEALPIX_DATA="/mnt/c/Users/lisa_/OneDrive/Documents/Healpix_3.70/data" -DUSEXCOMPLEX=0 -DUSEMAP2TGA=0 -I/home/lisa/anaconda3/include/python3.8 -I/mnt/c/Users/lisa_/OneDrive/Documents/Healpix_3.70/include/healpix_cxx -c src/pyFlask_wrap.cxx -o build/temp.linux-x86_64-3.8/src/pyFlask_wrap.o -fopenmp
x86_64-conda_cos6-linux-gnu-cc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command '/home/lisa/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cc' failed with exit status 1
I've tried sudo apt-get g++, sudo apt-get upgrade,sudo apt-get update and they tell me I have the latest versions but it still doesn't work.
When I try g++ --print-prog-name=cc1plus I get /usr/lib/gcc/x86_64-linux-gnu/9/cc1plus but when I try to find the cc1plus file it does not exist. I'm using the Ubunto 20.04 on a Windows OS.
I'm new to Linux and any help will be greatly appreciated thank you!

Using clang to compile R packages on Windows

I've developing R packages that contain C++ code on Windows 10.
I wish to check for memory allocation errors. It sounds like the simplest path is to use clang++ with the -fsanitize=address option.
How do I configure R such that clang is the default compiler?
What I've done so far:
Install LLVM, adding binaries to the path
Set the following options in ~/.R/makevars:
CC = "path/to/llvm/bin/clang"
CXX = "path/to/llvm/bin/clang++"
CXX11 = "path/to/llvm/bin/clang++"
CXX14 = "path/to/llvm/bin/clang++"
CXXFLAGS = -O1 -g -fsanitize=address -fno-omit-frame-pointer
PKG_CXXFLAGS = -Og -fsanitize=address
LDFLAGS = -fsanitize=address
Within RStudio, run devtools::install(). I see:
- installing *source* package 'TreeTools' ...
** using staged installation
** libs
"path/to/llvm/bin/clang++" -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG -I'C:/Users/ms609/Documents/R/win-library/4.0/Rcpp/include' -Og -Wall -pedantic -mtune=generic -fsanitize=address -Wno-deprecated-declarations -O2 -Wall -gdwarf-2 -mfpmath=sse -msse2 -mstackrealign -c as_newick.cpp -o as_newick.o
"path/to/llvm/bin/clang++" -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG -I'C:/Users/ms609/Documents/R/win-library/4.0/Rcpp/include' -Og -Wall -pedantic -mtune=generic -fsanitize=address -Wno-deprecated-declarations -O2 -Wall -gdwarf-2 -mfpmath=sse -msse2 -mstackrealign -c int_to_tree.cpp -o int_to_tree.o
"path/to/llvm/bin/clang++" -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG -I'C:/Users/ms609/Documents/R/win-library/4.0/Rcpp/include' -Og -Wall -pedantic -mtune=generic -fsanitize=address -Wno-deprecated-declarations -O2 -Wall -gdwarf-2 -mfpmath=sse -msse2 -mstackrealign -c phangorn_bip.cpp -o phangorn_bip.o
"path/to/llvm/bin/clang++" -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG -I'C:/Users/ms609/Documents/R/win-library/4.0/Rcpp/include' -Og -Wall -pedantic -mtune=generic -fsanitize=address -Wno-deprecated-declarations -O2 -Wall -gdwarf-2 -mfpmath=sse -msse2 -mstackrealign -c renumber_tree.cpp -o renumber_tree.o
"path/to/llvm/bin/clang++" -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG -I'C:/Users/ms609/Documents/R/win-library/4.0/Rcpp/include' -Og -Wall -pedantic -mtune=generic -fsanitize=address -Wno-deprecated-declarations -O2 -Wall -gdwarf-2 -mfpmath=sse -msse2 -mstackrealign -c splits.cpp -o splits.o
"path/to/llvm/bin/clang++" -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.0/include" -DNDEBUG -I'C:/Users/ms609/Documents/R/win-library/4.0/Rcpp/include' -Og -Wall -pedantic -mtune=generic -fsanitize=address -Wno-deprecated-declarations -O2 -Wall -gdwarf-2 -mfpmath=sse -msse2 -mstackrealign -c tree_shape.cpp -o tree_shape.o
path/to/llvm/bin/clang++ -shared -o TreeTools.dll tmp.def RcppExports.o TreeTools-init.o as_newick.o int_to_tree.o phangorn_bip.o renumber_tree.o splits.o tree_shape.o -LC:/PROGRA~1/R/R-40~1.0/bin/i386 -lR
tmp.def : fatal error LNK1107: invalid or corrupt file: cannot read at 0x1E50
clang++: error: linker command failed with exit code 1107 (use -v to see invocation)
no DLL was created
ERROR: compilation failed for package 'TreeTools'
R seems to have successfully compiled individual source files successfully using clang, but is failing to create a .dll.
What have I missed: do I need to do anything to configure Rcmd or Rtools to run with clang rather than the default gcc?

Why this .c file just have one line "../xx/xx.c"?

I want to build mesa3d source code for some reason. I follow the guide on https://mesa3d.org/install.html and the build environment is fedora31 and gcc9.2, but there are some build error when I trying to build the code with running ninja install.
FAILED: src/mesa/drivers/dri/r200/58cd8d4##r200#sta/radeon_buffer_objects.c.o
cc -Isrc/mesa/drivers/dri/r200/58cd8d4##r200#sta -Isrc/mesa/drivers/dri/r200 -I../src/mesa/drivers/dri/r200 -Iinclude -I../include -Isrc -I../src -Isrc/mapi -I../src/mapi -Isrc/mesa -I../src/mesa -I../src/gallium/include -Isrc/gallium/auxiliary -I../src/gallium/auxiliary -Isrc/mesa/drivers/dri/common -I../src/mesa/drivers/dri/common -Isrc/util -I../src/util -I../src/mesa/drivers/dri/r200/server -Isrc/util/xmlpool -I/usr/include/libdrm -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c99 -O2 -g -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS '-DPACKAGE_VERSION="20.0.0-devel"' '-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/issues"' -DUSE_ELF_TLS -DHAVE_ST_VDPAU -DENABLE_ST_OMX_BELLAGIO=0 -DENABLE_ST_OMX_TIZONIA=0 -DHAVE_X11_PLATFORM -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_DRM -DHAVE_DRM_PLATFORM -DHAVE_SURFACELESS_PLATFORM -DENABLE_SHADER_CACHE -DHAVE___BUILTIN_BSWAP32 -DHAVE___BUILTIN_BSWAP64 -DHAVE___BUILTIN_CLZ -DHAVE___BUILTIN_CLZLL -DHAVE___BUILTIN_CTZ -DHAVE___BUILTIN_EXPECT -DHAVE___BUILTIN_FFS -DHAVE___BUILTIN_FFSLL -DHAVE___BUILTIN_POPCOUNT -DHAVE___BUILTIN_POPCOUNTLL -DHAVE___BUILTIN_UNREACHABLE -DHAVE_FUNC_ATTRIBUTE_CONST -DHAVE_FUNC_ATTRIBUTE_FLATTEN -DHAVE_FUNC_ATTRIBUTE_MALLOC -DHAVE_FUNC_ATTRIBUTE_PURE -DHAVE_FUNC_ATTRIBUTE_UNUSED -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT -DHAVE_FUNC_ATTRIBUTE_WEAK -DHAVE_FUNC_ATTRIBUTE_FORMAT -DHAVE_FUNC_ATTRIBUTE_PACKED -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL -DHAVE_FUNC_ATTRIBUTE_VISIBILITY -DHAVE_FUNC_ATTRIBUTE_ALIAS -DHAVE_FUNC_ATTRIBUTE_NORETURN -DHAVE_UINT128 -D_GNU_SOURCE -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DUSE_X86_64_ASM -DMAJOR_IN_SYSMACROS -DHAVE_SYS_SYSCTL_H -DHAVE_LINUX_FUTEX_H -DHAVE_ENDIAN_H -DHAVE_DLFCN_H -DHAVE_EXECINFO_H -DHAVE_SYS_SHM_H -DHAVE_CET_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_TIMESPEC_GET -DHAVE_MEMFD_CREATE -DHAVE_RANDOM_R -DHAVE_FLOCK -DHAVE_STRTOK_R -DHAVE_PROGRAM_INVOCATION_NAME -DHAVE_POSIX_MEMALIGN -DHAVE_STRTOD_L -DHAVE_DLADDR -DHAVE_DL_ITERATE_PHDR -DHAVE_ZLIB -DHAVE_PTHREAD -DHAVE_PTHREAD_SETAFFINITY -DHAVE_LIBDRM -DLLVM_AVAILABLE '-DMESA_LLVM_VERSION_STRING="9.0.0"' -DHAVE_VALGRIND -DHAVE_WAYLAND_PLATFORM -DWL_HIDE_DEPRECATED -DHAVE_DRI3 -DHAVE_DRI3_MODIFIERS -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=empty-body -Werror=incompatible-pointer-types -Wno-missing-field-initializers -Wno-format-truncation -fno-math-errno -fno-trapping-math -Werror=format -Wformat-security -fPIC -fvisibility=hidden -DRADEON_R200 -MD -MQ 'src/mesa/drivers/dri/r200/58cd8d4##r200#sta/radeon_buffer_objects.c.o' -MF 'src/mesa/drivers/dri/r200/58cd8d4##r200#sta/radeon_buffer_objects.c.o.d' -o 'src/mesa/drivers/dri/r200/58cd8d4##r200#sta/radeon_buffer_objects.c.o' -c ../src/mesa/drivers/dri/r200/radeon_buffer_objects.c
../src/mesa/drivers/dri/r200/radeon_buffer_objects.c:1:1: error: expected identifier or '(' before '.' token
1 | ../radeon/radeon_buffer_objects.c
| ^
Then I check the radeon_buffer_objects.c, and this file just have one file path in it.
../radeon/radeon_buffer_objects.c
I'm not very familier with gcc and clang. What is that mean? And how can I resolve this build error?
As AnthonySottile's comment said, this error is about the symbol link support. I have cloned this repo to windows before and upload to my own git server. And the error occured when I trying to build the source code from my git.
I try to clone the repo from mesa3d.org, and the issue resolved.
Thanks for the help, guys.

Code base not finding standard C++ library header

I am compiling an example application from the SDK repository of a third party vendor. I receive an error that one of the C++ header's (algorithm) cannot be found:
if [ ! -d .deps/ ]; then mkdir -p .deps/; fi
/opt/llvm-3.8.0/bin/clang++ -M -isystem/opt/tbricks/sdk/include64 -I../../.. -I../../../.. -I./../../../.. -DLINUX -DLINUX64 -DTB_USE_RCU -DURCU_INLINE_SMALL_FUNCTIONS -DU_USING_ICU_NAMESPACE=0 -DNDEBUG -D_POSIX_PTHREAD_SEMANTICS -fPIC -D_GNU_SOURCE -DTB_USE_RCU -DTB_USE_RCU -D_GLIBCXX_USE_CXX11_ABI=0 -m64 --gcc-toolchain=/opt/gcc-5.2.0 -flto=full -std=gnu++14 -D_GLIBCXX_DEPRECATED= -pipe -fno-omit-frame-pointer -ffast-math -fno-finite-math-only -pthread -march=core2 -mtune=corei7 -g -O3 -Qunused-arguments -fnon-call-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -Wshadow -Wpointer-arith -Wno-self-assign -Wno-unused-function -Wno-gnu-empty-initializer -Wno-unused-parameter -Wno-ignored-qualifiers -Wno-mismatched-tags -Wno-unused-local-typedef -Wno-parentheses-equality -Wno-unused-private-field -Wno-missing-field-initializers -Wno-missing-braces -Werror=return-type -Werror=overloaded-virtual -DSTRATEGY_BUILD_PROFILE=\"release\" ../../../../shared/Helpers.cpp > .deps/Helpers.o.d
../../../../shared/Helpers.cpp:14:10: fatal error: 'algorithm' file not found
#include <algorithm>
What sets the location path to search for C++ header files, such as algorithm? Is there anything I can grep for within makefiles?
Either install g++ alongside (you need libstdc++) or use LLVM libc++ and specify it with -stdlib=libc++