# Building CPP (JNI) and Java on Raspberry/Raspbian

**URL:** <https://discuss.gradle.org/t/building-cpp-jni-and-java-on-raspberry-raspbian/37036>\
**Category:** Help/Discuss\
**Created:** [July 26, 2020, 1:00pm UTC](https://discuss.gradle.org/t/building-cpp-jni-and-java-on-raspberry-raspbian/37036 "2020-07-26T13:00:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrMacSpooky](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@MrMacSpooky](https://discuss.gradle.org/u/MrMacSpooky)\
**Post date:** [July 26, 2020, 1:00pm UTC](https://discuss.gradle.org/t/building-cpp-jni-and-java-on-raspberry-raspbian/37036/1 "2020-07-26T13:00:38Z")

</div>

Hello,  
there is a Problem building my project on  
Linux raspberrypi 5.4.51-v7+ #1327 SMP Thu Jul 23 10:58:46 BST 2020 armv7l GNU/Linux  
It’s a Raspberry Pi OS (32-bit) with Desktop - Hardware is Raspberry Pi 3

My project-structure is:  
./src/main/resources  
./src/main/java  
./ws281x/src/main/public  
./ws281x/src/main/headers  
./ws281x/src/main/cpp

```
./ws281x/build.gradle

```

> plugins {  
> id ‘cpp-library’  
> }
> 
> tasks.withType(CppCompile).configureEach {  
> compilerArgs.add “-I$System.env.JAVA\_HOME” + “include”  
> compilerArgs.add “-I$System.env.JAVA\_HOME” + “include/linux”  
> compilerArgs.add ‘-fpermissive’  
> dependsOn clean  
> dependsOn rootProject.compileJava  
> }

```
./build.gradle

```

> plugins {  
> id ‘java’  
> id ‘application’  
> }
> 
> compileJava {  
> options.headerOutputDirectory = file(“./ws281x/src/main/public/”)  
> dependsOn clean  
> }
> 
> application {  
> mainClassName = ‘de.mrss.ws281x.stream.ConsoleDemo’  
> }
> 
> jar {  
> from(“./ws281x/build/lib/main/debug”) {  
> include “\*.so”  
> into “lib”  
> }  
> manifest {  
> attributes (  
> ‘Main-Class’: mainClassName  
> )  
> }  
> dependsOn “:ws281x:assemble”  
> }
> 
> repositories {  
> mavenCentral()  
> }
> 
> dependencies {  
> implementation group: ‘javax.xml.bind’, name: ‘jaxb-api’, version: ‘2.3.1’   
> }

```
./settings.gradle

```

> include ‘ws281x’

If I run gradle jar on an ubuntu-Desktop  
Linux Z390F 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86\_64 x86\_64 x86\_64 GNU/Linux  
build will successfully end and generates the files i expect (java-build, cpp-build, jar with java and cpp-content). The generated lib won’t work - but this is expected, too.  
But on the target-maschine (Raspi) there will be an error:

```
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ws281x:compileDebugCpp'.
> No tool chain is available to build C++ for host operating system 'Linux' architecture 'arm-v7':
    - Tool chain 'visualCpp' (Visual Studio):
        - Visual Studio is not available on this operating system.
    - Tool chain 'gcc' (GNU GCC):
        - Don't know how to build for host operating system 'Linux' architecture 'arm-v7'.
    - Tool chain 'clang' (Clang):
        - Don't know how to build for host operating system 'Linux' architecture 'arm-v7'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 24s

```

What have I to do to let the build succeed on Raspi?

I’m using gradle 6.5.1 (from gradle.org-Download) on both.

---

<div class="post-metadata">

**Author:** ![MrMacSpooky](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@MrMacSpooky](https://discuss.gradle.org/u/MrMacSpooky)\
**Post date:** [July 30, 2020, 7:06pm UTC](https://discuss.gradle.org/t/building-cpp-jni-and-java-on-raspberry-raspbian/37036/2 "2020-07-30T19:06:45Z")

</div>

I’ve apt-get install(ed) clang, so gcc und clang are available - this doesn’t solve this problem. I’ve no idea, what gradle’s problem might be. On Raspi build of c/cpp is posssible - but gradle won’t…?! Please help…  
I did a [Build-Scan](https://scans.gradle.com/s/krl5ympkjhj34/) … hope, those infos help…
