Forum

Make fails for external native app sample

Hello WebOSErs,

I am currently following this tutorial:

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.

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

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
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

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.

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

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.