Error while building legato 18.04.0 for WP7502 - fatal error: unistd.h: No such file or directory

root@testUser:/home/testUser/iot/legatoAF/legato# make wp750x
Module: WiFi
********************* VERSION ********************
Legato WiFi version: 18.04.0
**************************************************
Module: Dualsys
make -f Makefile.hostTools
make[1]: Entering directory '/home/testUser/iot/legatoAF/legato'
mkdir -p bin
Using ninja installed at: /usr/bin/ninja
mkdir -p /home/testUser/iot/legatoAF/legato/build/tools
export TOOLS_ARCH=x86_64 && \
framework/tools/mkTools/ninja-generator
Tools arch: x86_64
ln -sf ../build/tools/mk bin/mk
ln -sf mk bin/mkcomp
ln -sf mk bin/mkexe
ln -sf mk bin/mkapp
ln -sf mk bin/mksys
ln -sf ../framework/tools/scripts/splitdebug ../framework/tools/scripts/instsys ../framework/tools/scripts/settime ../framework/tools/scripts/mkinfo ../framework/tools/scripts/instlegato ../framework/tools/scripts/stoplegato ../framework/tools/scripts/cextgenerator.py ../framework/tools/scripts/settz ../framework/tools/scripts/createsdk ../framework/tools/scripts/systoimg ../framework/tools/scripts/legato-qemu ../framework/tools/scripts/checkpa ../framework/tools/scripts/legato-install ../framework/tools/scripts/update-pack ../framework/tools/scripts/security-pack ../framework/tools/scripts/instapp ../framework/tools/scripts/mklegatoimg ../framework/tools/scripts/app ../framework/tools/scripts/av-pack ../framework/tools/scripts/releaselegato ../framework/tools/scripts/findtoolchain ../framework/tools/scripts/remoteDebug ../framework/tools/scripts/systocwe ../framework/tools/scripts/configlegatoenv ../framework/tools/scripts/update ../framework/tools/scripts/sbhelper ../framework/tools/scripts/configtargetssh ../framework/tools/scripts/legs ../framework/tools/scripts/gettargettype ../framework/tools/scripts/update-util ../framework/tools/scripts/configToolchainDirEnvVars ../framework/tools/scripts/simu ../framework/tools/scripts/fwupdate ../framework/tools/scripts/setname ../framework/tools/scripts/mkdoc ../framework/tools/scripts/startlegato ../framework/tools/scripts/shlib ../framework/tools/scripts/mklegatotreero bin/
ln -sf /home/testUser/iot/legatoAF/legato/framework/tools/ifgen/ifgen bin/
ln -sf /home/testUser/iot/legatoAF/legato/3rdParty/ima-support-tools/ima-sign.sh bin/
ln -sf /home/testUser/iot/legatoAF/legato/3rdParty/ima-support-tools/ima-gen-keys.sh bin/
make -C framework/tools/mkPatch mkPatch
make[2]: Entering directory '/home/testUser/iot/legatoAF/legato/framework/tools/mkPatch'
/usr/bin/gcc -Wall -Werror -o /home/testUser/iot/legatoAF/legato/bin/mkPatch \
    mkPatch.c /home/testUser/iot/legatoAF/legato/framework/liblegato/crc.c \
    -I/home/testUser/iot/legatoAF/legato/framework/include \
    -I/home/testUser/iot/legatoAF/legato/3rdParty/include
make[2]: Leaving directory '/home/testUser/iot/legatoAF/legato/framework/tools/mkPatch'
ninja  -f /home/testUser/iot/legatoAF/legato/build/tools/build.ninja
[63/63] Linking mk tools
make[1]: Leaving directory '/home/testUser/iot/legatoAF/legato'
# Generate an MD5 hash of everything in the source directories.
find framework components interfaces platformAdaptor modules apps/platformServices  apps/tools targetFiles Makefile.framework Makefile.hostTools Makefile.targetTools Makefile targetDefs CMakeLists.txt -type f | grep -v ".git" | sort | while read filePath ; \
do \
  echo "$filePath" && \
  cat "$filePath" ; \
