How to integrate a native C app into a custom LineageOS 21 ROM?

Hi all,

I successfully build LineageOS 21 on my Ubuntu 20.04 machine for the emulator:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>cd lineageos
source build/envsetup.sh
breakfast sdk_phone_x86_64
mka
</code>
<code>cd lineageos source build/envsetup.sh breakfast sdk_phone_x86_64 mka </code>
cd lineageos
source build/envsetup.sh
breakfast sdk_phone_x86_64
mka

Next, I wanted to integrate a native C application to the ROM. I did the following steps:

1) Create the native C app “helloworld”

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>cd lineageos
mkdir -p external/helloworld
nano external/helloworld/helloworld.c
</code>
<code>cd lineageos mkdir -p external/helloworld nano external/helloworld/helloworld.c </code>
cd lineageos
mkdir -p external/helloworld
nano external/helloworld/helloworld.c

Added the following code to helloworld.c

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>/* external/helloworld/helloworld.c */
#include <stdio.h>
int main() {
printf("Hello, World!n");
return 0;
}
</code>
<code>/* external/helloworld/helloworld.c */ #include <stdio.h> int main() { printf("Hello, World!n"); return 0; } </code>
/* external/helloworld/helloworld.c */

#include <stdio.h>  
  
int main() {  
    printf("Hello, World!n");  
    return 0;  
}  

2) Create the blueprint file

Create the Android.bp file within the external/helloworld directory:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>nano external/helloworld/Android.bp
</code>
<code>nano external/helloworld/Android.bp </code>
nano external/helloworld/Android.bp

Added the following content:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>cc_binary {
name: "helloworld",
srcs: ["helloworld.c"],
installable: true,
relative_install_path: "bin",
}
</code>
<code>cc_binary { name: "helloworld", srcs: ["helloworld.c"], installable: true, relative_install_path: "bin", } </code>
cc_binary {  
    name: "helloworld",  
    srcs: ["helloworld.c"],  
    installable: true,  
    relative_install_path: "bin",  
}  

And now I am little bit stuck and don’t know how and where to add the helloworld app into the build process so that the command mka builds also my native app and integrates it into the ROM.

I tried the following without success:

3) Modify the emulator prodict makefile

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>nano device/generic/goldfish/product/generic.mk
</code>
<code>nano device/generic/goldfish/product/generic.mk </code>
nano device/generic/goldfish/product/generic.mk

Added the following content at the end of the file:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>PRODUCT_PACKAGES += helloworld
</code>
<code>PRODUCT_PACKAGES += helloworld </code>
PRODUCT_PACKAGES += helloworld

4) Clean and build

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>make clean
source build/envsetup.sh
breakfast sdk_phone_x86_64
mka
</code>
<code>make clean source build/envsetup.sh breakfast sdk_phone_x86_64 mka </code>
make clean
source build/envsetup.sh
breakfast sdk_phone_x86_64
mka

This results in the following error:

I get the error:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>build/make/core/artifact_path_requirements.mk:31: warning: vendor/lineage/build/target/product/lineage_sdk_phone_x86_64.mk produces files inside build/make/target/product/generic_system.mks artifact path requirement.
Offending entries:
system/bin/helloworld
In file included from build/make/core/main.mk:1433:
build/make/core/artifact_path_requirements.mk:31: error: Build failed.
</code>
<code>build/make/core/artifact_path_requirements.mk:31: warning: vendor/lineage/build/target/product/lineage_sdk_phone_x86_64.mk produces files inside build/make/target/product/generic_system.mks artifact path requirement. Offending entries: system/bin/helloworld In file included from build/make/core/main.mk:1433: build/make/core/artifact_path_requirements.mk:31: error: Build failed. </code>
build/make/core/artifact_path_requirements.mk:31: warning: vendor/lineage/build/target/product/lineage_sdk_phone_x86_64.mk produces files inside build/make/target/product/generic_system.mks artifact path requirement.
Offending entries:
system/bin/helloworld
In file included from build/make/core/main.mk:1433:
build/make/core/artifact_path_requirements.mk:31: error: Build failed.

How to make this work? How to correctly integrate the native C helloworld app into the ROM?

Thanks in advance for providing any ideas and hints 🙂

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật