kaa example too big to fit esp8266 - kaa

I'm experimenting with the kaa IoT platform on an ESP8266 and have followed this guide. I've set up a new build environment in an Lubuntu virtual box and the build appears to run ok however it complains of a lack of code space (see below).
It seems that the ESP8266 can't handle encryption so I made sure that was turned off in the cmake file using "-DWITH_ENCRYPTION=OFF" but that does not help. Weirdly, the build still seems to mention encryption so perhaps I've not disabled it properly.
I don't understand why it mentions "Built target mbedtls" when I've specified the target as esp8266.
Anyway, here's the build output in case anyone can help me :-)
martin#martin-VirtualBox:/media/sf_martin/kaaSDKs/esp8266-sample/build$ make clean
martin#martin-VirtualBox:/media/sf_martin/kaaSDKs/esp8266-sample/build$ make
-- Toolchain path: /opt/Espressif/crosstool-NG/builds/xtensa-lx106-elf
-- Default SDK location will be used: /opt/Espressif/esp-rtos-sdk
==================================
BUILD_TYPE = MinSizeRel
KAA_PLATFORM = esp8266
KAA_MAX_LOG_LEVEL = 3
==================================
BOOTSTRAP ENABLED
PROFILE ENABLED
USER EXTENSION ENABLED
KAA WILL BE INSTALLED TO /usr/local
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Could NOT find cppcheck
-- Configuring done
-- Generating done
-- Build files have been written to: /media/sf_martin/kaaSDKs/esp8266-sample/build
[ 1%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/aes.c.obj
[ 2%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/asn1parse.c.obj
[ 3%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/asn1write.c.obj
[ 5%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/bignum.c.obj
[ 6%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/ctr_drbg.c.obj
[ 7%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/entropy.c.obj
[ 8%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/entropy_poll.c.obj
[ 10%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/md.c.obj
[ 11%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/md_wrap.c.obj
[ 12%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/oid.c.obj
[ 13%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/pk.c.obj
[ 15%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/pkwrite.c.obj
[ 16%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/pem.c.obj
[ 17%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/pk_wrap.c.obj
[ 18%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/rsa.c.obj
[ 20%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/sha256.c.obj
[ 21%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/pkparse.c.obj
[ 22%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/sha1.c.obj
[ 23%] Building C object libs/kaa/tools/kaa_encryption/rsa_key_gen/mbedtls/CMakeFiles/mbedtls.dir/base64.c.obj
[ 25%] Linking C static library libmbedtls.a
[ 25%] Built target mbedtls
[ 26%] Creating directories for 'kaa_rsa_keygen'
[ 27%] No download step for 'kaa_rsa_keygen'
[ 28%] No patch step for 'kaa_rsa_keygen'
[ 30%] No update step for 'kaa_rsa_keygen'
[ 31%] Performing configure step for 'kaa_rsa_keygen'
-- Configuring done
-- Generating done
-- Build files have been written to: /media/sf_martin/kaaSDKs/esp8266-sample/build/libs/kaa/kaa_keys
[ 32%] Performing build step for 'kaa_rsa_keygen'
[ 83%] Built target mbedtls
[ 91%] Built target rsa_keygen
[100%] Built target generate_rsa_keys
[ 33%] Generating RSA headers
[ 35%] Completed 'kaa_rsa_keygen'
[ 35%] Built target kaa_rsa_keygen
[ 36%] Building C object libs/kaa/CMakeFiles/extension_profile.dir/src/extensions/profile/kaa_profile.c.obj
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/extensions/profile/kaa_profile.c: In function 'kaa_profile_manager_is_profile_set':
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/extensions/profile/kaa_profile.c:195:64: warning: unused parameter 'self' [-Wunused-parameter]
bool kaa_profile_manager_is_profile_set(kaa_profile_manager_t *self)
^
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/extensions/profile/kaa_profile.c: In function 'kaa_profile_manager_update_profile':
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/extensions/profile/kaa_profile.c:394:71: warning: unused parameter 'self' [-Wunused-parameter]
kaa_error_t kaa_profile_manager_update_profile(kaa_profile_manager_t *self, kaa_profile_t *profile_body)
^
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/extensions/profile/kaa_profile.c:394:92: warning: unused parameter 'profile_body' [-Wunused-parameter]
kaa_error_t kaa_profile_manager_update_profile(kaa_profile_manager_t *self, kaa_profile_t *profile_body)
^
[ 37%] Linking C static library libextension_profile.a
[ 37%] Built target extension_profile
Scanning dependencies of target kaac
[ 38%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/logger.c.obj
[ 40%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/kaa_client.c.obj
[ 41%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/configuration_persistence.c.obj
[ 42%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/status.c.obj
[ 43%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/tcp_utils.c.obj
[ 45%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/time.c.obj
[ 46%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/exit.c.obj
[ 47%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/snprintf.c.obj
[ 48%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/common/sha.c.obj
[ 50%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/common/kaa_failover_strategy.c.obj
[ 51%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/common/ext_log_storage_memory.c.obj
[ 52%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/common/ext_log_upload_strategies.c.obj
[ 53%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/common/key_utils.c.obj
[ 55%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/common/kaa_tcp_channel.c.obj
[ 56%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa_protocols/kaa_tcp/kaatcp_parser.c.obj
[ 57%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa_protocols/kaa_tcp/kaatcp_request.c.obj
[ 58%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/avro_src/io.c.obj
[ 60%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/avro_src/encoding_binary.c.obj
[ 61%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/collections/kaa_list.c.obj
[ 62%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/utilities/kaa_aes_rsa.c.obj
[ 63%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/utilities/kaa_log.c.obj
[ 65%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/utilities/kaa_mem.c.obj
[ 66%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/utilities/kaa_buffer.c.obj
[ 67%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa_platform_utils.c.obj
[ 68%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa_platform_protocol.c.obj
[ 70%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa_channel_manager.c.obj
[ 71%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa_common_schema.c.obj
[ 72%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa_status.c.obj
[ 73%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa.c.obj
[ 75%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/kaa_extension.c.obj
[ 76%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/common/kaa_htonll.c.obj
[ 77%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/gen/kaa_profile_gen.c.obj
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/kaa/gen/kaa_profile_gen.c: In function 'kaa_profile_empty_data_deserialize':
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/kaa/gen/kaa_profile_gen.c:47:76: warning: unused parameter 'reader' [-Wunused-parameter]
kaa_profile_empty_data_t *kaa_profile_empty_data_deserialize(avro_reader_t reader)
^
[ 78%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/gen/kaa_logging_gen.c.obj
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/kaa/gen/kaa_logging_gen.c: In function 'kaa_logging_empty_data_deserialize':
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/kaa/gen/kaa_logging_gen.c:47:76: warning: unused parameter 'reader' [-Wunused-parameter]
kaa_logging_empty_data_t *kaa_logging_empty_data_deserialize(avro_reader_t reader)
^
[ 80%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/gen/kaa_configuration_gen.c.obj
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/kaa/gen/kaa_configuration_gen.c: In function 'kaa_configuration_empty_data_deserialize':
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/kaa/gen/kaa_configuration_gen.c:47:88: warning: unused parameter 'reader' [-Wunused-parameter]
kaa_configuration_empty_data_t *kaa_configuration_empty_data_deserialize(avro_reader_t reader)
^
[ 81%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/gen/kaa_notification_gen.c.obj
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/kaa/gen/kaa_notification_gen.c: In function 'kaa_notification_empty_data_deserialize':
/media/sf_martin/kaaSDKs/esp8266-sample/libs/kaa/src/kaa/gen/kaa_notification_gen.c:47:86: warning: unused parameter 'reader' [-Wunused-parameter]
kaa_notification_empty_data_t *kaa_notification_empty_data_deserialize(avro_reader_t reader)
^
[ 82%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/gen/kaa_chat.c.obj
[ 83%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/gen/kaa_chat_definitions.c.obj
[ 85%] Linking C static library libkaac.a
[ 85%] Built target kaac
[ 86%] Building C object libs/kaa/CMakeFiles/extension_user.dir/src/extensions/user/kaa_user.c.obj
[ 87%] Linking C static library libextension_user.a
[ 87%] Built target extension_user
[ 88%] Building C object libs/kaa/CMakeFiles/extension_bootstrap.dir/src/extensions/bootstrap/kaa_bootstrap_manager.c.obj
[ 90%] Linking C static library libextension_bootstrap.a
[ 90%] Built target extension_bootstrap
[ 91%] Building C object CMakeFiles/kaa_demo_s.dir/user/user_main.c.obj
[ 92%] Building C object CMakeFiles/kaa_demo_s.dir/driver/uart.c.obj
[ 93%] Building C object CMakeFiles/kaa_demo_s.dir/src/kaa_demo.c.obj
[ 95%] Linking C static library libkaa_demo_s.a
[ 95%] Built target kaa_demo_s
Scanning dependencies of target kaa_demo
[ 96%] Building C object CMakeFiles/kaa_demo.dir/blank.c.obj
[ 97%] Linking C executable kaa_demo
/opt/Espressif/crosstool-NG/builds/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: kaa_demo section `.text' will not fit in region `iram1_0_seg'
/opt/Espressif/crosstool-NG/builds/xtensa-lx106-elf/lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: region `iram1_0_seg' overflowed by 24817 bytes
collect2: error: ld returned 1 exit status
CMakeFiles/kaa_demo.dir/build.make:122: recipe for target 'kaa_demo' failed
make[2]: *** [kaa_demo] Error 1
CMakeFiles/Makefile2:107: recipe for target 'CMakeFiles/kaa_demo.dir/all' failed
make[1]: *** [CMakeFiles/kaa_demo.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
martin#martin-VirtualBox:/media/sf_martin/kaaSDKs/esp8266-sample/build$

I had the exact same problem when first building the sample app with a custom SDK according to the tutorial you referenced.
First of, the Built target mbedtls refers to the build targets specified by the make file, not your target platform. As you can see in the beginning, the KAA_PLATFORM = esp8266 shows the correct value. Later on, make compiles the correct files as well (for example: [ 38%] Building C object libs/kaa/CMakeFiles/kaac.dir/src/kaa/platform-impl/esp8266/logger.c.obj). This should be fine.
Encryption is disabled in your build. Otherwise it would print ENCRYPTION ENABLED below USER EXTENSION ENABLED.
Here are a couple of possible solutions:
1. Adjust the linker file
One problem for me was that the linker file eagle.app.v6.ld (which should be in the folder ld in your project's root) had to be adjusted so that some parts of the code are moved from RAM to ROM.
I use the linker file from the Kaa sample app and refer to that in the following explanation.
In the section .text : ALIGN(4), find the line containing:
*( .literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
Remove the sections .literal.* .text.* from there and move them to .irom0.text : ALIGN(4) by adding the following line after _irom0_text_start = ABSOLUTE(.);:
*(.literal.* .text.*)
Now all sections starting with .literal.and .text. are located in the ROM. This is sort of brute force because regardless of the *.a module (as defined by the lines below that in the section .irom0.text : ALIGN(4)), all sections of this type are moved to ROM. It might have some complications which I did not yet experience. There is definitely room to optimize the linker mapping.
For me this saved a huge amount of memory in RAM and the program compiled, linked and ran correctly.
2. Minimize extensions
When configuring the build with cmake, you can pass different arguments to cmake to turn extensions on or off (e.g. -DWITH_EXTENSION_PROFILE=OFF to turn off profiles).
In your case, the following extensions seem to be enabled:
BOOTSTRAP ENABLED
PROFILE ENABLED
USER EXTENSION ENABLED
In my experience, some extensions are just to big to be compiled into the final image. I successfully included the Configuration and Logging extensions. Adding any other extensions has lead to an overflow of the RAM.
Make sure to enable only those extensions which are really needed by your endpoint SDK. If it still fails, try to turn all extensions off and enable them step-by-step to see which ones fail.
Informational: See which parts of your code get mapped to which section (RAM or ROM)
The following command prints out a list to the file listing.txt detailing which code is mapped to which section. It might help finding out which parts of the code use the most memory in RAM and ROM. (replace name_of_your_image with the actual name of the image generated by the make command)
xtensa-lx106-elf-objdump -x name_of_your_image > listing.txt

Related

DeviceWatcher.Added method creating compilation issues

I am in an initial stage for developing a BLE library using DLL(Universal Windows) using VS2019.
Below showing the code snippet.
void Device::StartDeviceScan()
{
// Additional properties we would like about the device.
auto requestedProperties = single_threaded_vector<hstring>(
{ L"System.Devices.Aep.DeviceAddress",
L"System.Devices.Aep.IsConnected",
L"System.Devices.Aep.Bluetooth.Le.IsConnectable" });
// list Bluetooth LE devices
hstring aqsAllBluetoothLEDevices =
L"(System.Devices.Aep.ProtocolId:=\"{bb7bb05e-5972-42b5-94fc-76eaa7084d49}\")";
m_DeviceWatcher = Windows::Devices::Enumeration::DeviceInformation::CreateWatcher(
aqsAllBluetoothLEDevices,
requestedProperties,
DeviceInformationKind::AssociationEndpoint);
// Register event handlers before starting the watcher.
m_DeviceWatcherAddedRevoker = m_DeviceWatcher.Added(
winrt::auto_revoke,
&Device::DeviceWatcher_Added);
While building the project i am getting following issues,
1>E:\Piu_projects_test\SensorDll\SensorDll\Generated Files\winrt\base.h(5170): error C2516: 'H': is not a legal base class
1>E:\Piu_projects_test\SensorDll\SensorDll\Generated Files\winrt\Windows.Foundation.h(888): message : see reference to class template instantiation 'winrt::impl::implements_delegate<winrt::Windows::Foundation::TypedEventHandler<winrt::Windows::Devices::Enumeration::DeviceWatcher,winrt::Windows::Devices::Enumeration::DeviceInformation>,H>' being compiled
1> with
1> [
1> H=void (__cdecl infinitysensormodule::Device::* )(winrt::Windows::Devices::Enumeration::DeviceWatcher,winrt::Windows::Devices::Enumeration::DeviceInformation)
1> ]
1>E:\Piu_projects_test\SensorDll\SensorDll\Generated Files\winrt\base.h(5219): message : see reference to class template instantiation 'winrt::impl::delegate<T,H>' being compiled
1> with
1> [
1>
Could you please suggest a solution?

Swift Package Manager - binaryTarget with .zip file fails to validate

I tried different approaches to add a binaryTarget to a Swift package - 2 of them worked out fine (Target1 and Target2 in the example), but third approach (Target3) that should also work according to documentation does not validate: unsupported extension for binary target 'Target3'; valid extensions are: xcframework
For not bloating the repo too much with every binary release I would prefer the zip approach here... - Anyone got it working with a binaryTarget and a .zip file in path: added to the Package repository, or any hints what I'm doing wrong here?
(Xcode 12.4, t3.zip containing only the .xcframework at root level)
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "StackoverflowExamplePackage",
platforms: [
.iOS(.v9)
],
products: [
.library(
name: "Lib1",
targets: ["Target1"]),
.library(
name: "Lib2",
targets: ["Target2", "Target3"]),
],
dependencies: [
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
.binaryTarget(
name: "Target1",
url: "https://myurl.example.com/t1-xcframework.zip",
checksum: "777ddd6381e2201b7eb778b72f373f77e1190fd9dc9503f703e37c86d3b89674"
),
.binaryTarget(name: "Target2", path: "./Binaries/t2.xcframework"),
.binaryTarget(name: "Target3", path: "./Binaries/t3.zip"),
]
)
Zip archive support for local binary targets in SPM was merged last year in October and has been finally released along with Xcode 13.3.

QBS: Explicitly setting qbs.profiles inside Products causing build to fail

My use-case is this:
I have a static library which I want to be available for some profiles (e.g. "gcc", "arm-gcc", "mips-gcc").
I also have an application which links to this library, but this applications should only build using a specific profile (e.g. "arm-gcc").
For this I am modifying the app-and-lib QBS example.
The lib.qbs file:
import qbs 1.0
Product {
qbs.profiles: ["gcc", "arm-gcc", "mips-gcc"] //I added only this line
type: "staticlibrary"
name: "mylib"
files: [
"lib.cpp",
"lib.h",
]
Depends { name: 'cpp' }
cpp.defines: ['CRUCIAL_DEFINE']
Export {
Depends { name: "cpp" }
cpp.includePaths: [product.sourceDirectory]
}
}
The app.qbs file:
import qbs 1.0
Product {
qbs.profiles: ["arm-gcc"] //I added only this line
type: "application"
consoleApplication: true
files : [ "main.cpp" ]
Depends { name: "cpp" }
Depends { name: "mylib" }
}
The app build fails. Qbs wrongly tries to link to the "gcc" version of the library instead of the "arm-gcc" version, as you can see in the log:
Build graph does not yet exist for configuration 'default'. Starting from scratch.
Resolving project for configuration default
Setting up build graph for configuration default
Building for configuration default
compiling lib.cpp [mylib {"profile":"gcc"}]
compiling lib.cpp [mylib {"profile":"arm-gcc"}]
compiling lib.cpp [mylib {"profile":"mips-gcc"}]
compiling main.cpp [app]
creating libmylib.a [mylib {"profile":"gcc"}]
creating libmylib.a [mylib {"profile":"mips-gcc"}]
creating libmylib.a [mylib {"profile":"arm-gcc"}]
linking app [app]
ERROR: /usr/bin/arm-linux-gnueabihf-g++ -o /home/user/programs/qbs/usr/local/share/qbs/examples/app-and-lib/default/app.7d104347/app /home/user/programs/qbs/usr/local/share/qbs/examples/app-and-lib/default/app.7d104347/3a52ce780950d4d9/main.cpp.o /home/user/programs/qbs/usr/local/share/qbs/examples/app-and-lib/default/mylib.eyJwcm9maWxlIjoiZ2NjIn0-.792f47ec/libmylib.a
ERROR: /home/user/programs/qbs/usr/local/share/qbs/examples/app-and-lib/default/mylib.eyJwcm9maWxlIjoiZ2NjIn0-.792f47ec/libmylib.a: error adding symbols: File format not recognized
collect2: error: ld returned 1 exit status
ERROR: Process failed with exit code 1.
The following products could not be built for configuration default:
app
The build fails only when selecting one profile in the app.qbs file, and this profile should not be the first profile in the qbs.profiles line in the lib.qbs file.
When selecting two or more profiles - the build succeeds.
My analysis:
I think this problem is related to multiplexing:
The lib.qbs contains more than one profile. This turns on multiplexing when building the library, which, in turn, adds additional 'multiplexConfigurationId' to the build-directory name (moduleloader.cpp).
The app.lib contains only one profile, so multiplexing is not turned on and the build-directory name does not get the extra string.
The problem can be solved by changing the code (moduleloader.cpp) so that multiplexing is turned even if there is only one profile i.e. with the following patch:
--- moduleloader.cpp 2018-10-24 16:17:43.633527397 +0300
+++ moduleloader.cpp.new 2018-10-24 16:18:27.541370544 +0300
## -872,7 +872,7 ##
= callWithTemporaryBaseModule<const MultiplexInfo>(dummyContext,
extractMultiplexInfoFromProduct);
- if (multiplexInfo.table.size() > 1)
+ if (multiplexInfo.table.size() > 0)
productItem->setProperty(StringConstants::multiplexedProperty(), VariantValue::trueValue());
VariantValuePtr productNameValue = VariantValue::create(productName);
## -891,7 +891,7 ##
const QString multiplexConfigurationId = multiplexInfo.toIdString(row);
const VariantValuePtr multiplexConfigurationIdValue
= VariantValue::create(multiplexConfigurationId);
- if (multiplexInfo.table.size() > 1 || aggregator) {
+ if (multiplexInfo.table.size() > 0 || aggregator) {
multiplexConfigurationIdValues.push_back(multiplexConfigurationIdValue);
item->setProperty(StringConstants::multiplexConfigurationIdProperty(),
multiplexConfigurationIdValue);
This worked for my use case. I don't know if it make sense in a broader view.
Finally, the questions:
Does it all make sense?
Is this a normal behavior?
Is this use-case simply not supported?
Is there a better solution?
Thanks in advance.
Yes, the default behavior with multiplexing is that the a non-multiplexed product depends on all variants of the dependency. In general, there is no way for a user to change that behavior, but there should be.
However, luckily for you, profiles are special:
Depends { name: "mylib"; profiles: "arm-gcc" }
This should fix your problem.

PCL make not generating kinfu_large_scale

This is being built on a Nvidia Jetson TK1 (armv7). I have installed Cuda v6.5, OpenNi v1 & v2, and SensorKinect. I have the following options set via ccmake prior to the build:
BUILD_CUDA
BUILD_GPU
BUILD_apps
BUILD_examples
CUDA_HOST_COMPILER: /usr/bin/cc
CUDA_TOOLKIT_ROOT_DIR: /usr/local/cuda-6.5
Here is the output of make:
$ make
-- Using CPU native flags for SSE optimization: -march=native
-- -- GCC > 4.3 found, enabling -Wabi
-- Found OpenMP
-- Eigen found (include: /usr/include/eigen3, version: 3.2.0)
-- FLANN found (include: /usr/include, lib: optimized;/usr/lib/arm-linux-gnueabihf/libflann_cpp.so;debug;/usr/lib/arm-linux-gnueabihf/libflann_cpp.so)
-- OpenNI found (include: /usr/include/ni, lib: /usr/lib/libOpenNI.so)
-- OpenNI 2 found (include: /usr/include/openni2, lib: /usr/lib/libOpenNI2.so, redist: )
-- checking for module 'metslib'
-- package 'metslib' not found
-- QHULL found (include: /usr/include, lib: optimized;/usr/lib/arm-linux-gnueabihf/libqhull.so;debug;/usr/lib/arm-linux-gnueabihf/libqhull.so)
-- VTK_MAJOR_VERSION 5, rendering backend: OpenGL
-- VTK found (include: /usr/include/vtk-5.8;/usr/include, lib: /usr/lib/;/usr/lib)
-- Could NOT find PCAP (missing: PCAP_LIBRARIES PCAP_INCLUDE_DIRS)
-- Boost version: 1.54.0
-- Found the following Boost libraries:
-- system
-- filesystem
-- thread
-- date_time
-- iostreams
-- chrono
-- Found Glew: /usr/lib/arm-linux-gnueabihf/libGLEW.so
-- PCL_EXAMPLES_SUBDIRS /home/ubuntu/pcl/examples/stereo/;/home/ubuntu/pcl/examples/segmentation/;/home/ubuntu/pcl/examples/features/;/home/ubuntu/pcl/examples/outofcore/;/home/ubuntu/pcl/examples/filters/;/home/ubuntu/pcl/examples/keypoints/;/home/ubuntu/pcl/examples/geometry/;/home/ubuntu/pcl/examples/surface/;/home/ubuntu/pcl/examples/common/
-- DOXYGEN_FOUND
-- HTML_HELP_COMPILER
-- Found CPack generators: DEB
-- The following subsystems will be built:
-- common
-- ml
-- octree
-- kdtree
-- search
-- sample_consensus
-- filters
-- io
-- 2d
-- features
-- registration
-- tracking
-- geometry
-- visualization
-- segmentation
-- people
-- surface
-- recognition
-- stereo
-- keypoints
-- outofcore
-- examples
-- tools
-- apps
not building:
|_ 3d_rec_framework: No reason
|_ in_hand_scanner: Qt4 is required for the in_hand_scanner app!
|_ point_cloud_editor: Qt4 was not found.
|_ cloud_composer: Qt4 was not found.
|_ optronic_viewer: Qt was not found.
|_ modeler: Qt4 was not found.
-- The following subsystems will not be built:
-- simulation: Disabled by default.
-- global_tests: No reason
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/pcl/build
[ 4%] Built target pcl_common
[ 5%] Built target pcl_ml
[ 5%] Built target pcl_octree
[ 5%] Built target pcl_kdtree
[ 6%] Built target pcl_search
[ 9%] Built target pcl_sample_consensus
[ 16%] Built target pcl_filters
[ 16%] Built target pcl_io_ply
[ 26%] Built target pcl_io
[ 27%] Built target pcl_convert_pcd_ascii_binary
[ 27%] Built target pcl_converter
[ 27%] Built target pcl_hdl_grabber
[ 28%] Built target pcl_openni_grabber_depth_example
[ 28%] Built target pcl_openni_grabber_example
[ 28%] Built target pcl_openni_pcd_recorder
[ 28%] Built target pcl_pcd_convert_NaN_nan
[ 28%] Built target pcl_pcd_introduce_nan
[ 28%] Built target pcl_ply2obj
[ 29%] Built target pcl_ply2ply
[ 29%] Built target pcl_ply2raw
[ 29%] Built target pcl_plyheader
[ 29%] Built target pcl_2d
[ 36%] Built target pcl_features
[ 44%] Built target pcl_registration
[ 45%] Built target pcl_tracking
[ 49%] Built target pcl_visualization
[ 49%] Built target pcl_hdl_viewer_simple
[ 49%] Built target pcl_image_grabber_saver
[ 49%] Built target pcl_image_grabber_viewer
[ 50%] Built target pcl_oni_viewer
[ 50%] Built target pcl_openni2_viewer
[ 50%] Built target pcl_openni_image
[ 50%] Built target pcl_openni_viewer
[ 50%] Built target pcl_pcd_grabber_viewer
[ 51%] Built target pcl_pcd_image_viewer
[ 51%] Built target pcl_timed_trigger_test
[ 52%] Built target pcl_viewer
[ 52%] Built target pcl_vlp_viewer
[ 57%] Built target pcl_segmentation
[ 57%] Built target pcl_people
[ 57%] Built target pcl_ground_based_rgbd_people_detector
[ 62%] Built target pcl_surface
[ 66%] Built target pcl_recognition
[ 67%] Built target pcl_stereo
[ 69%] Built target pcl_keypoints
[ 69%] Built target pcl_outofcore
[ 70%] Built target pcl_outofcore_print
[ 70%] Built target pcl_outofcore_process
[ 71%] Built target pcl_example_stereo_baseline
[ 72%] Built target pcl_example_cpc_segmentation
[ 72%] Built target pcl_example_extract_clusters_normals
[ 72%] Built target pcl_example_lccp_segmentation
[ 72%] Built target pcl_example_region_growing
[ 72%] Built target pcl_example_supervoxels
[ 72%] Built target pcl_example_difference_of_normals
[ 73%] Built target pcl_example_fast_point_feature_histograms
[ 74%] Built target pcl_example_normal_estimation
[ 74%] Built target pcl_example_point_feature_histograms
[ 75%] Built target pcl_example_principal_curvatures_estimation
[ 75%] Built target pcl_example_rift_estimation
[ 76%] Built target pcl_example_shape_contexts
[ 76%] Built target pcl_example_spin_images
[ 76%] Built target pcl_example_outofcore
[ 76%] Built target pcl_example_outofcore_with_lod
[ 76%] Built target pcl_example_extract_indices
[ 76%] Built target pcl_example_remove_nan_from_point_cloud
[ 76%] Built target pcl_example_get_keypoints_indices
[ 76%] Built target pcl_example_sift_keypoint_estimation
[ 76%] Built target pcl_example_sift_normal_keypoint_estimation
[ 76%] Built target pcl_example_sift_z_keypoint_estimation
[ 76%] Built target pcl_example_half_edge_mesh
[ 76%] Built target pcl_example_check_if_point_is_valid
[ 76%] Built target pcl_example_copy_point_cloud
[ 76%] Built target pcl_example_get_max_min_coordinates
[ 76%] Built target pcl_example_organized_point_cloud
[ 76%] Built target pcl_example_scope_time
[ 76%] Built target pcl_add_gaussian_noise
[ 77%] Built target pcl_boundary_estimation
[ 77%] Built target pcl_cluster_extraction
[ 77%] Built target pcl_compute_cloud_error
[ 77%] Built target pcl_compute_hausdorff
[ 77%] Built target pcl_compute_hull
[ 77%] Built target pcl_concatenate_points_pcd
[ 77%] Built target pcl_crf_segmentation
[ 77%] Built target pcl_crop_to_hull
[ 78%] Built target pcl_demean_cloud
[ 78%] Built target pcl_elch
[ 78%] Built target pcl_extract_feature
[ 78%] Built target pcl_fast_bilateral_filter
[ 78%] Built target pcl_fpfh_estimation
[ 78%] Built target pcl_generate
[ 78%] Built target pcl_gp3_surface
[ 78%] Built target pcl_grid_min
[ 79%] Built target pcl_icp
[ 79%] Built target pcl_icp2d
[ 79%] Built target pcl_linemod_detection
[ 80%] Built target pcl_local_max
[ 80%] Built target pcl_lum
[ 80%] Built target pcl_marching_cubes_reconstruction
[ 80%] Built target pcl_match_linemod_template
[ 80%] Built target pcl_mesh2pcd
[ 81%] Built target pcl_mesh_sampling
[ 81%] Built target pcl_mls_smoothing
[ 82%] Built target pcl_morph
[ 82%] Built target pcl_ndt2d
[ 82%] Built target pcl_ndt3d
[ 83%] Built target pcl_normal_estimation
[ 83%] Built target pcl_obj2pcd
[ 83%] Built target pcl_obj2ply
[ 83%] Built target pcl_obj2vtk
[ 83%] Built target pcl_obj_rec_ransac_accepted_hypotheses
[ 84%] Built target pcl_obj_rec_ransac_hash_table
[ 84%] Built target pcl_obj_rec_ransac_model_opps
[ 84%] Built target pcl_obj_rec_ransac_orr_octree
[ 84%] Built target pcl_obj_rec_ransac_orr_octree_zprojection
[ 85%] Built target pcl_obj_rec_ransac_result
[ 85%] Built target pcl_obj_rec_ransac_scene_opps
[ 85%] Built target pcl_octree_viewer
[ 85%] Built target pcl_oni2pcd
[ 85%] Built target pcl_openni_save_image
[ 86%] Built target pcl_organized_pcd_to_png
[ 86%] Built target pcl_outlier_removal
[ 86%] Built target pcl_passthrough_filter
[ 86%] Built target pcl_pcd2ply
[ 87%] Built target pcl_pcd2png
[ 87%] Built target pcl_pcd2vtk
[ 87%] Built target pcl_pcd_change_viewpoint
[ 88%] Built target pcl_pclzf2pcd
[ 88%] Built target pcl_plane_projection
[ 88%] Built target pcl_ply2pcd
[ 88%] Built target pcl_ply2vtk
[ 88%] Built target pcl_png2pcd
[ 89%] Built target pcl_poisson_reconstruction
[ 89%] Built target pcl_progressive_morphological_filter
[ 89%] Built target pcl_radius_filter
[ 89%] Built target pcl_registration_visualizer
[ 89%] Built target pcl_sac_segmentation_plane
[ 89%] Built target pcl_spin_estimation
[ 89%] Built target pcl_tiff2pcd
[ 89%] Built target pcl_train_linemod_template
[ 89%] Built target pcl_train_unary_classifier
[ 90%] Built target pcl_transform_from_viewpoint
[ 90%] Built target pcl_transform_point_cloud
[ 90%] Built target pcl_unary_classifier_segment
[ 90%] Built target pcl_uniform_sampling
[ 90%] Built target pcl_vfh_estimation
[ 90%] Built target pcl_virtual_scanner
[ 90%] Built target pcl_voxel_grid
[ 91%] Built target pcl_voxel_grid_occlusion_estimation
[ 91%] Built target pcl_vtk2obj
[ 91%] Built target pcl_vtk2pcd
[ 91%] Built target pcl_vtk2ply
[ 92%] Built target pcl_xyz2pcd
[ 92%] Built target pcl_apps
[ 92%] Built target pcl_convolve
[ 92%] Built target pcl_dinast_grabber
[ 92%] Built target pcl_face_trainer
[ 93%] Built target pcl_feature_matching
[ 93%] Built target pcl_fs_face_detector
[ 94%] Built target pcl_grabcut_2d
[ 94%] Built target pcl_multiscale_feature_persistence_example
[ 94%] Built target pcl_ni_agast
[ 95%] Built target pcl_ni_brisk
[ 95%] Built target pcl_ni_linemod
[ 95%] Built target pcl_ni_susan
[ 95%] Built target pcl_ni_trajkovic
[ 95%] Built target pcl_nn_classification_example
[ 95%] Built target pcl_openni_3d_concave_hull
[ 95%] Built target pcl_openni_3d_convex_hull
[ 95%] Built target pcl_openni_boundary_estimation
[ 96%] Built target pcl_openni_change_viewer
[ 96%] Built target pcl_openni_face_detector
[ 96%] Built target pcl_openni_fast_mesh
[ 96%] Built target pcl_openni_feature_persistence
[ 96%] Built target pcl_openni_ii_normal_estimation
[ 96%] Built target pcl_openni_klt
[ 97%] Built target pcl_openni_mls_smoothing
[ 97%] Built target pcl_openni_mobile_server
[ 97%] Built target pcl_openni_octree_compression
[ 97%] Built target pcl_openni_organized_compression
[ 97%] Built target pcl_openni_organized_edge_detection
[ 98%] Built target pcl_openni_organized_multi_plane_segmentation
[ 98%] Built target pcl_openni_planar_convex_hull
[ 98%] Built target pcl_openni_planar_segmentation
[ 99%] Built target pcl_openni_shift_to_depth_conversion
[ 99%] Built target pcl_openni_tracking
[ 99%] Built target pcl_openni_uniform_sampling
[ 99%] Built target pcl_openni_voxel_grid
[ 99%] Built target pcl_pcd_organized_edge_detection
[ 99%] Built target pcl_pcd_organized_multi_plane_segmentation
[ 99%] Built target pcl_pcd_select_object_plane
[ 99%] Built target pcl_ppf_object_recognition
[ 99%] Built target pcl_pyramid_surface_matching
[ 99%] Built target pcl_statistical_multiscale_interest_region_extraction_example
[ 99%] Built target pcl_stereo_ground_segmentation
[ 99%] Built target pcl_surfel_smoothing_test
[100%] Built target pcl_test_search_speed
What's missing? Can kinfu_large_scale compile for armv7?
I'm building on a Jetson TK1 which is capped at CUDA 6.5 and I've come to the conclusion that kinfu requires > 6.5
Regardless, I found a much better software which is RTAB-Map

Add task to Build.scala

The document http://www.scala-sbt.org/0.13.0/docs/Detailed-Topics/Tasks.html explains how to add a task to build.sbt, but how do you add one to build.scala? Thanks
The part where you declare the TaskKey is the same in either format: val myTask = taskKey....
The part where you write out your Initialize[Task[T]] is the same: myTask := ....
The only difference is the context in which the latter thing appears.
In the .sbt format, it appears by itself, separated from other things by blank lines.
In the .scala format, you have to add the setting to the project. That's documented at http://www.scala-sbt.org/release/docs/Getting-Started/Full-Def.html and is the same regardless of whether we're talking about a task or a regular setting.
Here's a complete working example:
import sbt._
object MyBuild extends Build {
val myTask = taskKey[Unit]("...")
lazy val root =
Project(id = "MyProject", base = file("."))
.settings(
myTask := { println("hello") }
)
}
When defining a task in one project of a multi project build and using a "root" project to aggregate other projects, the aggregation means that any tasks in subprojects can be run from the root project as well, in fact this will run the tasks in all subprojects - see Multi-project builds. This is generally useful, for example to compile all subprojects when the compile task is run from the root project. However in this case it is a little confusing.
So the task is not accessible in all projects, but is accessible in both the subproject where you define the task, and the aggregating (root) project. The task is still running in the project where it is defined, it can just be called when in the root project.
To demonstrate this, we can have the same "hello" task defined in multiple sub projects, which are aggregated in a root project:
import sbt._
import Keys._
object Build extends Build {
val hwsettings = Defaults.defaultSettings ++ Seq(
organization := "organization",
version := "0.1",
scalaVersion := "2.10.4"
)
val hello = TaskKey[Unit]("hello", "Prints hello.")
lazy val projectA = Project(
"a",
file("a"),
settings = hwsettings ++ Seq(
hello := {println("Hello from project A!")}
))
lazy val projectB = Project(
"b",
file("b"),
settings = hwsettings ++ Seq(
hello := {println("Hello from project B!")}
))
lazy val projectC = Project(
"c",
file("c"),
settings = hwsettings
)
lazy val root = Project (
"root",
file ("."),
settings = hwsettings
) aggregate (projectA, projectB, projectC)
}
Note that projects a and b have "hello" tasks, and c does not. When we use "hello" from the root project, the aggregation causes the task to run in projects a AND b:
> project root
[info] Set current project to root (in build file:/Users/trepidacious/temp/multiProjectTasks/)
> hello
Hello from project A!
Hello from project B!
[success] Total time: 0 s, completed 24-Dec-2014 23:00:23
We can also switch to project a or b, and running hello will only run the task in the project we are in:
> project a
[info] Set current project to a (in build file:/Users/trepidacious/temp/multiProjectTasks/)
> hello
Hello from project A!
[success] Total time: 0 s, completed 24-Dec-2014 23:00:27
> project b
[info] Set current project to b (in build file:/Users/trepidacious/temp/multiProjectTasks/)
> hello
Hello from project B!
[success] Total time: 0 s, completed 24-Dec-2014 23:00:30
Finally, if we switch to project c, hello is not defined:
> project c
[info] Set current project to c (in build file:/Users/trepidacious/temp/multiProjectTasks/)
> hello
[error] Not a valid command: hello (similar: shell, help, reload)
[error] No such setting/task
[error] hello
[error] ^
>
This aggregation can be disabled, as described here.

Resources