done | md5sum | awk '{ print $1 }' > sources.md5
version=18.04.0
md5=09ee9012c7269d73eb8471a1ec7a70e2
make -f Makefile.framework CC=/opt/swi/y22-ext-wp750x/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc
make[1]: Entering directory '/home/testUser/iot/legatoAF/legato'
mkdir -p /home/testUser/iot/legatoAF/legato/build/wp750x/framework/lib
framework/liblegato/ninja-generator
ninja  -f /home/testUser/iot/legatoAF/legato/build/wp750x/framework/build.ninja
[10/52] Compiling liblegato source file
FAILED: /opt/swi/y22-ext-wp750x/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -MMD -MF /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/daemon.c.o.d -c /home/testUser/iot/legatoAF/legato/framework/liblegato/linux/daemon.c -o /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/daemon.c.o -Wall -Werror -DLEGATO_EMBEDDED -fPIC -I/home/testUser/iot/legatoAF/legato/framework/daemons/linux -g -O2 -fno-omit-frame-pointer -I/home/testUser/iot/legatoAF/legato/framework/liblegato/linux -DLE_COMPONENT_NAME=framework -I/home/testUser/iot/legatoAF/legato/framework/include -I/home/testUser/iot/legatoAF/legato/framework/liblegato -DDISABLE_SMACK=0 -DLE_SVCDIR_SERVER_SOCKET_NAME="\"/tmp/legato/serviceDirectoryServer\"" -DLE_SVCDIR_CLIENT_SOCKET_NAME="\"/tmp/legato/serviceDirectoryClient\"" 
In file included from /home/testUser/iot/legatoAF/legato/framework/liblegato/linux/daemon.c:10:0:
/home/testUser/iot/legatoAF/legato/framework/include/legato.h:146:20: fatal error: unistd.h: No such file or directory
 #include <unistd.h>
                    ^
compilation terminated.
[10/52] Compiling liblegato source file
FAILED: /opt/swi/y22-ext-wp750x/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -MMD -MF /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/dir.c.o.d -c /home/testUser/iot/legatoAF/legato/framework/liblegato/linux/dir.c -o /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/dir.c.o -Wall -Werror -DLEGATO_EMBEDDED -fPIC -I/home/testUser/iot/legatoAF/legato/framework/daemons/linux -g -O2 -fno-omit-frame-pointer -I/home/testUser/iot/legatoAF/legato/framework/liblegato/linux -DLE_COMPONENT_NAME=framework -I/home/testUser/iot/legatoAF/legato/framework/include -I/home/testUser/iot/legatoAF/legato/framework/liblegato -DDISABLE_SMACK=0 -DLE_SVCDIR_SERVER_SOCKET_NAME="\"/tmp/legato/serviceDirectoryServer\"" -DLE_SVCDIR_CLIENT_SOCKET_NAME="\"/tmp/legato/serviceDirectoryClient\"" 
In file included from /home/testUser/iot/legatoAF/legato/framework/liblegato/linux/dir.c:7:0:
/home/testUser/iot/legatoAF/legato/framework/include/legato.h:146:20: fatal error: unistd.h: No such file or directory
 #include <unistd.h>
                    ^
compilation terminated.
[10/52] Compiling liblegato source file
FAILED: /opt/swi/y22-ext-wp750x/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -MMD -MF /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/singlyLinkedList.c.o.d -c /home/testUser/iot/legatoAF/legato/framework/liblegato/singlyLinkedList.c -o /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/singlyLinkedList.c.o -Wall -Werror -DLEGATO_EMBEDDED -fPIC -I/home/testUser/iot/legatoAF/legato/framework/daemons/linux -g -O2 -fno-omit-frame-pointer -I/home/testUser/iot/legatoAF/legato/framework/liblegato/linux -DLE_COMPONENT_NAME=framework -I/home/testUser/iot/legatoAF/legato/framework/include -I/home/testUser/iot/legatoAF/legato/framework/liblegato -DDISABLE_SMACK=0 -DLE_SVCDIR_SERVER_SOCKET_NAME="\"/tmp/legato/serviceDirectoryServer\"" -DLE_SVCDIR_CLIENT_SOCKET_NAME="\"/tmp/legato/serviceDirectoryClient\"" 
In file included from /home/testUser/iot/legatoAF/legato/framework/liblegato/singlyLinkedList.c:6:0:
/home/testUser/iot/legatoAF/legato/framework/include/legato.h:146:20: fatal error: unistd.h: No such file or directory
 #include <unistd.h>
                    ^
