Failure building protoc/zlib when using custom c++ toolchain - c++

My goal here is simple: I want a custom c++ toolchain where I can specify my own compilers and compiler options. I have boiled down my current issue into a contrived example repo here: http://github.com/btmcg/bazel_toolchain
I followed the tutorial described at https://docs.bazel.build/versions/main/tutorial/cc-toolchain-config.html to use my custom built version of gcc. This seems to work okay until I add a cc_proto_library. Bazel appears to use my custom toolchain to build protoc/zlib and errors out because of the warning flags I have in my custom toolchain. I was under the impression that --host_crosstool_top=#bazel_tools//tools/cpp:toolchain would tell Bazel to ignore my custom toolchain, however that doesn't seem to be the case. I would expect it to use /bin/gcc and not my custom gcc or warnings. Any help would be appreciated
Here is where the build currently fails:
$ bazel build --config=gcc_config //main:hello-world --verbose_failures
INFO: Analyzed target //main:hello-world (0 packages loaded, 0 targets configured).
INFO: Found 1 target... ERROR: /home/brian/.cache/bazel/_bazel_brian/2fc228b5a7b1bf0ef87f3ee9353aa72d/external/com_google_protobuf/BUILD:155:11: Compiling src/google/protobuf/extension_set.cc failed: (Exit 1): gcc failed: error executing command
(cd /home/brian/.cache/bazel/_bazel_brian/2fc228b5a7b1bf0ef87f3ee9353aa72d/sandbox/linux-sandbox/404/execroot/__main__ && \
exec env - \
LD_LIBRARY_PATH=/home/brian/.local/lib64:/home/brian/.local/lib \
PATH=/home/brian/.local/tools/bazel/4.2.2/bin:/home/brian/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl \
PWD=/proc/self/cwd \
/opt/custom/gcc/11.2.0/bin/gcc -MD -MF bazel-out/k8-fastbuild/bin/external/com_google_protobuf/_objs/protobuf_lite/extension_set.d '-frandom-seed=bazel-out/k8-fastbuild/bin/external/com_google_protobuf/_objs/protobuf_lite/extension_set.o' -iquote external/com_google_protobuf -iquote bazel-out/k8-fastbuild/bin/external/com_google_protobuf -isystem external/com_google_protobuf/src -isystem bazel-out/k8-fastbuild/bin/external/com_google_protobuf/src -xc++ -Werror -Wswitch-default -DHAVE_ZLIB -Wmissing-field-initializers -Woverloaded-virtual -Wno-sign-compare -c external/com_google_protobuf/src/google/protobuf/extension_set.cc -o bazel-out/k8-fastbuild/bin/external/com_google_protobuf/_objs/protobuf_lite/extension_set.o)
Execution platform: #local_config_platform//:host
Use --sandbox_debug to see verbose messages from the sandbox
external/com_google_protobuf/src/google/protobuf/extension_set.cc: In function 'bool google::protobuf::internal::{anonymous}::is_packable(google::protobuf::internal::WireFormatLite::WireType)':
external/com_google_protobuf/src/google/protobuf/extension_set.cc:72:10: error: switch missing default case [-Werror=switch-default]
72 | switch (type) {
| ^
external/com_google_protobuf/src/google/protobuf/extension_set.cc: In member function 'void* google::protobuf::internal::ExtensionSet::MutableRawRepeatedField(int, google::protobuf::internal::FieldType, bool, const google::protobuf::FieldDescriptor*)':
external/com_google_protobuf/src/google/protobuf/extension_set.cc:419:12: error: switch missing default case [-Werror=switch-default]
419 | switch (WireFormatLite::FieldTypeToCppType(
| ^
external/com_google_protobuf/src/google/protobuf/extension_set.cc: In member function 'void google::protobuf::internal::ExtensionSet::RemoveLast(int)':
external/com_google_protobuf/src/google/protobuf/extension_set.cc:855:10: error: switch missing default case [-Werror=switch-default]
855 | switch (cpp_type(extension->type)) {
| ^
external/com_google_protobuf/src/google/protobuf/extension_set.cc: In member function 'void google::protobuf::internal::ExtensionSet::SwapElements(int, int, int)':
external/com_google_protobuf/src/google/protobuf/extension_set.cc:910:10: error: switch missing default case [-Werror=switch-default]
910 | switch (cpp_type(extension->type)) {
| ^
external/com_google_protobuf/src/google/protobuf/extension_set.cc: In member function 'void google::protobuf::internal::ExtensionSet::InternalExtensionMergeFrom(const google::protobuf::MessageLite*, int, const google::protobuf::internal::ExtensionSet::Extension&, google::protobuf::Arena*)':
external/com_google_protobuf/src/google/protobuf/extension_set.cc:1008:12: error: switch missing default case [-Werror=switch-default]
1008 | switch (cpp_type(other_extension.type)) {
| ^
external/com_google_protobuf/src/google/protobuf/extension_set.cc:1055:14: error: switch missing default case [-Werror=switch-default]
1055 | switch (cpp_type(other_extension.type)) {
| ^
external/com_google_protobuf/src/google/protobuf/extension_set.cc: In member function 'bool google::protobuf::internal::ExtensionSet::ParseFieldWithExtensionInfo(int, bool, const google::protobuf::internal::ExtensionInfo&, google::protobuf::io::CodedInputStream*, google::protobuf::internal::FieldSkipper*)':
external/com_google_protobuf/src/google/protobuf/extension_set.cc:1322:12: error: switch missing default case [-Werror=switch-default]
1322 | switch (extension.type) {
| ^
external/com_google_protobuf/src/google/protobuf/extension_set.cc:1378:12: error: switch missing default case [-Werror=switch-default]
1378 | switch (extension.type) {
| ^
external/com_google_protobuf/src/google/protobuf/extension_set.cc: In member function 'void google::protobuf::internal::ExtensionSet::Extension::Clear()':
external/com_google_protobuf/src/google/protobuf/extension_set.cc:1612:12: error: switch missing default case [-Werror=switch-default]
1612 | switch (cpp_type(type)) {
| ^
external/com_google_protobuf/src/google/protobuf/extension_set.cc: In member function 'size_t google::protobuf::internal::ExtensionSet::Extension::ByteSize(int) const':
external/com_google_protobuf/src/google/protobuf/extension_set.cc:1660:14: error: switch missing default case [-Werror=switch-default]
1660 | switch (real_type(type)) {
| ^
external/com_google_protobuf/src/google/protobuf/extension_set.cc:1710:14: error: switch missing default case [-Werror=switch-default]
1710 | switch (real_type(type)) {
| ^
external/com_google_protobuf/src/google/protobuf/extension_set.cc:1751:12: error: switch missing default case [-Werror=switch-default]
1751 | switch (real_type(type)) {
| ^
external/com_google_protobuf/src/google/protobuf/extension_set.cc: In member function 'int google::protobuf::internal::ExtensionSet::Extension::GetSize() const':
external/com_google_protobuf/src/google/protobuf/extension_set.cc:1799:10: error: switch missing default case [-Werror=switch-default]
1799 | switch (cpp_type(type)) { | ^
external/com_google_protobuf/src/google/protobuf/extension_set.cc: In member function 'void google::protobuf::internal::ExtensionSet::Extension::Free()':
external/com_google_protobuf/src/google/protobuf/extension_set.cc:1825:12: error: switch missing default case [-Werror=switch-default]
1825 | switch (cpp_type(type)) {
| ^
external/com_google_protobuf/src/google/protobuf/extension_set.cc: In member function 'uint8_t* google::protobuf::internal::ExtensionSet::Extension::InternalSerializeFieldWithCachedSizesToArray(const google::protobuf::MessageLite*, const google::protobuf::internal::ExtensionSet*, int, uint8_t*, google::protobuf::io::EpsCopyOutputStream*) const':
external/com_google_protobuf/src/google/protobuf/extension_set.cc:2026:14: error: switch missing default case [-Werror=switch-default]
2026 | switch (real_type(type)) {
| ^
external/com_google_protobuf/src/google/protobuf/extension_set.cc:2060:14: error: switch missing default case [-Werror=switch-default]
2060 | switch (real_type(type)) {
| ^
external/com_google_protobuf/src/google/protobuf/extension_set.cc:2111:12: error: switch missing default case [-Werror=switch-default]
2111 | switch (real_type(type)) {
| ^
cc1plus: all warnings being treated as errors
Target //main:hello-world failed to build
INFO: Elapsed time: 3.122s, Critical Path: 3.00s
INFO: 18 processes: 9 internal, 9 linux-sandbox.
FAILED: Build did NOT complete successfully

Bazel is going to build parts of protobuf twice, once for the host and once for the target. extension_set.cc is one of those. --host_crosstool_top will be used when compiling for the host to build protoc to be run later in the build. Your custom toolchain will be used when building those same files for the target as part of the final binary.
Your build failure is when building for the target with your custom toolchain. You'll need to make that work somehow. I often end up modifying BUILD files to add -Wno-* copts so they work with my toolchains. --per_file_copt could be used instead.
If you want to just build the host version while setting things up, write a simple genrule like this:
genrule(
name = "abc",
tools = [ "#com_google_protobuf//:protoc" ],
outs = [ "dummy" ],
cmd = "touch $#",
)
If you bazel build abc, then bazel will build protoc for the host, even though it's not actually used by the cmd.

Related

Expo fastlane build fails due to issue with logging in EXUpdates / expo-updates

I get this error message when building an IOS app on an expo managed worfklow for SDK 46. The error appears at the end of the log, at line 716: 'Logger' initializer is inaccessible due to 'internal' protection level. The expo-updates package is installed with the latest version (0.15.6).
The expo doctor command shows nothing wrong with the project.
Compiling expo-eas-client Pods/EASClient » EASClient-dummy.m
› Packaging expo-eas-client Pods/EASClient » libEASClient.a
› Executing expo-eas-client Pods/EASClient » Copy generated compatibility header
› Executing expo-updates Pods/EXUpdates » [CP-User] Generate app.manifest for expo-updates
❌ (node_modules/expo-updates/ios/EXUpdates/Logging/UpdatesLogger.swift:15:24)
13 | public static let EXPO_UPDATES_LOG_CATEGORY = "expo-updates"
14 |
> 15 | private let logger = Logger(category: UpdatesLogger.EXPO_UPDATES_LOG_CATEGORY, options: [.logToOS, .logToFile])
| ^ 'Logger' initializer is inaccessible due to 'internal' protection level
16 |
17 | // MARK: - Public logging functions
18 |
❌ (node_modules/expo-updates/ios/EXUpdates/Logging/UpdatesLogger.swift:15:91)
13 | public static let EXPO_UPDATES_LOG_CATEGORY = "expo-updates"
14 |
> 15 | private let logger = Logger(category: UpdatesLogger.EXPO_UPDATES_LOG_CATEGORY, options: [.logToOS, .logToFile])
| ^ extra argument 'options' in call
16 |
17 | // MARK: - Public logging functions
18 |
❌ (node_modules/expo-updates/ios/EXUpdates/Logging/UpdatesLogger.swift:15:93)
13 | public static let EXPO_UPDATES_LOG_CATEGORY = "expo-updates"
14 |
> 15 | private let logger = Logger(category: UpdatesLogger.EXPO_UPDATES_LOG_CATEGORY, options: [.logToOS, .logToFile])
| ^ reference to member 'logToOS' cannot be resolved without a contextual type
16 |
17 | // MARK: - Public logging functions
18 |
❌ (node_modules/expo-updates/ios/EXUpdates/Logging/UpdatesLogger.swift:15:103)
13 | public static let EXPO_UPDATES_LOG_CATEGORY = "expo-updates"
14 |
> 15 | private let logger = Logger(category: UpdatesLogger.EXPO_UPDATES_LOG_CATEGORY, options: [.logToOS, .logToFile])
| ^ reference to member 'logToFile' cannot be resolved without a contextual type
16 |
17 | // MARK: - Public logging functions
18 |
❌ (node_modules/expo-updates/ios/EXUpdates/Logging/UpdatesLogReader.swift:15:32)
13 | public class UpdatesLogReader: NSObject {
14 | private let serialQueue = DispatchQueue(label: "dev.expo.updates.logging.reader")
> 15 | private let logPersistence = PersistentFileLog(category: UpdatesLogger.EXPO_UPDATES_LOG_CATEGORY)
| ^ cannot find 'PersistentFileLog' in scope
16 |
17 | /**
18 | Get expo-updates logs newer than the given date
▸ ** ARCHIVE FAILED **
▸ The following build commands failed:
▸ CompileSwift normal arm64 (in target 'EXUpdates' from project 'Pods')
▸ CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'EXUpdates' from project 'Pods')
▸ (2 failures)
2023-01-06 08:55:22.238 xcodebuild[4410:14072] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2023-01-06 08:55:22.238 xcodebuild[4410:14072] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2023-01-06 08:55:22.327 xcodebuild[4410:14072] XType: failed to connect - Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.fonts was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.fonts was invalidated: failed at lookup with error 3 - No such process.}
2023-01-06 08:55:22.328 xcodebuild[4410:14072] Font server protocol version mismatch (expected:5 got:0), falling back to local fonts
2023-01-06 08:55:22.328 xcodebuild[4410:14072] XType: unable to make a connection to the font daemon!
2023-01-06 08:55:22.328 xcodebuild[4410:14072] XType: XTFontStaticRegistry is enabled as fontd is not available.
** ARCHIVE FAILED **
The following build commands failed:
CompileSwift normal arm64 (in target 'EXUpdates' from project 'Pods')
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'EXUpdates' from project 'Pods')
(2 failures)
Exit status: 65
+-------------+-------------------------+
| Build environment |
+-------------+-------------------------+
| xcode_path | /Applications/Xcode.app |
| gym_version | 2.206.1 |
| sdk | iPhoneOS15.5.sdk |
+-------------+-------------------------+
The issue was solved by upgrading to Expo SDK 47.

QGroundControl build error: expected type-specifier before ‘QTcpSocket’

OS: Ubuntu 18.04
Qt: 5.15.2 (minimal built from source)
QGroundControl: 4.2
I am building QGroundControl from source. I have also built qgc required qt5.15.2.
Inside qgroundcontrol/build:
$> qmake ..
Project MESSAGE: Qt version 5.15.2
Project MESSAGE: Linux build
Project MESSAGE: Daily Build
Project MESSAGE: GIT_DESCRIBE v4.2.3
Project MESSAGE: QGroundControl APP_VERSION_STR VERSION v4.2.3 4.2.3
Project MESSAGE: Release flavor
Project MESSAGE: Skipping support for Pairing
Project MESSAGE: Using MAVLink dialect 'ardupilotmega'.
Project MESSAGE: Skipping support for Zeroconf (unsupported platform)
Project MESSAGE: Including support for AirMap
Project MESSAGE: Taisync disabled
Project MESSAGE: Microhard disabled
Project MESSAGE: Including support for video streaming
Project MESSAGE: This project is using private headers and will therefore be tied to this specific Qt module build version.
Project MESSAGE: Running this project against other versions of the Qt modules may crash at any arbitrary point.
Project MESSAGE: This is not a bug, but a result of using Qt internals. You have been warned!
$> make
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp:1188:27: error: expected type-specifier before ‘QTcpSocket’
1188 | auto socket = new QTcpSocket();
| ^~~~~~~~~~
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp:1193:26: error: ‘QTcpSocket’ has not been declared
1193 | connect(socket, &QTcpSocket::connected, this, [this, socket] {
| ^~~~~~~~~~
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp: In lambda function:
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp:1196:13: error: ‘socket’ is not captured
1196 | socket->deleteLater();
| ^~~~~~
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp:1193:68: note: the lambda has no capture-default
1193 | connect(socket, &QTcpSocket::connected, this, [this, socket] {
| ^
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp:1188:14: note: ‘<typeprefixerror>socket’ declared here
1188 | auto socket = new QTcpSocket();
| ^~~~~~
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp: In lambda function:
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp:1201:13: error: ‘socket’ is not captured
1201 | socket->deleteLater();
| ^~~~~~
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp:1198:77: note: the lambda has no capture-default
1198 | connect(socket, &QAbstractSocket::errorOccurred, this, [this, socket](QAbstractSocket::SocketError error) {
| ^
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/QGCTileCacheWorker.cpp:1188:14: note: ‘<typeprefixerror>socket’ declared here
1188 | auto socket = new QTcpSocket();
| ^~~~~~
Makefile:135853: recipe for target 'QGCTileCacheWorker.o' failed
make: *** [QGCTileCacheWorker.o] Error 1
Is there anything I might be missing?
As #G.M. pointed the QGCTileCacheWorker.cpp was missing required header. I wonder why it was not originally added as I am using exact version of Qt which QGroundControl has specified.
Now another error pops up :
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/MapProvider.cpp:23:40: error: incomplete type ‘QLocale’ used in nested name specifier
23 | const QStringList langs = QLocale::system().uiLanguages();
| ^~~~~~
compiling /media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/EsriMapProvider.cpp
Makefile:137039: recipe for target 'MapProvider.o' failed
make: *** [MapProvider.o] Error 1
make: *** Waiting for unfinished jobs....
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/GoogleMapProvider.cpp: In member function ‘void GoogleMapProvider::_tryCorrectGoogleVersions(QNetworkAccessManager*)’:
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/GoogleMapProvider.cpp:108:27: error: variable ‘QSslConfiguration conf’ has initializer but incomplete type
108 | QSslConfiguration conf = qheader.sslConfiguration();
| ^~~~
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/GoogleMapProvider.cpp:108:42: error: ‘class QNetworkRequest’ has no member named ‘sslConfiguration’; did you mean ‘http2Configuration’?
108 | QSslConfiguration conf = qheader.sslConfiguration();
| ^~~~~~~~~~~~~~~~
| http2Configuration
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/GoogleMapProvider.cpp:109:32: error: ‘QSslSocket’ has not been declared
109 | conf.setPeerVerifyMode(QSslSocket::VerifyNone);
| ^~~~~~~~~~
/media/ashish/Data1/_ASHISH/15_QGroundControl/qgroundcontrol_source_build/qgroundcontrol_stable4p2/qgroundcontrol/src/QtLocationPlugin/GoogleMapProvider.cpp:110:17: error: ‘class QNetworkRequest’ has no member named ‘setSslConfiguration’; did you mean ‘http2Configuration’?
110 | qheader.setSslConfiguration(conf);
| ^~~~~~~~~~~~~~~~~~~
| http2Configuration
Makefile:137340: recipe for target 'GoogleMapProvider.o' failed
make: *** [GoogleMapProvider.o] Error 1

'is_trivial_v' is not a member of 'std' while build C++ project with conan

I'm trying to write C++ project with conan. I need to use qt/6.2.2 as dependency.
After I run
conan create . user/test
It comes out a long error message. The last few lines are:
/home/run/.conan/data/qt/6.2.2/_/_/package/e1b261f6f4c131503719b972012039d1853778f9/include/QtCore/qarraydatapointer.h:374:27: note: deduced conflicting types for parameter ‘const T’ (‘int’ and ‘qsizetype’ {aka ‘long long int’})
374 | ? n + qMax(0, (header->alloc - from.size - n) / 2)
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/Wuziqi.dir/build.make:63: CMakeFiles/Wuziqi.dir/Wuziqi.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/Wuziqi.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
Wuziqi/1.0.0#user/test:
Wuziqi/1.0.0#user/test: ERROR: Package '702f20c11c28f19fd5e1d929272b0f47e81fec21' build failed
Wuziqi/1.0.0#user/test: WARN: Build folder /home/run/.conan/data/Wuziqi/1.0.0/user/test/build/702f20c11c28f19fd5e1d929272b0f47e81fec21
ERROR: Wuziqi/1.0.0#user/test: Error in build() method, line 26
cmake.build()
ConanException: Error 2 while executing cmake --build '/home/run/.conan/data/Wuziqi/1.0.0/user/test/build/702f20c11c28f19fd5e1d929272b0f47e81fec21' '--' '-j12'
There are multiple errors in the middle, like:
error: ‘is_integral_v’ is not a member of ‘std’; did you mean ‘is_integral’?
170 | template <typename Int> std::enable_if_t<std::is_integral_v<Int>, iterator>
error: ‘compare_eq_result_container’ in namespace ‘QTypeTraits’ does not name a template type
306 | QTypeTraits::compare_eq_result_container<QList, U> operator==(const QList &other) const
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
error: ‘is_same_v’ is not a member of ‘std’; did you mean ‘is_same’?
285 | if constexpr (std::is_same_v<std::decay_t<InputIterator>, iterator> ||
| ^~~~~~~~~
| is_same
Does it seem that there is no xxx_v in std?
How could I fix it?
Thanks, guys, I solved this problem.
It is because of the version of dependencies, just like #康桓瑋 said, I need to use C++17.
However, C++17 will lead to other conflicts. So I set
requires = "qt/5.15.2"
in conanfile.py instead of the latest version.

Trouble with creating first Substrate chain

When I try to compile the Node Template I get a series of errors.
error: failed to run custom build command for node-template-runtime v2.0.0 (/Users/Modulus3D/VSCode Projects/substrate-node-template/runtime)
Caused by:
process didn't exit successfully: /Users/Modulus3D/VSCode Projects/substrate-node-template/target/release/build/node-template-runtime-cae9ad6029c9f681/build-script-build (exit code: 1)
--- stdout
Executing build command: "rustup" "run" "nightly" "cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/Users/Modulus3D/VSCode Projects/substrate-node-template/target/release/wbuild/node-template-runtime/Cargo.toml" "--color=always" "--release"
and also:
error[E0282]: type annotations needed
--> /Users/Modulus3D/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
|
541 | let accuracy = P::ACCURACY.saturated_into();
| ^^^^^^^^ consider giving accuracy a type
...
1595 | / implement_fixed!(
1596 | | FixedI64,
1597 | | test_fixed_i64,
1598 | | i64,
... |
1601 | | "Fixed Point 64 bits signed, range = [-9223372036.854775808, 9223372036.854775807]",
1602 | | );
| |__- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0282]: type annotations needed
--> /Users/Modulus3D/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
|
541 | let accuracy = P::ACCURACY.saturated_into();
| ^^^^^^^^ consider giving accuracy a type
...
1604 | / implement_fixed!(
1605 | | FixedI128,
1606 | | test_fixed_i128,
1607 | | i128,
... |
1611 | | [-170141183460469231731.687303715884105728, 170141183460469231731.687303715884105727]_",
1612 | | );
| |__- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0282]: type annotations needed
--> /Users/Modulus3D/.cargo/registry/src/github.com-1ecc6299db9ec823/sp-arithmetic-2.0.0/src/fixed_point.rs:541:9
|
541 | let accuracy = P::ACCURACY.saturated_into();
| ^^^^^^^^ consider giving accuracy a type
...
1614 | / implement_fixed!(
1615 | | FixedU128,
1616 | | test_fixed_u128,
1617 | | u128,
... |
1621 | | [0.000000000000000000, 340282366920938463463.374607431768211455]_",
1622 | | );
| |__- in this macro invocation
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
For more information about this error, try rustc --explain E0282.
error: could not compile sp-arithmetic
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
warning: build failed, waiting for other jobs to finish...
error: build failed
Any suggestions on how to resolve these errors??
Look like you need to downgrade you nightly version.
You can do so by running the following sequence of commands:
rustup install nightly-2020-10-06
rustup target add wasm32-unknown-unknown --toolchain nightly-2020-10-06
export WASM_BUILD_TOOLCHAIN=nightly-2020-10-06
You can learn more about how nightly is used with substrate here: https://substrate.dev/docs/en/knowledgebase/getting-started/#rust-nightly-toolchain
Fresh project always facing the efferent nightly versions issue.
If you running the substrate version 2.0.0 you can solve it with bellow command:
rustup install nightly-2020-07-02
rustup override set nightly-2020-07-02
rustup target add wasm32-unknown-unknown --toolchain nightly-2020-07-02
then try to re build again!

src/caffe/parallel.cpp:70:1: error: ‘Params’ does not name a type

This is not the first time I compiled caffe, but I still have problems that I can't solve. The caffe version I used is https://github.com/chuanqi305/ssd, the compiled version is GPU, I successfully compiled and run on my computer ( Ubuntu 16.04 GTX1080TI*1 cuda9.0) , but in the school server (Ubuntu 14.04 Tesla k80*2+Tesla k40*2 cuda8.0), the same code, the same configuration, but the compilation failed。The error occurred in the code compilation phase rather than the link phase, but the code itself is definitely no problem, because it has been compiled successfully on another computer, I don't know if it is because of my gcc/g++ version.
I tried to compile the parallel.cpp file myself using the g++ command. When I don't specify the header file path, the same error will occur, but in the Makefile, the location of the header file has been added.
The error message is below:
SGM#user-SMBIOS-implementations-newer-thandmidecode-Super-Server:~/ssd-ssd$ sudo make all
PROTOC src/caffe/proto/caffe.proto
CXX .build_release/src/caffe/proto/caffe.pb.cc
CXX src/caffe/parallel.cpp
src/caffe/parallel.cpp:70:1: error: ‘Params’ does not name a type
Params<Dtype>::Params(shared_ptr<Solver<Dtype> > root_solver)
^
src/caffe/parallel.cpp:77:1: error: ‘GPUParams’ does not name a type
GPUParams<Dtype>::GPUParams(shared_ptr<Solver<Dtype> > root_solver, int device)
^
src/caffe/parallel.cpp:102:1: error: ‘GPUParams’ does not name a type
GPUParams<Dtype>::~GPUParams() {
^
src/caffe/parallel.cpp:110:15: error: expected initializer before ‘<’ token
void GPUParams<Dtype>::configure(Solver<Dtype>* solver) const {
^
src/caffe/parallel.cpp:117:6: error: ‘DevicePair’ has not been declared
void DevicePair::compute(const vector<int> devices, vector<DevicePair>* pairs) {
^
src/caffe/parallel.cpp:117:60: error: ‘DevicePair’ was not declared in this scope
void DevicePair::compute(const vector<int> devices, vector<DevicePair>* pairs) {
^
src/caffe/parallel.cpp:117:70: error: template argument 1 is invalid
void DevicePair::compute(const vector<int> devices, vector<DevicePair>* pairs) {
^
src/caffe/parallel.cpp:117:70: error: template argument 2 is invalid
src/caffe/parallel.cpp: In function ‘void caffe::compute(std::vector<int>, int*)’:
src/caffe/parallel.cpp:133:20: error: request for member ‘push_back’ in ‘* pairs’, which is of non-class type ‘int’
pairs->push_back(DevicePair(remaining[i], remaining[j]));
^
src/caffe/parallel.cpp:133:67: error: ‘DevicePair’ was not declared in this scope
pairs->push_back(DevicePair(remaining[i], remaining[j]));
^
src/caffe/parallel.cpp:157:18: error: request for member ‘push_back’ in ‘* pairs’, which is of non-class type ‘int’
pairs->push_back(DevicePair(remaining[i], remaining[j]));
^
src/caffe/parallel.cpp:157:65: error: ‘DevicePair’ was not declared in this scope
pairs->push_back(DevicePair(remaining[i], remaining[j]));
^
src/caffe/parallel.cpp:175:14: error: request for member ‘push_back’ in ‘* pairs’, which is of non-class type ‘int’
pairs->push_back(DevicePair(remaining[i], remaining[i + 1]));
^
src/caffe/parallel.cpp:175:65: error: ‘DevicePair’ was not declared in this scope
pairs->push_back(DevicePair(remaining[i], remaining[i + 1]));
^
src/caffe/parallel.cpp:185:10: error: request for member ‘insert’ in ‘* pairs’, which is of non-class type ‘int’
pairs->insert(pairs->begin(), DevicePair(-1, remaining[0]));
^
src/caffe/parallel.cpp:185:24: error: request for member ‘begin’ in ‘* pairs’, which is of non-class type ‘int’
pairs->insert(pairs->begin(), DevicePair(-1, remaining[0]));
^
src/caffe/parallel.cpp:185:60: error: ‘DevicePair’ was not declared in this scope
pairs->insert(pairs->begin(), DevicePair(-1, remaining[0]));
^
In file included from src/caffe/parallel.cpp:4:0:
src/caffe/parallel.cpp:187:16: error: request for member ‘size’ in ‘* pairs’, which is of non-class type ‘int’
CHECK(pairs->size() == devices.size());
^
src/caffe/parallel.cpp:188:30: error: request for member ‘size’ in ‘* pairs’, which is of non-class type ‘int’
for (int i = 0; i < pairs->size(); ++i) {
^
In file included from src/caffe/parallel.cpp:4:0:
src/caffe/parallel.cpp:189:21: error: invalid types ‘int[int]’ for array subscript
CHECK((*pairs)[i].parent() != (*pairs)[i].device());
^
src/caffe/parallel.cpp:189:45: error: invalid types ‘int[int]’ for array subscript
CHECK((*pairs)[i].parent() != (*pairs)[i].device());
^
src/caffe/parallel.cpp:190:36: error: request for member ‘size’ in ‘* pairs’, which is of non-class type ‘int’
for (int j = i + 1; j < pairs->size(); ++j) {
^
In file included from src/caffe/parallel.cpp:4:0:
src/caffe/parallel.cpp:191:23: error: invalid types ‘int[int]’ for array subscript
CHECK((*pairs)[i].device() != (*pairs)[j].device());
^
src/caffe/parallel.cpp:191:47: error: invalid types ‘int[int]’ for array subscript
CHECK((*pairs)[i].device() != (*pairs)[j].device());
^
src/caffe/parallel.cpp: At global scope:
src/caffe/parallel.cpp:202:1: error: ‘P2PSync’ does not name a type
P2PSync<Dtype>::P2PSync(shared_ptr<Solver<Dtype> > root_solver,
^
src/caffe/parallel.cpp:249:1: error: ‘P2PSync’ does not name a type
P2PSync<Dtype>::~P2PSync() {
^
src/caffe/parallel.cpp:271:13: error: expected initializer before ‘<’ token
void P2PSync<Dtype>::InternalThreadEntry() {
^
src/caffe/parallel.cpp:287:13: error: expected initializer before ‘<’ token
void P2PSync<Dtype>::on_start() {
^
src/caffe/parallel.cpp:325:13: error: expected initializer before ‘<’ token
void P2PSync<Dtype>::on_gradients_ready() {
^
src/caffe/parallel.cpp:383:13: error: expected initializer before ‘<’ token
void P2PSync<Dtype>::Prepare(const vector<int>& gpus,
^
src/caffe/parallel.cpp:421:13: error: expected initializer before ‘<’ token
void P2PSync<Dtype>::Run(const vector<int>& gpus) {
^
In file included from /usr/local/include/caffe/blob.hpp:8:0,
from /usr/local/include/caffe/caffe.hpp:7,
from src/caffe/parallel.cpp:12:
src/caffe/parallel.cpp:439:19: error: ‘Params’ is not a class template
INSTANTIATE_CLASS(Params);
^
src/caffe/parallel.cpp:439:19: error: explicit instantiation of non-template type ‘caffe::Params’
src/caffe/parallel.cpp:439:19: error: ‘Params’ is not a class template
INSTANTIATE_CLASS(Params);
^
src/caffe/parallel.cpp:439:19: error: explicit instantiation of non-template type ‘caffe::Params’
src/caffe/parallel.cpp:440:19: error: ‘GPUParams’ is not a class template
INSTANTIATE_CLASS(GPUParams);
^
src/caffe/parallel.cpp:440:19: error: explicit instantiation of non-template type ‘caffe::GPUParams’
src/caffe/parallel.cpp:440:19: error: ‘GPUParams’ is not a class template
INSTANTIATE_CLASS(GPUParams);
^
src/caffe/parallel.cpp:440:19: error: explicit instantiation of non-template type ‘caffe::GPUParams’
src/caffe/parallel.cpp:441:19: error: ‘P2PSync’ is not a class template
INSTANTIATE_CLASS(P2PSync);
^
src/caffe/parallel.cpp:441:19: error: explicit instantiation of non-template type ‘caffe::P2PSync’
src/caffe/parallel.cpp:441:19: error: ‘P2PSync’ is not a class template
INSTANTIATE_CLASS(P2PSync);
^
src/caffe/parallel.cpp:441:19: error: explicit instantiation of non-template type ‘caffe::P2PSync’
make: *** [.build_release/src/caffe/parallel.o] Error 1
Makefile.config
## Refer to http://caffe.berkeleyvision.org/installation.html
# Contributions simplifying and improving our build system are welcome!
# cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1
# CPU-only switch (uncomment to build without GPU support).
# CPU_ONLY := 1
# uncomment to disable IO dependencies and corresponding data layers
# USE_OPENCV := 0
# USE_LEVELDB := 0
# USE_LMDB := 0
# uncomment to allow MDB_NOLOCK when reading LMDB files (only if necessary)
# You should not set this flag if you will be reading LMDBs with any
# possibility of simultaneous read and write
# ALLOW_LMDB_NOLOCK := 1
# Uncomment if you're using OpenCV 3
OPENCV_VERSION := 3
# To customize your choice of compiler, uncomment and set the following.
# N.B. the default for Linux is g++ and the default for OSX is clang++
# CUSTOM_CXX := g++
# CUDA directory contains bin/ and lib/ directories that we need.
CUDA_DIR := /usr/local/cuda
# On Ubuntu 14.04, if cuda tools are installed via
# "sudo apt-get install nvidia-cuda-toolkit" then use this instead:
# CUDA_DIR := /usr
# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the lines after *_35 for compatibility.
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
-gencode arch=compute_20,code=sm_21 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
-gencode arch=compute_52,code=sm_52 \
-gencode arch=compute_60,code=sm_60 \
-gencode arch=compute_61,code=sm_61 \
-gencode arch=compute_61,code=compute_61
# BLAS choice:
# atlas for ATLAS (default)
# mkl for MKL
# open for OpenBlas
# BLAS := atlas
BLAS := open
# Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
# BLAS_INCLUDE := /path/to/your/blas
# BLAS_LIB := /path/to/your/blas
# Homebrew puts openblas in a directory that is not on the standard search path
# BLAS_INCLUDE := $(shell brew --prefix openblas)/include
# BLAS_LIB := $(shell brew --prefix openblas)/lib
# This is required only if you will compile the matlab interface.
# MATLAB directory should contain the mex binary in /bin.
# MATLAB_DIR := /usr/local
# MATLAB_DIR := /Applications/MATLAB_R2012b.app
# NOTE: this is required only if you will compile the python interface.
# We need to be able to find Python.h and numpy/arrayobject.h.
#PYTHON_INCLUDE := /usr/include/python2.7 \
# /usr/lib/python2.7/dist-packages/numpy/core/include
# Anaconda Python distribution is quite popular. Include path:
# Verify anaconda location, sometimes it's in root.
ANACONDA_HOME := /home/SGM/anaconda3
PYTHON_INCLUDE := /home/SGM/anaconda3/include \
/home/SGM/anaconda3/include/python3.6m \
/home/SGM/anaconda3/lib/python3.6/site-packages/numpy/core/include
# Uncomment to use Python 3 (default is Python 2)
PYTHON_LIBRARIES := boost_python3 python3.6m
PYTHON_INCLUDE := /home/SGM/anaconda3/include/python3.6m \
/home/SGM/anaconda3/lib/python3.6/site-packages/numpy/core/include
# We need to be able to find libpythonX.X.so or .dylib.
PYTHON_LIB := /usr/lib
# PYTHON_LIB := $(ANACONDA_HOME)/lib
# Homebrew installs numpy in a non standard path (keg only)
# PYTHON_INCLUDE += $(dir $(shell python -c 'import numpy.core; print(numpy.core.__file__)'))/include
# PYTHON_LIB += $(shell brew --prefix numpy)/lib
# Uncomment to support layers written in Python (will link against Python libs)
WITH_PYTHON_LAYER := 1
# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/local/hdf5/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/local/hdf5/lib /home/SGM/anaconda3/lib/
# If Homebrew is installed at a non standard location (for example your home directory) and you use it for general dependencies
# INCLUDE_DIRS += $(shell brew --prefix)/include
# LIBRARY_DIRS += $(shell brew --prefix)/lib
# Uncomment to use `pkg-config` to specify OpenCV library paths.
# (Usually not necessary -- OpenCV libraries are normally installed in one of the above $LIBRARY_DIRS.)
# USE_PKG_CONFIG := 1
# N.B. both build and distribute dirs are cleared on `make clean`
BUILD_DIR := build
DISTRIBUTE_DIR := distribute
# Uncomment for debugging. Does not work on OSX due to https://github.com/BVLC/caffe/issues/171
# DEBUG := 1
# The ID of the GPU that 'make runtest' will use to run unit tests.
TEST_GPUID := 0
# enable pretty build (comment to see full commands)
Q ?= #
When you change the environment,have you edit the path in Makefile.config?
Please make the python path correct and make sure cudnn is installed,if you want to compile with cuDNN.
Not very clear with your issue, try comment USE_CUDNN := 1