Compile error on cygwin with strerror_r - cygwin

I am getting a build error using make:
g++ -std=c++11 -DHAVE_CONFIG_H -I. -I../src/config -I. -I./obj -DBOOST_SP_USE_STD_ATOMIC -DBOOST_
AC_USE_STD_ATOMIC -pthread -I/usr/include -I./leveldb/include -I./leveldb/helpers/memenv -I./secp2
56k1/include -I./univalue/include -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -std=c99 -D_XOPEN_SOURCE=
500 -g -O2 -Wall -Wextra -Wformat -Wvla -Wformat-security -Wno-unused-parameter -MT libbitcoin_co
mmon_a-netbase.o -MD -MP -MF .deps/libbitcoin_common_a-netbase.Tpo -c -o libbitcoin_common_a-netbase
.o `test -f 'netbase.cpp' || echo './'`netbase.cpp
cc1plus: warning: command line option `-std=c99' is valid for C/ObjC but not for C++
In file included from /usr/include/boost/assert.hpp:58:0,
from /usr/include/boost/range/size.hpp:23,
from /usr/include/boost/range/functions.hpp:20,
from /usr/include/boost/range/iterator_range_core.hpp:38,
from /usr/include/boost/range/iterator_range.hpp:13,
from /usr/include/boost/range/as_literal.hpp:22,
from /usr/include/boost/algorithm/string/case_conv.hpp:19,
from netbase.cpp:25:
netbase.cpp: In function `bool LookupIntern(const char*, std::vector<CNetAddr>&, unsigned int, bool)
':
netbase.cpp:95:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compa
re]
assert(aiTrav->ai_addrlen >= sizeof(sockaddr_in));
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
netbase.cpp:101:39: warning: comparison between signed and unsigned integer expressions [-Wsign-comp
are]
assert(aiTrav->ai_addrlen >= sizeof(sockaddr_in6));
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
netbase.cpp: In function `std::string NetworkErrorString(int)':
netbase.cpp:720:41: error: `strerror_r' was not declared in this scope
if (strerror_r(err, buf, sizeof(buf)))
^
^
Evidently cygwin does support strerror_r as per https://cygwin.com/cygwin-api/compatibility.html#std-susv4
Code snippet where the code is breaking:
#ifdef STRERROR_R_CHAR_P /* GNU variant can return a pointer outside the passed buffer */
s = strerror_r(err, buf, sizeof(buf));
#else /* POSIX variant always returns message in buffer */
s = buf;
if (strerror_r(err, buf, sizeof(buf)))
buf[0] = 0;
#endif
Can someone guide me as to how I can fix this ?
TIA

Related

application using lttng compile errors with aarch64-xilinx-linux-g++