compilation terminated.
[10/52] Compiling liblegato source file
FAILED: /opt/swi/y22-ext-wp750x/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -MMD -MF /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/cgroups.c.o.d -c /home/testUser/iot/legatoAF/legato/framework/liblegato/linux/cgroups.c -o /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/cgroups.c.o -Wall -Werror -DLEGATO_EMBEDDED -fPIC -I/home/testUser/iot/legatoAF/legato/framework/daemons/linux -g -O2 -fno-omit-frame-pointer -I/home/testUser/iot/legatoAF/legato/framework/liblegato/linux -DLE_COMPONENT_NAME=framework -I/home/testUser/iot/legatoAF/legato/framework/include -I/home/testUser/iot/legatoAF/legato/framework/liblegato -DDISABLE_SMACK=0 -DLE_SVCDIR_SERVER_SOCKET_NAME="\"/tmp/legato/serviceDirectoryServer\"" -DLE_SVCDIR_CLIENT_SOCKET_NAME="\"/tmp/legato/serviceDirectoryClient\"" 
In file included from /home/testUser/iot/legatoAF/legato/framework/liblegato/linux/cgroups.c:9:0:
/home/testUser/iot/legatoAF/legato/framework/include/legato.h:146:20: fatal error: unistd.h: No such file or directory
 #include <unistd.h>
                    ^
compilation terminated.
[10/52] Compiling liblegato source file
FAILED: /opt/swi/y22-ext-wp750x/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -MMD -MF /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/utf8.c.o.d -c /home/testUser/iot/legatoAF/legato/framework/liblegato/utf8.c -o /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/utf8.c.o -Wall -Werror -DLEGATO_EMBEDDED -fPIC -I/home/testUser/iot/legatoAF/legato/framework/daemons/linux -g -O2 -fno-omit-frame-pointer -I/home/testUser/iot/legatoAF/legato/framework/liblegato/linux -DLE_COMPONENT_NAME=framework -I/home/testUser/iot/legatoAF/legato/framework/include -I/home/testUser/iot/legatoAF/legato/framework/liblegato -DDISABLE_SMACK=0 -DLE_SVCDIR_SERVER_SOCKET_NAME="\"/tmp/legato/serviceDirectoryServer\"" -DLE_SVCDIR_CLIENT_SOCKET_NAME="\"/tmp/legato/serviceDirectoryClient\"" 
In file included from /home/testUser/iot/legatoAF/legato/framework/liblegato/utf8.c:7:0:
/home/testUser/iot/legatoAF/legato/framework/include/legato.h:146:20: fatal error: unistd.h: No such file or directory
 #include <unistd.h>
                    ^
compilation terminated.
[10/52] Compiling liblegato source file
FAILED: /opt/swi/y22-ext-wp750x/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -MMD -MF /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/clock.c.o.d -c /home/testUser/iot/legatoAF/legato/framework/liblegato/linux/clock.c -o /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/clock.c.o -Wall -Werror -DLEGATO_EMBEDDED -fPIC -I/home/testUser/iot/legatoAF/legato/framework/daemons/linux -g -O2 -fno-omit-frame-pointer -I/home/testUser/iot/legatoAF/legato/framework/liblegato/linux -DLE_COMPONENT_NAME=framework -I/home/testUser/iot/legatoAF/legato/framework/include -I/home/testUser/iot/legatoAF/legato/framework/liblegato -DDISABLE_SMACK=0 -DLE_SVCDIR_SERVER_SOCKET_NAME="\"/tmp/legato/serviceDirectoryServer\"" -DLE_SVCDIR_CLIENT_SOCKET_NAME="\"/tmp/legato/serviceDirectoryClient\"" 
In file included from /home/testUser/iot/legatoAF/legato/framework/liblegato/linux/clock.c:8:0:
/home/testUser/iot/legatoAF/legato/framework/include/legato.h:146:20: fatal error: unistd.h: No such file or directory
 #include <unistd.h>
                    ^
