[Sony Xperia XZ Premium ROMs, Kernels, Recoveries, ] LSS4181:
Help needed on building... (both cr-6.1 and cr-7.0)

At first I attempted to build cr-7.0 (Pie), but I got the following errors.

In file included from device/sony/yoshino-common/init/init_yoshino.cpp:39:
In file included from system/core/init/util.h:31:
system/core/init/result.h:150:12: error: call to deleted constructor of 'android::init::Error'
return Error(errno);
^~~~~~~~~~~~
system/core/init/result.h:139:5: note: 'Error' has been explicitly marked deleted here
Error(Error&&) = delete;
^
system/core/init/result.h:159:50: error: no template named 'is_same_v' in namespace 'std'; did you mean 'is_same'?
typename = std::enable_if_t<!(std::is_same_v<std::decay_t<U>, Result<T>> &&
~~~~~^~~~~~~~~
is_same
external/libcxx/include/type_traits:856:61: note: 'is_same' declared here
template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_same : public false_type {};
^
In file included from device/sony/yoshino-common/init/init_yoshino.cpp:39:
In file included from system/core/init/util.h:31:
system/core/init/result.h:160:45: error: expected ')'
sizeof...(V) == 0)>>
^
system/core/init/result.h:159:44: note: to match this '('
typename = std::enable_if_t<!(std::is_same_v<std::decay_t<U>, Result<T>> &&
^
system/core/init/result.h:160:63: error: expected expression
sizeof...(V) == 0)>>
^
system/core/init/result.h:203:34: error: expected ',' or '>' in template-parameter-list
std::variant<T, ResultError> contents_;
^
system/core/init/result.h:203:43: warning: declaration does not declare anything [-Wmissing-declarations]
std::variant<T, ResultError> contents_;
^
system/core/init/result.h:206:22: error: no type named 'monostate' in namespace 'std'
using Success = std::monostate;
~~~~~^
In file included from device/sony/yoshino-common/init/init_yoshino.cpp:39:
system/core/init/util.h:45:8: error: use of undeclared identifier 'Success'; did you mean 'access'?
Result<Success> WriteFile(const std::string& path, const std::string& content);
^~~~~~~
access
bionic/libc/include/unistd.h:127:5: note: 'access' declared here
int access(const char* __path, int __mode);
^
In file included from device/sony/yoshino-common/init/init_yoshino.cpp:39:
system/core/init/util.h:45:8: error: template argument for template type parameter must be a type
Result<Success> WriteFile(const std::string& path, const std::string& content);
^~~~~~~
system/core/init/result.h:153:20: note: template parameter is declared here
template <typename T>
^
device/sony/yoshino-common/init/init_yoshino.cpp:102:10: error: no matching function for call to 'ReadFile'
if (!ReadFile(filename, &data, &err)) {
^~~~~~~~
system/core/init/util.h:44:21: note: candidate function not viable: requires single argument 'path', but 3 arguments were provided
Result<std::string> ReadFile(const std::string& path);
^
1 warning and 9 errors generated.

It was still at the early stage of compilation so I don't know if there would be any more errors on cr-7.0.

And with cr-6.1 (Oreo) things were a bit better. At first I encountered errors regarding JACK server (error 58), after disabling it as someone mentioned (ANDROID_COMPILE_WITH_JACK := false), the build was able to proceed, but near the end of the build process I'm seeing some errors about missing classes and they appear to be related to proguard...

out/target/common/obj/APPS/MusicFX_intermediates/classes-proguard.jar

Warning: android.support.design.internal.TextScale: can't find superclass or interface android.support.transition.Transition
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.AutoTransition
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.AutoTransition
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.TransitionSet
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.TransitionSet
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.TransitionSet
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.TransitionSet
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.TransitionSet
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.TransitionManager
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.TransitionManager
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.TransitionSet
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.Transition
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.Transition
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: there were 26 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Error: Please correct the above warnings first.

out/target/common/obj/APPS/Quarks_intermediates/classes-proguard.jar

Warning: android.support.design.internal.TextScale: can't find superclass or interface android.support.transition.Transition
Warning: library class android.net.Network$1 extends or implements program class com.android.okhttp.Dns
Warning: library class android.net.http.HttpResponseCache extends or implements program class com.android.okhttp.OkCacheContainer
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.AutoTransition
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.AutoTransition
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.TransitionSet
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.TransitionSet
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.TransitionSet
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.TransitionSet
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.TransitionSet
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.TransitionManager
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.TransitionManager
Warning: android.support.design.internal.BottomNavigationMenuView: can't find referenced class android.support.transition.TransitionSet
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.Transition
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.Transition
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: android.support.design.internal.TextScale: can't find referenced class android.support.transition.TransitionValues
Warning: library class android.net.http.HttpResponseCache depends on program class com.android.okhttp.Cache
Warning: there were 26 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: there were 3 instances of library classes depending on program classes.
You must avoid such dependencies, since the program classes will
be processed, while the library classes will remain unchanged.
(http://proguard.sourceforge.net/manual/troubleshooting.html#dependency)
Error: Please correct the above warnings first.

What else do I need to get CarbonROM built? I'm using the following trees (with respective branches) configured in a custom manifest.

I also tried building AOSP Pie according to official Sony instructions. Although it was eventually built, it was full of issues (bluetooth and such kept stopping) and eventually powered off itself, appearing as if it was still far from being ready to be run on real devices.

https://github.com/CarbonROM/android_device_sony_yoshino-common

https://github.com/CarbonROM/android_device_sony_common-treble

https://github.com/CarbonROM/android_device_sony_maple

https://github.com/obsd39/proprietary_vendor_sony

https://github.com/CarbonROM/android_kernel_sony_msm8998

By the way, I'm currently building on latest Manjaro Linux, and using ScriBt as guide (and as the utility to setup build environments).

Actually, I'm trying to get myself a userdebug build in order to be able to experiment more with some modules and configurations.

EDIT: A late edit. Apparently the device tree and related stuffs in GitHub aren't up-to-date. Up-to-date commits and reviews are available in the CarbonROM Gerrit, and we probably need to cherry-pick some of them from there to see if they could be built to some extent.