I am trying to porting lttng on xilinx mpsoc with linux OS, I have write a demo as same as lttng "Record user application events", it runs on Ubuntu perfectly
g++ -c -I. hello-tp.c
g++ -c hello.c
g++ -o hello hello-tp.o hello.o -llttng-ust -ldl
but when I compile it on arm linux platform I got errors:
aarch64-xilinx-linux-g++ -mcpu=cortex-a72.cortex-a53 -march=armv8-a+crc -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/home/david/project/zcu102/images/linux/sdk/sysroots/cortexa72-cortexa53-xilinx-linux -O2 -pipe -g -feliminate-unused-debug-types -c -I. hello-tp.c
In file included from hello-tp.c:4:
hello-tp.h:16:27: error: expected constructor, destructor, or type conversion before ‘(’ token
16 | LTTNG_UST_TRACEPOINT_EVENT(hello_world, my_first_tracepoint, LTTNG_ARGS, LTTNG_FIELDS)
| ^
make: *** [Makefile:14: hello-tp.o] Error 1
here is the code
hello-tp.h:
#undef LTTNG_UST_TRACEPOINT_PROVIDER
#define LTTNG_UST_TRACEPOINT_PROVIDER hello_world
#undef LTTNG_UST_TRACEPOINT_INCLUDE
#define LTTNG_UST_TRACEPOINT_INCLUDE "./hello-tp.h"
#if !defined(_HELLO_TP_H) || defined(LTTNG_UST_TRACEPOINT_HEADER_MULTI_READ)
#define _HELLO_TP_H
#include <lttng/tracepoint.h>
#define LTTNG_ARGS LTTNG_UST_TP_ARGS(int, my_integer_arg, char *, my_string_arg)
#define LTTNG_FIELDS LTTNG_UST_TP_FIELDS(lttng_ust_field_string(my_string_field, my_string_arg) lttng_ust_field_integer(int, my_integer_field, my_integer_arg))
LTTNG_UST_TRACEPOINT_EVENT(hello_world, my_first_tracepoint, LTTNG_ARGS, LTTNG_FIELDS)
#endif /* _HELLO_TP_H */
#include <lttng/tracepoint-event.h>
hello-tp.c
#define LTTNG_UST_TRACEPOINT_CREATE_PROBES
#define LTTNG_UST_TRACEPOINT_DEFINE
#include "hello-tp.h"
hello.c
#include <stdio.h>
#include "hello-tp.h"
int main(int argc, char *argv[])
{
unsigned int i;
puts("Hello, World!\nPress Enter to continue...");
/*
* The following getchar() call only exists for the purpose of this
* demonstration, to pause the application in order for you to have
* time to list its tracepoints. You don't need it otherwise.
*/
getchar();
/*
* An lttng_ust_tracepoint() call.
*
* Arguments, as defined in `hello-tp.h`:
*
* 1. Tracepoint provider name (required)
* 2. Tracepoint name (required)
* 3. `my_integer_arg` (first user-defined argument)
* 4. `my_string_arg` (second user-defined argument)
*
* Notice the tracepoint provider and tracepoint names are
* C identifiers, NOT strings: they're in fact parts of variables
* that the macros in `hello-tp.h` create.
*/
lttng_ust_tracepoint(hello_world, my_first_tracepoint, 23,
"hi there!");
for (i = 0; i < argc; i++) {
lttng_ust_tracepoint(hello_world, my_first_tracepoint,
i, argv[i]);
}
puts("Quitting now!");
lttng_ust_tracepoint(hello_world, my_first_tracepoint,
i * i, "i^2");
return 0;
}
Makefile
APP = hello
# Add any other object files to this list below
APP_OBJS = hello-tp.o hello.o
all: build
build: $(APP)
$(APP): $(APP_OBJS)
$(CXX) -o $# $(APP_OBJS) $(LDFLAGS) -llttng -ldl
hello-tp.o : hello-tp.c hello-tp.h
$(CXX) $(CXXFLAGS) -c -I. $<
hello.o : hello.c
$(CXX) $(CXXFLAGS) -c $<
clean:
rm -f $(APP) *.o
Is there anyone met such issue? I guess the problem is caused by complier but I don't find any clue...
I just ran into this problem. Check your LTTNG version. The 2.13 release (current) uses LTTNG_UST_TRACEPOINT_PROVIDER. However, older releases uses TRACEPOINT_PROVIDER. The prefix LTTNG_UST has been added all over the place. See https://lttng.org/man/3/lttng-ust/v2.13/#doc-_compatibility_with_previous_apis

Issue when building QT 5.15.2 (w/ QTWebEngine) with cross compile

Over the last few weeks, I've spent a significant amount of effort trying to simplify and streamline the build of QT for the Raspberry Pi, and I'm very close to the finishing line.
In short, I've dockerized and scripted the whole build process to ensure that we can build images for Pi 1 - Pi 4 in an easy and reproducible way without requiring a physical Raspberry Pi.
I've been able to get hardware acceleration to be detected for Pi 3 and Pi 4 as part of the ./configure step of QT, and been able to build QT Base (and a few other depencencies) just fine. However, I'm losing my mind on this last error as part of the error.
The error is very similar to what Enrico Zini descibes here, however his workaround dpkg --purge libraspberrypi-dev (or rather Andreas Gruber's) won't cut it as it will disable hardware acceleration, which I need.
The error appears in the very late stage of the QTWebEngine build:
[...]
[20312/20662] ccache /src/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -MMD -MF obj/QtWebEngineCore/gl_surface_qt.o.d -DCHROMIUM_VERSION=\"83.0.4103.122\" -DUSE_UDEV -DUSE_AURA=1 -DUSE_NSS_CERTS=1 -DUSE_OZONE=1 -DOFFICIAL_BUILD -DTOOLKIT_QT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DNO_UNWIND_TABLES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DCR_SYSROOT_HASH=3fcc1d4e44127006318371002a0f421a4fde2ab4 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DQT_NO_LINKED_LIST -DQT_NO_KEYWORDS -DQT_USE_QSTRINGBUILDER -DQ_FORWARD_DECLARE_OBJC_CLASS=QT_FORWARD_DECLARE_CLASS -DQTWEBENGINECORE_VERSION_STR=\"5.15.2\" -DQTWEBENGINEPROCESS_NAME=\"QtWebEngineProcess\" -DBUILDING_CHROMIUM -DQTWEBENGINE_EMBEDDED_SWITCHES -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_WEBCHANNEL_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_WEBENGINECOREHEADERS_LIB -DVK_NO_PROTOTYPES -DUSE_EGL -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_ENABLE_TRACING=1 -DU_ENABLE_RESOURCE_TRACING=0 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DUCHAR_TYPE=uint16_t -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DHAVE_PTHREAD -DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0 -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_POSIX -DWEBRTC_LINUX -DABSL_ALLOCATOR_NOTHROW=1 -DWEBRTC_USE_BUILTIN_ISAC_FIX=1 -DWEBRTC_USE_BUILTIN_ISAC_FLOAT=0 -DHAVE_SCTP -DNO_MAIN_THREAD_WRAPPING -DSK_CODEC_DECODES_PNG -DSK_CODEC_DECODES_WEBP -DSK_ENCODE_PNG -DSK_ENCODE_WEBP -DSK_USER_CONFIG_HEADER=\"../../skia/config/SkUserConfig.h\" -DSK_GL -DSK_CODEC_DECODES_JPEG -DSK_ENCODE_JPEG -DSK_USE_LIBGIFCODEC -DSK_VULKAN_HEADER=\"../../skia/config/SkVulkanConfig.h\" -DSK_VULKAN=1 -DSK_SUPPORT_GPU=1 -DSK_GPU_WORKAROUNDS_HEADER=\"gpu/config/gpu_driver_bug_workaround_autogen.h\" -DVK_NO_PROTOTYPES -DCRASHPAD_ZLIB_SOURCE_EXTERNAL -DUSE_SYSTEM_ZLIB=1 -DLEVELDB_PLATFORM_CHROMIUM=1 -DLEVELDB_PLATFORM_CHROMIUM=1 -DV8_DEPRECATION_WARNINGS -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/skia/config -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/skia/include/core -Igen -I../../../../../qt5/qtwebengine/src/3rdparty/chromium -I/src/qt5/qtwebengine/src/core -I/src/qt5/qtwebengine/src/core/api -I/src/qt5/qtdeclarative/include/QtQuick/5.15.2 -I/src/qt5/qtdeclarative/include/QtQuick/5.15.2/QtQuick -I/src/pi3/qtdeclarative/include/QtQuick/5.15.2 -I/src/pi3/qtdeclarative/include/QtQuick/5.15.2/QtQuick -I/src/qt5/qtbase/include/QtGui/5.15.2 -I/src/qt5/qtbase/include/QtGui/5.15.2/QtGui -I/src/pi3/qtbase/include/QtGui/5.15.2 -I/src/pi3/qtbase/include/QtGui/5.15.2/QtGui -I/src/qt5/qtdeclarative/include -I/src/qt5/qtdeclarative/include/QtQuick -I/src/pi3/qtdeclarative/include -I/src/pi3/qtdeclarative/include/QtQuick -I/src/qt5/qtbase/include -I/src/qt5/qtbase/include/QtGui -I/src/pi3/qtbase/include -I/src/pi3/qtbase/include/QtGui -I/src/qt5/qtdeclarative/include/QtQmlModels/5.15.2 -I/src/qt5/qtdeclarative/include/QtQmlModels/5.15.2/QtQmlModels -I/src/pi3/qtdeclarative/include/QtQmlModels/5.15.2 -I/src/pi3/qtdeclarative/include/QtQmlModels/5.15.2/QtQmlModels -I/src/qt5/qtdeclarative/include/QtQml/5.15.2 -I/src/qt5/qtdeclarative/include/QtQml/5.15.2/QtQml -I/src/pi3/qtdeclarative/include/QtQml/5.15.2 -I/src/pi3/qtdeclarative/include/QtQml/5.15.2/QtQml -I/src/qt5/qtbase/include/QtCore/5.15.2 -I/src/qt5/qtbase/include/QtCore/5.15.2/QtCore -I/src/pi3/qtbase/include/QtCore/5.15.2 -I/src/pi3/qtbase/include/QtCore/5.15.2/QtCore -I/src/qt5/qtdeclarative/include/QtQmlModels -I/src/pi3/qtdeclarative/include/QtQmlModels -I/src/qt5/qtwebchannel/include -I/src/qt5/qtwebchannel/include/QtWebChannel -I/src/pi3/qtwebchannel/include -I/src/pi3/qtwebchannel/include/QtWebChannel -I/src/qt5/qtdeclarative/include/QtQml -I/src/pi3/qtdeclarative/include/QtQml -I/src/qt5/qtbase/include/QtNetwork -I/src/pi3/qtbase/include/QtNetwork -I/src/qt5/qtbase/include/QtCore -I/src/pi3/qtbase/include/QtCore -I/src/qt5/qtwebengine/include -I/src/qt5/qtwebengine/include/QtWebEngineCore -I/src/qt5/qtwebengine/include/QtWebEngineCore/5.15.2 -I/src/qt5/qtwebengine/include/QtWebEngineCore/5.15.2/QtWebEngineCore -I/src/pi3/qtwebengine/include -I/src/pi3/qtwebengine/include/QtWebEngineCore -I/src/pi3/qtwebengine/include/QtWebEngineCore/5.15.2 -I/src/pi3/qtwebengine/include/QtWebEngineCore/5.15.2/QtWebEngineCore -I.moc -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -Igen/.moc -I/src/qt5/qtbase/mkspecs/devices/linux-rasp-pi3-g++ -Igen -Igen -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/libyuv/include -Igen -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/jsoncpp/source/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/jsoncpp/generated -Igen -Igen -Igen/third_party/dawn/src/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/dawn/src/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/khronos -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/gpu -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/vulkan/include -Igen -Igen -Igen -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/ced/src -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/icu/source/common -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/icu/source/i18n -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/protobuf/src -Igen/protoc_out -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/protobuf/src -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/webrtc_overrides -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/webrtc -Igen/third_party/webrtc -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/abseil-cpp -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/skia -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/libgifcodec -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/vulkan/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/skia/third_party/vulkanmemoryallocator -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/vulkan/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/compat/non_mac -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/compat/linux -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/compat/non_win -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/libwebm/source -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/leveldatabase -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/leveldatabase/src -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/leveldatabase/src/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/v8/include -Igen/v8/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/mesa_headers -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fPIC -pipe -pthread -march=armv8-a -mfloat-abi=hard -mtune=cortex-a53 -mfpu=neon -mthumb -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wno-psabi -Wno-unused-local-typedefs -Wno-maybe-uninitialized -Wno-deprecated-declarations -fno-delete-null-pointer-checks -Wno-comments -Wno-packed-not-aligned -Wno-dangling-else -Wno-missing-field-initializers -Wno-unused-parameter -O2 -fno-ident -fdata-sections -ffunction-sections -fno-omit-frame-pointer -g0 -fvisibility=hidden -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/sysroot -O2 -fno-exceptions -Wall -Wextra -D_REENTRANT -I/sysroot/usr/include/nss -I/sysroot/usr/include/nspr -std=gnu++14 -Wno-narrowing -Wno-class-memaccess -Wno-attributes -Wno-class-memaccess -Wno-subobject-linkage -Wno-invalid-offsetof -Wno-return-type -Wno-deprecated-copy -fno-exceptions -fno-rtti --sysroot=../../../../../../sysroot -fvisibility-inlines-hidden -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/sysroot -O2 -std=gnu++1y -fno-exceptions -Wall -Wextra -D_REENTRANT -Wno-unused-parameter -Wno-unused-variable -Wno-deprecated-declarations -c /src/qt5/qtwebengine/src/core/ozone/gl_surface_qt.cpp -o obj/QtWebEngineCore/gl_surface_qt.o
FAILED: obj/QtWebEngineCore/gl_surface_qt.o
ccache /src/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -MMD -MF obj/QtWebEngineCore/gl_surface_qt.o.d -DCHROMIUM_VERSION=\"83.0.4103.122\" -DUSE_UDEV -DUSE_AURA=1 -DUSE_NSS_CERTS=1 -DUSE_OZONE=1 -DOFFICIAL_BUILD -DTOOLKIT_QT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DNO_UNWIND_TABLES -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DCR_SYSROOT_HASH=3fcc1d4e44127006318371002a0f421a4fde2ab4 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DQT_NO_LINKED_LIST -DQT_NO_KEYWORDS -DQT_USE_QSTRINGBUILDER -DQ_FORWARD_DECLARE_OBJC_CLASS=QT_FORWARD_DECLARE_CLASS -DQTWEBENGINECORE_VERSION_STR=\"5.15.2\" -DQTWEBENGINEPROCESS_NAME=\"QtWebEngineProcess\" -DBUILDING_CHROMIUM -DQTWEBENGINE_EMBEDDED_SWITCHES -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_WEBCHANNEL_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_WEBENGINECOREHEADERS_LIB -DVK_NO_PROTOTYPES -DUSE_EGL -DU_USING_ICU_NAMESPACE=0 -DU_ENABLE_DYLOAD=0 -DUSE_CHROMIUM_ICU=1 -DU_ENABLE_TRACING=1 -DU_ENABLE_RESOURCE_TRACING=0 -DU_STATIC_IMPLEMENTATION -DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE -DUCHAR_TYPE=uint16_t -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DHAVE_PTHREAD -DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0 -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_POSIX -DWEBRTC_LINUX -DABSL_ALLOCATOR_NOTHROW=1 -DWEBRTC_USE_BUILTIN_ISAC_FIX=1 -DWEBRTC_USE_BUILTIN_ISAC_FLOAT=0 -DHAVE_SCTP -DNO_MAIN_THREAD_WRAPPING -DSK_CODEC_DECODES_PNG -DSK_CODEC_DECODES_WEBP -DSK_ENCODE_PNG -DSK_ENCODE_WEBP -DSK_USER_CONFIG_HEADER=\"../../skia/config/SkUserConfig.h\" -DSK_GL -DSK_CODEC_DECODES_JPEG -DSK_ENCODE_JPEG -DSK_USE_LIBGIFCODEC -DSK_VULKAN_HEADER=\"../../skia/config/SkVulkanConfig.h\" -DSK_VULKAN=1 -DSK_SUPPORT_GPU=1 -DSK_GPU_WORKAROUNDS_HEADER=\"gpu/config/gpu_driver_bug_workaround_autogen.h\" -DVK_NO_PROTOTYPES -DCRASHPAD_ZLIB_SOURCE_EXTERNAL -DUSE_SYSTEM_ZLIB=1 -DLEVELDB_PLATFORM_CHROMIUM=1 -DLEVELDB_PLATFORM_CHROMIUM=1 -DV8_DEPRECATION_WARNINGS -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/skia/config -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/skia/include/core -Igen -I../../../../../qt5/qtwebengine/src/3rdparty/chromium -I/src/qt5/qtwebengine/src/core -I/src/qt5/qtwebengine/src/core/api -I/src/qt5/qtdeclarative/include/QtQuick/5.15.2 -I/src/qt5/qtdeclarative/include/QtQuick/5.15.2/QtQuick -I/src/pi3/qtdeclarative/include/QtQuick/5.15.2 -I/src/pi3/qtdeclarative/include/QtQuick/5.15.2/QtQuick -I/src/qt5/qtbase/include/QtGui/5.15.2 -I/src/qt5/qtbase/include/QtGui/5.15.2/QtGui -I/src/pi3/qtbase/include/QtGui/5.15.2 -I/src/pi3/qtbase/include/QtGui/5.15.2/QtGui -I/src/qt5/qtdeclarative/include -I/src/qt5/qtdeclarative/include/QtQuick -I/src/pi3/qtdeclarative/include -I/src/pi3/qtdeclarative/include/QtQuick -I/src/qt5/qtbase/include -I/src/qt5/qtbase/include/QtGui -I/src/pi3/qtbase/include -I/src/pi3/qtbase/include/QtGui -I/src/qt5/qtdeclarative/include/QtQmlModels/5.15.2 -I/src/qt5/qtdeclarative/include/QtQmlModels/5.15.2/QtQmlModels -I/src/pi3/qtdeclarative/include/QtQmlModels/5.15.2 -I/src/pi3/qtdeclarative/include/QtQmlModels/5.15.2/QtQmlModels -I/src/qt5/qtdeclarative/include/QtQml/5.15.2 -I/src/qt5/qtdeclarative/include/QtQml/5.15.2/QtQml -I/src/pi3/qtdeclarative/include/QtQml/5.15.2 -I/src/pi3/qtdeclarative/include/QtQml/5.15.2/QtQml -I/src/qt5/qtbase/include/QtCore/5.15.2 -I/src/qt5/qtbase/include/QtCore/5.15.2/QtCore -I/src/pi3/qtbase/include/QtCore/5.15.2 -I/src/pi3/qtbase/include/QtCore/5.15.2/QtCore -I/src/qt5/qtdeclarative/include/QtQmlModels -I/src/pi3/qtdeclarative/include/QtQmlModels -I/src/qt5/qtwebchannel/include -I/src/qt5/qtwebchannel/include/QtWebChannel -I/src/pi3/qtwebchannel/include -I/src/pi3/qtwebchannel/include/QtWebChannel -I/src/qt5/qtdeclarative/include/QtQml -I/src/pi3/qtdeclarative/include/QtQml -I/src/qt5/qtbase/include/QtNetwork -I/src/pi3/qtbase/include/QtNetwork -I/src/qt5/qtbase/include/QtCore -I/src/pi3/qtbase/include/QtCore -I/src/qt5/qtwebengine/include -I/src/qt5/qtwebengine/include/QtWebEngineCore -I/src/qt5/qtwebengine/include/QtWebEngineCore/5.15.2 -I/src/qt5/qtwebengine/include/QtWebEngineCore/5.15.2/QtWebEngineCore -I/src/pi3/qtwebengine/include -I/src/pi3/qtwebengine/include/QtWebEngineCore -I/src/pi3/qtwebengine/include/QtWebEngineCore/5.15.2 -I/src/pi3/qtwebengine/include/QtWebEngineCore/5.15.2/QtWebEngineCore -I.moc -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -Igen/.moc -I/src/qt5/qtbase/mkspecs/devices/linux-rasp-pi3-g++ -Igen -Igen -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/perfetto/include -Igen/third_party/perfetto/build_config -Igen/third_party/perfetto -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/libyuv/include -Igen -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/jsoncpp/source/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/jsoncpp/generated -Igen -Igen -Igen/third_party/dawn/src/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/dawn/src/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/khronos -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/gpu -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/vulkan/include -Igen -Igen -Igen -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/boringssl/src/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/ced/src -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/icu/source/common -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/icu/source/i18n -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/protobuf/src -Igen/protoc_out -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/protobuf/src -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/webrtc_overrides -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/webrtc -Igen/third_party/webrtc -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/abseil-cpp -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/skia -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/libgifcodec -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/vulkan/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/skia/third_party/vulkanmemoryallocator -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/vulkan/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/compat/non_mac -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/compat/linux -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/crashpad/crashpad/compat/non_win -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/libwebm/source -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/leveldatabase -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/leveldatabase/src -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/leveldatabase/src/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/v8/include -Igen/v8/include -I../../../../../qt5/qtwebengine/src/3rdparty/chromium/third_party/mesa_headers -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -fno-unwind-tables -fno-asynchronous-unwind-tables -fPIC -pipe -pthread -march=armv8-a -mfloat-abi=hard -mtune=cortex-a53 -mfpu=neon -mthumb -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -Wno-psabi -Wno-unused-local-typedefs -Wno-maybe-uninitialized -Wno-deprecated-declarations -fno-delete-null-pointer-checks -Wno-comments -Wno-packed-not-aligned -Wno-dangling-else -Wno-missing-field-initializers -Wno-unused-parameter -O2 -fno-ident -fdata-sections -ffunction-sections -fno-omit-frame-pointer -g0 -fvisibility=hidden -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/sysroot -O2 -fno-exceptions -Wall -Wextra -D_REENTRANT -I/sysroot/usr/include/nss -I/sysroot/usr/include/nspr -std=gnu++14 -Wno-narrowing -Wno-class-memaccess -Wno-attributes -Wno-class-memaccess -Wno-subobject-linkage -Wno-invalid-offsetof -Wno-return-type -Wno-deprecated-copy -fno-exceptions -fno-rtti --sysroot=../../../../../../sysroot -fvisibility-inlines-hidden -march=armv8-a -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard --sysroot=/sysroot -O2 -std=gnu++1y -fno-exceptions -Wall -Wextra -D_REENTRANT -Wno-unused-parameter -Wno-unused-variable -Wno-deprecated-declarations -c /src/qt5/qtwebengine/src/core/ozone/gl_surface_qt.cpp -o obj/QtWebEngineCore/gl_surface_qt.o
In file included from ../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings.h:511:0,
from /src/qt5/qtwebengine/src/core/ozone/gl_surface_qt.cpp:57:
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_autogen_egl.h:201:5: error: 'EGLDeviceEXT' has not been declared
EGLDeviceEXT* devices,
^~~~~~~~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_autogen_egl.h:204:5: error: typedef 'gl::eglQueryDeviceStringEXTProc' is initialized (use decltype instead)
EGLDeviceEXT device,
^~~~~~~~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_autogen_egl.h:204:5: error: 'EGLDeviceEXT' was not declared in this scope
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_autogen_egl.h:205:12: error: expected primary-expression before 'name'
EGLint name);
^~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_autogen_egl.h:239:5: error: 'EGLSetBlobFuncANDROID' has not been declared
EGLSetBlobFuncANDROID set,
^~~~~~~~~~~~~~~~~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_autogen_egl.h:240:5: error: 'EGLGetBlobFuncANDROID' has not been declared
EGLGetBlobFuncANDROID get);
^~~~~~~~~~~~~~~~~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_autogen_egl.h:371:3: error: 'eglQueryDeviceStringEXTProc' does not name a type; did you mean 'eglQueryDeviceStringEXT'?
eglQueryDeviceStringEXTProc eglQueryDeviceStringEXTFn;
^~~~~~~~~~~~~~~~~~~~~~~~~~~
eglQueryDeviceStringEXT
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_autogen_egl.h:567:43: error: 'EGLDeviceEXT' has not been declared
EGLDeviceEXT* devices,
^~~~~~~~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_autogen_egl.h:569:49: error: 'eglQueryDeviceStringEXTFn' declared as a 'virtual' field
virtual const char* eglQueryDeviceStringEXTFn(EGLDeviceEXT device,
^~~~~~~~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_autogen_egl.h:569:23: error: expected ';' at end of member declaration
virtual const char* eglQueryDeviceStringEXTFn(EGLDeviceEXT device,
^~~~~~~~~~~~~~~~~~~~~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_autogen_egl.h:569:62: error: expected ')' before 'device'
virtual const char* eglQueryDeviceStringEXTFn(EGLDeviceEXT device,
^~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_autogen_egl.h:599:46: error: 'EGLSetBlobFuncANDROID' has not been declared
EGLSetBlobFuncANDROID set,
^~~~~~~~~~~~~~~~~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_autogen_egl.h:600:46: error: 'EGLGetBlobFuncANDROID' has not been declared
EGLGetBlobFuncANDROID get) = 0;
^~~~~~~~~~~~~~~~~~~~~
In file included from ../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_egl_api_implementation.h:31:0,
from /src/qt5/qtwebengine/src/core/ozone/gl_surface_qt.cpp:71:
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_api_autogen_egl.h:164:33: error: 'EGLDeviceEXT' has not been declared
EGLDeviceEXT* devices,
^~~~~~~~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_api_autogen_egl.h:166:13: error: expected ';' at end of member declaration
const char* eglQueryDeviceStringEXTFn(EGLDeviceEXT device,
^~~~~~~~~~~~~~~~~~~~~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_api_autogen_egl.h:166:52: error: expected ')' before 'device'
const char* eglQueryDeviceStringEXTFn(EGLDeviceEXT device,
^~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_api_autogen_egl.h:196:36: error: 'EGLSetBlobFuncANDROID' has not been declared
EGLSetBlobFuncANDROID set,
^~~~~~~~~~~~~~~~~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_api_autogen_egl.h:197:36: error: 'EGLGetBlobFuncANDROID' has not been declared
EGLGetBlobFuncANDROID get) override;
^~~~~~~~~~~~~~~~~~~~~
In file included from ../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_egl_api_implementation.h:66:0,
from /src/qt5/qtwebengine/src/core/ozone/gl_surface_qt.cpp:71:
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_api_autogen_egl.h:164:33: error: 'EGLDeviceEXT' has not been declared
EGLDeviceEXT* devices,
^~~~~~~~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_api_autogen_egl.h:166:13: error: expected ';' at end of member declaration
const char* eglQueryDeviceStringEXTFn(EGLDeviceEXT device,
^~~~~~~~~~~~~~~~~~~~~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_api_autogen_egl.h:166:52: error: expected ')' before 'device'
const char* eglQueryDeviceStringEXTFn(EGLDeviceEXT device,
^~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_api_autogen_egl.h:196:36: error: 'EGLSetBlobFuncANDROID' has not been declared
EGLSetBlobFuncANDROID set,
^~~~~~~~~~~~~~~~~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_api_autogen_egl.h:197:36: error: 'EGLGetBlobFuncANDROID' has not been declared
EGLGetBlobFuncANDROID get) override;
^~~~~~~~~~~~~~~~~~~~~
In file included from ../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_egl_api_implementation.h:82:0,
from /src/qt5/qtwebengine/src/core/ozone/gl_surface_qt.cpp:71:
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_api_autogen_egl.h:164:33: error: 'EGLDeviceEXT' has not been declared
EGLDeviceEXT* devices,
^~~~~~~~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_api_autogen_egl.h:166:13: error: expected ';' at end of member declaration
const char* eglQueryDeviceStringEXTFn(EGLDeviceEXT device,
^~~~~~~~~~~~~~~~~~~~~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_api_autogen_egl.h:166:52: error: expected ')' before 'device'
const char* eglQueryDeviceStringEXTFn(EGLDeviceEXT device,
^~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_api_autogen_egl.h:196:36: error: 'EGLSetBlobFuncANDROID' has not been declared
EGLSetBlobFuncANDROID set,
^~~~~~~~~~~~~~~~~~~~~
../../../../../qt5/qtwebengine/src/3rdparty/chromium/ui/gl/gl_bindings_api_autogen_egl.h:197:36: error: 'EGLGetBlobFuncANDROID' has not been declared
EGLGetBlobFuncANDROID get) override;
^~~~~~~~~~~~~~~~~~~~~
cc1plus: warning: unrecognized command line option '-Wno-deprecated-copy'
cc1plus: warning: unrecognized command line option '-Wno-class-memaccess'
cc1plus: warning: unrecognized command line option '-Wno-class-memaccess'
cc1plus: warning: unrecognized command line option '-Wno-packed-not-aligned'
[...]
ninja: build stopped: subcommand failed.
make[4]: *** [Makefile.gn_run:763: run_ninja] Error 1
make[4]: Leaving directory '/src/pi3/qtwebengine/src/core'
make[3]: *** [Makefile:82: sub-gn_run-pro-make_first] Error 2
make[3]: Leaving directory '/src/pi3/qtwebengine/src/core'
make[2]: *** [Makefile:79: sub-core-make_first] Error 2
make[2]: Leaving directory '/src/pi3/qtwebengine/src'
make[1]: *** [Makefile:49: sub-src-make_first] Error 2
make[1]: Leaving directory '/src/pi3/qtwebengine'
make: *** [Makefile:370: module-qtwebengine-make_first] Error 2
I got the same errors and got it working by adding 3 symlinks:
in sysroot/opt/vc/include/EGL
mv egl.h egl.h-old
mv eglext.h eglext.h-old
mv eglplatform.h eglplatform.h-old
ln -s /<...>/qtwebengine/src/3rdparty/chromium/third_party/khronos/EGL/eglext.h eglext.h
ln -s /<...>/qtwebengine/src/3rdparty/chromium/third_party/khronos/EGL/egl.h egl.h
ln -s /<...>/qtwebengine/src/3rdparty/chromium/third_party/khronos/EGL/eglplatform.h eglplatform.h
where <...> is the path to the qt root directory.
There are many versions of egl.h/eglext.h/eglplatform.h to include and because of the include order the comiler fetches first the files in sysroot/opt/vc/include/EGL
Perhaps a better solution would be to reorder the "-I" flags for the compiler.
i did not
dpkg --purge libraspberrypi-dev

undefined symbol:_ZTVN10__cxxabiv121__vmi_class_type_infoE error

When I run python eval.py, it comes to the error::
ImportError: /home/aa/EAST/lanms/adaptor.so: undefined
symbol:_ZTVN10__cxxabiv121__vmi_class_type_infoE
I uses $make clean && make but it is still give me the same error and with some warring during execute the make
This is the makefile::
CXXFLAGS = -I include -std=c++11 -O3 $(shell python3-config --cflags)
LDFLAGS = $(shell python3-config --ldflags)
DEPS = lanms.h $(shell find include -xtype f)
CXX_SOURCES = adaptor.cpp include/clipper/clipper.cpp
LIB_SO = adaptor.so
$(LIB_SO): $(CXX_SOURCES) $(DEPS)
$(CXX) -o $# $(CXXFLAGS) $(LDFLAGS) $(CXX_SOURCES) --shared -fPIC
clean:
rm -rf $(LIB_SO)
when I use make command it show these warning::
/usr/bin/gcc-7 -o adaptor.so -I include -std=c++11 -O3 -I/home/ashwaq/anaconda3/include/python3.5m -I/home/aa/anaconda3/include/python3.5m -Wno-unused-result -Wsign-compare -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -pipe -flto -fuse-linker-plugin -ffat-lto-objects -DNDEBUG -fwrapv -O3 -Wall -Wstrict-prototypes -L/home/ashwaq/anaconda3/lib/python3.5/config-3.5m -L/home/ashwaq/anaconda3/lib -lpython3.5m -lpthread -ldl -lutil -lrt -lm -Xlinker -export-dynamic adaptor.cpp include/clipper/clipper.cpp --shared -fPIC
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from include/pybind11/pytypes.h:12:0,
from include/pybind11/cast.h:13,
from include/pybind11/attr.h:13,
from include/pybind11/pybind11.h:43,
from adaptor.cpp:1:
adaptor.cpp: In function ‘PyObject* PyInit_adaptor()’:
include/pybind11/common.h:232:34: warning: ‘PyObject* pybind11_init()’ is deprecated: PYBIND11_PLUGIN is deprecated, use PYBIND11_MODULE [-Wdeprecated-declarations]
return pybind11_init(); \
^
adaptor.cpp:53:1: note: in expansion of macro ‘PYBIND11_PLUGIN’
PYBIND11_PLUGIN(adaptor) {
^~~~~~~~~~~~~~~
include/pybind11/common.h:217:22: note: declared here
static PyObject *pybind11_init(); \
^
adaptor.cpp:53:1: note: in expansion of macro ‘PYBIND11_PLUGIN’
PYBIND11_PLUGIN(adaptor) {
^~~~~~~~~~~~~~~
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
include/clipper/clipper.cpp: In member function ‘void ClipperLib::Clipper::FixupFirstLefts3(ClipperLib::OutRec*, ClipperLib::OutRec*)’:
include/clipper/clipper.cpp:3665:13: warning: unused variable ‘firstLeft’ [-Wunused-variable]
OutRec* firstLeft = ParseFirstLeft(outRec->FirstLeft);
I use::
ubuntu-17.4
tensorflow-1.4.0
python-3.5
gcc-7.0.1
cuda-8.0

How to execute C++11 with makefile

I have a problem when I execute commmand "make" in terminal ubuntu.
My code of makefile is:
all: temp p1
%: %.cc g++ -lm -lcrypt -O2 -std=c++11 -pipe $< -o $#
Of course, my files are temp.cc and p1.cc, but my problem is in p1.cc, where the code is:
#include <bits/stdc++.h>
using namespace std;
int main(){
vector<int> vec = {4,6,8,9,8,7,1,3,4,5,0,1};
for(auto i : vec)
cout<<i<<" ";
cout<<endl;
return 0;}
My error using 'make' is:
eabg97#EABG:~/P$ make
g++ p1.cc -o p1
p1.cc: In function ‘int main()’:
p1.cc:7:44: error: in C++98 ‘vec’ must be initialized by constructor, not by ‘{...}’
vector<int> vec = {4,6,8,9,8,7,1,3,4,5,0,1};
^
p1.cc:7:44: error: could not convert ‘{4, 6, 8, 9, 8, 7, 1, 3, 4, 5, 0, 1}’ from ‘<brace-enclosed initializer list>’ to ‘std::vector<int>’
p1.cc:9:11: error: ‘i’ does not name a type
for(auto i : vec)
^
p1.cc:11:2: error: expected ‘;’ before ‘cout’
cout<<endl;
^
p1.cc:12:2: error: expected primary-expression before ‘return’
return 0;
^
p1.cc:12:2: error: expected ‘)’ before ‘return’
make: *** [p1] Error 1
Using the next command lines, compile:
g++ --std=c++11 p1.cc -o p1
and executing is okay:
eabg97#EABG:~/P$ ./p1
4 6 8 9 8 7 1 3 4 5 0 1
Please help me, I don't understand why there is a problem, thanks for your support :)
This is wrong:
all: temp p1
%: %.cc g++ -lm -lcrypt -O2 -std=c++11 -pipe $< -o $#
You should either add a newline and an initial TAB, like this:
all: temp p1
%: %.cc
g++ -lm -lcrypt -O2 -std=c++11 -pipe $< -o $#
(the first char on the third line must be a TAB character) or you need to insert a semicolon like this:
all: temp p1
%: %.cc ; g++ -lm -lcrypt -O2 -std=c++11 -pipe $< -o $#
What is your makefile doing? First, that statement all in one line without any newline/TAB or semicolon is considered by make to be a single pattern rule with a target % and prerequisites %.cc, g++, -lm, -lcrypt, etc. And, since there's no recipe, you're basically deleting that pattern rule (which doesn't exist anyway) since a pattern rule with no recipe deletes the pattern rule. So that line is essentially a no-op and does nothing.
So what happens? Make has a bunch of built-in rules that it uses to create things if you don't tell it how to do so, and there's a built-in rule that knows how to create a program from a .cc file, so make uses that. But of course, that built-in rule doesn't have any of your customizations.
It's simpler to use make's built-in rule and use the standard make variables to control it:
CXX := g++
CXXFLAGS := -std=c++11 -pipe
LDLIBS := -lm -lcrypt
all: temp p1
That's all you need, if you don't want to write your own rule.

dylib dynamic library calling a dylib : Undefined symbols for architecture i386

Under mac os x with g++ from gcc-5.2 I am trying to do the following : create a dylib exporting a class defined by header tmp8bis_dylib.h and source tmp8bis_dylib.cpp, and then create another dylib out of a source file tmp8bis.cpp using and linking to the previous dylib. Header and sources are in the same directory. I compile as follows :
g++-5.2.0 -m32 -Wall -g -c ./tmp8bis_dylib.cpp
g++-5.2.0 -m32 -dynamiclib ./tmp8bis_dylib.o -o ./tmp8bis_dylib.dylib
g++-5.2.0 -m32 -Wall -g -c ./tmp8bis.cpp
g++-5.2.0 -m32 -dynamiclib ./tmp8bis.o -o ./tmp8bis.dylib
and get this :
Undefined symbols for architecture i386:
"complex::cmodule(double, double)", referenced from:
_mymodule in tmp8bis.o
"complex::complex(double, double)", referenced from:
_mymodule in tmp8bis.o
"complex::~complex()", referenced from:
_mymodule in tmp8bis.o
ld: symbol(s) not found for architecture i386
collect2: error: ld returned 1 exit status
make: *** [all] Error 1
Obviously, I tried to pass various include and library paths with -I and -L flags respectively, with the very same result... Any idea ?
Files are below :
For tmp8bis_dylib.h :
#ifndef TMP_8_BIS_DYLIB_H
#define TMP_8_BIS_DYLIB_H
class complex
{
public:
double real;
double imag;
public:
complex();
complex(double x);
complex(double x,double y);
double cmodule(double x, double y);
~complex();
};
#endif
For tmp8bis_dylib.cpp :
#include "./tmp8bis_dylib.h"
#include <math.h>
extern "C"
{
complex::complex()
{
real = 0.0 ;
imag = 0.0 ;
}
complex::complex(double x)
{
real = x ;
imag = 0.0 ;
}
complex::complex(double x,double y)
{
real = x ;
imag = y ;
}
double complex::cmodule(double x, double y)
{
double res = sqrt(x*x+y*y);
return res ;
}
complex::~complex()
{
}
}
For tmp8bis.cpp :
#include <math.h>
#include "./tmp8bis_dylib.h"
extern "C"
{
double mymodule(double x, double y)
{
complex z(x,y);
double ret = z.cmodule(x,y);
return ret;
}
}
Precision. -m32 is because I need 32 bits dylib because the final dylib will be plugged into excel 2011's (for mac) VBA, which is 32 bits.
EDIT. Following Brett Hale's comment about Apple's advises about dylibs, I added
#define EXPORT __attribute__((visibility("default")))
after the #include's from tmp8bis.cpp, and EXPORT's for all its member functions, and compiled as follows :
g++-5.2.0 -m32 -Wall -g -c ./tmp8bis_dylib.cpp
g++-5.2.0 -m32 -dynamiclib ./tmp8bis_dylib.o -fvisibility=hidden -o ./tmp8bis_dylib.dylib
did a sudo cp ./tmp8bis_dylib.dylib /opt/lib/libtmp8bis_dylib.dylib and then compiled :
g++-5.2.0 -m32 -Wall -g -c ./tmp8bis.cpp
g++-5.2.0 -m32 -dynamiclib ./tmp8bis.o -o ./tmp8bis.dylib -L/opt/lib
and got the same result as before... Nor did
g++-5.2.0 -m32 -dynamiclib ./tmp8bis.o -o ./tmp8bis.dylib -ltmp8bis_dylib.dylib
make my day.
Without resorting to #define EXPORT __attribute__((visibility("default"))) or any -fvisibility=hidden
g++-5.2.0 -m32 -Wall -fpic -g -c ./tmp8bis_dylib.cpp
g++-5.2.0 -m32 -shared ./tmp8bis_dylib.o -o ./libtmp8bis_dylib.dylib
g++-5.2.0 -m32 -Wall -g -c ./tmp8bis.cpp
g++-5.2.0 -m32 -shared ./tmp8bis.o -o ./tmp8bis.dylib -L. -ltmp8bis_dylib
finally worked. I did not managed to succeed without -fpic, naming libtmp8bis_dylib.dylib and using -ltmp8bis_dylib.

Resources