compilation terminated.
[10/52] Compiling liblegato source file
FAILED: /opt/swi/y22-ext-wp750x/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -MMD -MF /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/args.c.o.d -c /home/testUser/iot/legatoAF/legato/framework/liblegato/linux/args.c -o /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/args.c.o -Wall -Werror -DLEGATO_EMBEDDED -fPIC -I/home/testUser/iot/legatoAF/legato/framework/daemons/linux -g -O2 -fno-omit-frame-pointer -I/home/testUser/iot/legatoAF/legato/framework/liblegato/linux -DLE_COMPONENT_NAME=framework -I/home/testUser/iot/legatoAF/legato/framework/include -I/home/testUser/iot/legatoAF/legato/framework/liblegato -DDISABLE_SMACK=0 -DLE_SVCDIR_SERVER_SOCKET_NAME="\"/tmp/legato/serviceDirectoryServer\"" -DLE_SVCDIR_CLIENT_SOCKET_NAME="\"/tmp/legato/serviceDirectoryClient\"" 
In file included from /home/testUser/iot/legatoAF/legato/framework/liblegato/linux/args.c:7:0:
/home/testUser/iot/legatoAF/legato/framework/include/legato.h:146:20: fatal error: unistd.h: No such file or directory
 #include <unistd.h>
                    ^
compilation terminated.
[10/52] Compiling liblegato source file
FAILED: /opt/swi/y22-ext-wp750x/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -MMD -MF /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/addr.c.o.d -c /home/testUser/iot/legatoAF/legato/framework/liblegato/linux/addr.c -o /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/addr.c.o -Wall -Werror -DLEGATO_EMBEDDED -fPIC -I/home/testUser/iot/legatoAF/legato/framework/daemons/linux -g -O2 -fno-omit-frame-pointer -I/home/testUser/iot/legatoAF/legato/framework/liblegato/linux -DLE_COMPONENT_NAME=framework -I/home/testUser/iot/legatoAF/legato/framework/include -I/home/testUser/iot/legatoAF/legato/framework/liblegato -DDISABLE_SMACK=0 -DLE_SVCDIR_SERVER_SOCKET_NAME="\"/tmp/legato/serviceDirectoryServer\"" -DLE_SVCDIR_CLIENT_SOCKET_NAME="\"/tmp/legato/serviceDirectoryClient\"" 
In file included from /home/testUser/iot/legatoAF/legato/framework/liblegato/linux/addr.c:9:0:
/home/testUser/iot/legatoAF/legato/framework/include/legato.h:146:20: fatal error: unistd.h: No such file or directory
 #include <unistd.h>
                    ^
compilation terminated.
[10/52] Compiling liblegato source file
FAILED: /opt/swi/y22-ext-wp750x/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -MMD -MF /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/atomFile.c.o.d -c /home/testUser/iot/legatoAF/legato/framework/liblegato/linux/atomFile.c -o /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/atomFile.c.o -Wall -Werror -DLEGATO_EMBEDDED -fPIC -I/home/testUser/iot/legatoAF/legato/framework/daemons/linux -g -O2 -fno-omit-frame-pointer -I/home/testUser/iot/legatoAF/legato/framework/liblegato/linux -DLE_COMPONENT_NAME=framework -I/home/testUser/iot/legatoAF/legato/framework/include -I/home/testUser/iot/legatoAF/legato/framework/liblegato -DDISABLE_SMACK=0 -DLE_SVCDIR_SERVER_SOCKET_NAME="\"/tmp/legato/serviceDirectoryServer\"" -DLE_SVCDIR_CLIENT_SOCKET_NAME="\"/tmp/legato/serviceDirectoryClient\"" 
In file included from /home/testUser/iot/legatoAF/legato/framework/liblegato/linux/atomFile.c:24:0:
/home/testUser/iot/legatoAF/legato/framework/include/legato.h:146:20: fatal error: unistd.h: No such file or directory
 #include <unistd.h>
                    ^
