# Make fails for external native app sample

**URL:** <https://forum.webosose.org/t/make-fails-for-external-native-app-sample/1004>\
**Category:** App Development\
**Created:** [February 5, 2020, 2:21pm UTC](https://forum.webosose.org/t/make-fails-for-external-native-app-sample/1004 "2020-02-05T14:21:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![CatalinC](https://avatars.discourse-cdn.com/v4/letter/c/e9c0ed/32.png) [@CatalinC](https://forum.webosose.org/u/CatalinC)\
**Post date:** [February 5, 2020, 2:21pm UTC](https://forum.webosose.org/t/make-fails-for-external-native-app-sample/1004/1 "2020-02-05T14:21:08Z")

</div>

Hello WebOSErs,

I am currently following this tutorial:

> **[Developing External Native Apps](https://www.webosose.org/docs/tutorials/native-apps/developing-external-native-apps/)**
>
> External native apps are 3rd party native apps that must be installed on the webOS target device.
> Unlike other external apps (web or QML), a sample template is not provided for an external native app. So you have to create and implement the source...

I have built everything from scratch on Ubuntu 18.04 x64 (Virtual Box on Windows 10 x64 Host)

I have followed all the steps of the NDK build and also built the other example "Built-In Native App" successfully. So everything should be fine as far as I can tell.

My current issue lies at ## Step 3: Build the Native App, after running "cmake .."

cmake ..  
-- Configuring done  
-- Generating done  
-- Build files have been written to: /home/catalin/WebOS/build-webos/com.sample.waylandegl/BUILD

comes the make step which fails:

make[50%] Building C object CMakeFiles/wayland\_egl.dir/src/wayland\_egl.c.o  
In file included from /opt/webos-sdk-x86\_64/1.0.g/sysroots/i586-webos-linux/usr/include/sys/cdefs.h:443:0,  
from /opt/webos-sdk-x86\_64/1.0.g/sysroots/i586-webos-linux/usr/include/features.h:428,  
from /opt/webos-sdk-x86\_64/1.0.g/sysroots/i586-webos-linux/usr/include/bits/libc-header-start.h:33,  
from /opt/webos-sdk-x86\_64/1.0.g/sysroots/i586-webos-linux/usr/include/stdio.h:27,  
from /home/catalin/WebOS/build-webos/com.sample.waylandegl/src/wayland\_egl.c:1:  
/opt/webos-sdk-x86\_64/1.0.g/sysroots/i586-webos-linux/usr/include/bits/long-double.h:60:10: fatal error: bits/long-double-64.h: No such file or directory  
compilation terminated.  
CMakeFiles/wayland\_egl.dir/build.make:62: recipe for target 'CMakeFiles/wayland\_egl.dir/src/wayland\_egl.c.o' failed  
make[2]: \*\*\* [CMakeFiles/wayland\_egl.dir/src/wayland\_egl.c.o] Error 1  
CMakeFiles/Makefile2:72: recipe for target 'CMakeFiles/wayland\_egl.dir/all' failed  
make[1]: \*\*\* [CMakeFiles/wayland\_egl.dir/all] Error 2  
Makefile:83: recipe for target 'all' failed  
make: \*\*\* [all] Error 2

I have checked for long-double-64.h manually at the .../include/bits folder and it is indeed missing. It includes on the other hand  
long-double-32.h & long-double.h  
long-double.h contains the lines:

#elif \_\_MHWORDSIZE == 64  
#include \<bits/long-double-64.h\>

but the file is nowhere to be found.  
At this point I will note, if not already obvious, that I am building an app for a 32bit image of WebOSE (runing in a virtual box) but my system is 64.

I have also looked for long-double-64.h in /opt/webos-sdk-x86\_64/1.0.g/sysroots/x86\_64-webossdk-linux/usr/include/bits$ found only long-double.h which is defined only as a comment:

/\* long double is distinct from double, so there is nothing to  
define here. \*/

I am at a loss currently as to what should I do, any help would be appreciated,  
Thank you in advance.

---

<div class="post-metadata">

**Author:** ![NERGI](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.webosose.org/nergi/32/364_2.png) [@NERGI](https://forum.webosose.org/u/NERGI)\
**Post date:** [February 7, 2020, 2:00am UTC](https://forum.webosose.org/t/make-fails-for-external-native-app-sample/1004/2 "2020-02-07T02:00:03Z")

</div>

Hi @CatalinC, welcome to the forum.

We tested the build for the external native app, but it worked well...  
So could you give us the following informations?

- Returns of
  - `cat mcf.status` at `build-webos` directory
  - `git log --name-status HEAD^..HEAD` at `build-webos` directory

- Did you enter the command `source environment-setup-i586-webos-linux` ? If so, what is the return of `echo $CC` command?

Thanks

---

<div class="post-metadata">

**Author:** ![CatalinC](https://avatars.discourse-cdn.com/v4/letter/c/e9c0ed/32.png) [@CatalinC](https://forum.webosose.org/u/CatalinC)\
**Post date:** [February 7, 2020, 8:45am UTC](https://forum.webosose.org/t/make-fails-for-external-native-app-sample/1004/3 "2020-02-07T08:45:15Z")

</div>

Hi @NERGI,

Thanks for taking the time, here is the info you requested:

#1  
cat mcf.status  
#!/bin/sh

#DO NOT MODIFY! This script is generated by ./mcf. Changes made  
#here will be lost. Source for this file can be found in  
#mcf-status.in.

## 

#Copyright (c) 2008-2014 LG Electronics, Inc.

... (more commented copyright stuff here)

#Run this file to recreate the current configuration.

set -e

exec ./mcf   
--enable-bb-number-threads=3   
--enable-parallel-make=3   
--disable-icecc   
--enable-icecc-parallel-make=0   
--enable-icecc-location=   
--enable-icecc-user-package-blacklist=   
--enable-icecc-user-class-blacklist=   
--enable-icecc-user-package-whitelist=   
--enable-icecc-env-exec=   
--premirror=   
--sstatemirror=   
--enable-buildhistory   
--enable-buildhistoryauthor=''   
--enable-network   
--disable-fetch-premirror-only   
--disable-generate-mirror-tarballs   
qemux86

#2  
git log --name-status HEAD^..HEAD  
commit 01a1b618c7aa17a54cb18c664a6707344b7634b6 (HEAD -\> master, tag: v2.3.0, tag: builds/master/154, origin/master, origin/HEAD)  
Author: Minjae Kim [nate.kim@lge.com](mailto:nate.kim@lge.com)  
Date: Wed Jan 22 18:50:08 2020 +0900

```
webos-image: Update layer pins for 2020-01-22 (build 154)

meta-webosose as of 2020-01-22 18:19:43 +0900

82acd7142 com.palm.service.devmode=4
704d31936 ose: activitymanager=5 luna-service2-security-conf=14
        webos-initscripts=42

```

M weboslayers.py

#3

$ echo $CC  
i586-webos-linux-gcc -m32 -march=i586 -Werror=return-type --sysroot=/opt/webos-sdk-x86\_64/1.0.g/sysroots/i586-webos-linux

As requested. I would also like to note that I did all these in the same terminal from scratch except the mcf command "./mcf -p 3 -b 3 qemux86", which was done prior, as can be seen in the mcf.status

If there is anything else you need let me know !

Thanks

---

<div class="post-metadata">

**Author:** ![sukdo399](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.webosose.org/sukdo399/32/170_2.png) [@sukdo399](https://forum.webosose.org/u/sukdo399)\
**Post date:** [February 10, 2020, 6:54am UTC](https://forum.webosose.org/t/make-fails-for-external-native-app-sample/1004/4 "2020-02-10T06:54:32Z")

</div>

Hi.

Building an app for 32 bit webOS target qemux86 machine on 64 bit host computer is fine  
because our cross toolchain (including gcc) run on a host system of a specific architecture (such as x86, x86-64 etc), but they produce binary code (executables) to run on a different architecture (for example, qemux86 or arm etc).

It's very weird because I cannot reproduce on my environment(ubuntu 18.04 LTS 64 bit host, qemux86 target and build-webos #154 which are same with you), as @NERGI said.  
So let us simplify the issue without cmake/make.  
First, I made very simple c file to check the define \_\_MHWORDSIZE  
shko@shko-H97-Gaming-3:~/ddd$ cat hello.c  
#include \<stdio.h\>

```
int main()
{
    printf("hello\n");
#if __MHWORDSIZE == 64
    printf("64\n");
#endif
    return 0;
}

```

Then, please compile above source by using $CC (after source environment-setup-i586-webos-linux)  
`$CC hello.c`

Then you can get the a.out file, please copy this file to your target emulator using scp etc.  
If you execute a.out on your target emulator, the result should be  
`$ ./a.out

hello

Let us check above simple test then go further with cmake/make also to find the problem.

---

<div class="post-metadata">

**Author:** ![CatalinC](https://avatars.discourse-cdn.com/v4/letter/c/e9c0ed/32.png) [@CatalinC](https://forum.webosose.org/u/CatalinC)\
**Post date:** [February 10, 2020, 9:11am UTC](https://forum.webosose.org/t/make-fails-for-external-native-app-sample/1004/5 "2020-02-10T09:11:52Z")

</div>

Hi @sukdo399

Thanks for your input.  
I sourced my terminal, created and compiled the small file.  
As expected the output is:

root@qemux86:/home/developer# ./a.out  
hello

---

<div class="post-metadata">

**Author:** ![sukdo399](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.webosose.org/sukdo399/32/170_2.png) [@sukdo399](https://forum.webosose.org/u/sukdo399)\
**Post date:** [February 11, 2020, 1:05am UTC](https://forum.webosose.org/t/make-fails-for-external-native-app-sample/1004/6 "2020-02-11T01:05:45Z")

</div>

Then, I guess there is a problem during cmake/or make itself.  
So could you please build using below Makefile?

```
shko@shko-H97-Gaming-3:~/work/wayland_egl_simple_ose/src$ cat Makefile 
TARGET=wayland_egl
OBJECT=wayland_egl.o
EGL = `pkg-config --cflags --libs egl`
WAYLAND_EGL = `pkg-config --cflags --libs wayland-egl`
GLESV2 = `pkg-config --cflags --libs glesv2`
WAYLAND_WEBOS_CLIENT = `pkg-config --cflags --libs wayland-webos-client`

$(TARGET) : $(OBJECT)
	$(CC) -o $(TARGET) wayland_egl.o $(EGL) $(WAYLAND_EGL) $(GLESV2) $(WAYLAND_WEBOS_CLIENT)

wayland_egl.o : wayland_egl.c
	$(CC) -c -o wayland_egl.o wayland_egl.c

clean:
	rm $(OBJECT) $(TARGET)

```

Put this "Makefile" to your source directory, then just type the "make" command on your shell  
(of course after source environment-setup-cortexa7t2hf-neon-vfpv4-webos-linux-gnueabi)  
then you can get the 'wayland\_egl' as belows

```
shko@shko-H97-Gaming-3:~/work/wayland_egl_simple_ose/src$ make
i586-webos-linux-gcc -m32 -march=i586 -Werror=return-type --sysroot=/home/shko/ndk_ose_qemu/sysroots/i586-webos-linux -c -o wayland_egl.o wayland_egl.c
i586-webos-linux-gcc -m32 -march=i586 -Werror=return-type --sysroot=/home/shko/ndk_ose_qemu/sysroots/i586-webos-linux -o wayland_egl wayland_egl.o `pkg-config --cflags --libs egl` `pkg-config --cflags --libs wayland-egl` `pkg-config --cflags --libs glesv2` `pkg-config --cflags --libs wayland-webos-client`
shko@shko-H97-Gaming-3:~/work/wayland_egl_simple_ose/src$ ls
Makefile wayland_egl wayland_egl.c wayland_egl.o

```

please put 'wayland\_egl' to your emulator and run on the shell.

You can see the yellow screen on your emulator if it works fine  
Then we can guess there is a problem during cmake procedure.