compilation terminated.
[10/52] Compiling liblegato source file
FAILED: /opt/swi/y22-ext-wp750x/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -MMD -MF /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/doublyLinkedList.c.o.d -c /home/testUser/iot/legatoAF/legato/framework/liblegato/doublyLinkedList.c -o /home/testUser/iot/legatoAF/legato/build/wp750x/framework/obj/doublyLinkedList.c.o -Wall -Werror -DLEGATO_EMBEDDED -fPIC -I/home/testUser/iot/legatoAF/legato/framework/daemons/linux -g -O2 -fno-omit-frame-pointer -I/home/testUser/iot/legatoAF/legato/framework/liblegato/linux -DLE_COMPONENT_NAME=framework -I/home/testUser/iot/legatoAF/legato/framework/include -I/home/testUser/iot/legatoAF/legato/framework/liblegato -DDISABLE_SMACK=0 -DLE_SVCDIR_SERVER_SOCKET_NAME="\"/tmp/legato/serviceDirectoryServer\"" -DLE_SVCDIR_CLIENT_SOCKET_NAME="\"/tmp/legato/serviceDirectoryClient\"" 
In file included from /home/testUser/iot/legatoAF/legato/framework/liblegato/doublyLinkedList.c:6:0:
/home/testUser/iot/legatoAF/legato/framework/include/legato.h:146:20: fatal error: unistd.h: No such file or directory
 #include <unistd.h>
                    ^
compilation terminated.
ninja: build stopped: subcommand failed.
Makefile.framework:131: recipe for target 'liblegato' failed
make[1]: *** [liblegato] Error 1
make[1]: Leaving directory '/home/testUser/iot/legatoAF/legato'
Makefile:282: recipe for target 'framework_wp750x' failed
make: *** [framework_wp750x] Error 2

I don’t see problem in compiling Legato 18.04 with “make 750x”.
Probably you have used the wrong toolchain.
On my PC, I am using :

WP750X_TOOLCHAIN_DIR="/opt/swi/y17-ext/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi"
WP750X_TOOLCHAIN_PREFIX=“arm-poky-linux-gnueabi-”

root@testUser:/opt/swi# ls
y22-ext_SWI9X07Y_02.14.04.00  y22-ext-wp750x


root@testUser-P55A-UD3P:/home/testUser/iot/legatoAF/legato# ./bin/legs
Using legato framework found under '/home/testUser/iot/legatoAF/legato/.'
root@testUser-P55A-UD3P:/home/testUser/iot/legatoAF/legato# source /home/testUser/iot/legatoAF/legato/./framework/tools/scripts/configlegatoenv
[ar7] No toolchain found for target 'ar7'.
[ar86] No toolchain found for target 'ar86'.
[wp85] No toolchain found for target 'wp85'.
[wp750x] Toolchain dir[/opt/swi/y22-ext-wp750x/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi] prefix[arm-poky-linux-gnueabi-]
[wp76xx] No toolchain found for target 'wp76xx'.
[wp77xx] No toolchain found for target 'wp77xx'.
[ar758x] No toolchain found for target 'ar758x'.
[ar759x] No toolchain found for target 'ar759x'.
[virt] No toolchain found for target 'virt'.
root@testUser-P55A-UD3P:/home/testUser/iot/legatoAF/legato# exec <> /dev/tty

I use :

poky-swi-ext-glibc-x86_64-meta-toolchain-swi-ext-armv7a-vfp-neon-toolchain-swi-ext-1.7.3.sh

Do you have correct link to toolchain for WP7502 if this is not correct ?

I used /y17-ext/ and you are using /y22-ext/, seems this is the difference.

Maybe you can have a try on the R15 toolchain here (although it is for legato 16.10.04).

https://source.sierrawireless.com/resources/airprime/software/wpx5xx/wpx5xx-firmware-release-15-components/

R15 toolchain should work, although it is still yocto 1.7.

Few changes to come for next releases:

  • Yocto 2.2
  • Toolchain version is in the name of the toolchain

I added path and set toolchain but both y22-ext-wp750x and y17-ext are same soft link to y22-ext_SWI9X07Y_02.14.04.00

root@testUser:/opt/swi# ls
y17-ext
y22-ext_SWI9X07Y_02.14.04.00
y22-ext-wp750x

and it worked somehow

This time I used mangOH SDK but it first compile legato and then generate update to use.
I could update board to 18.04 legato version