Copyright © https://mongoose-os.com

Mongoose OS Forum

frame
ATTENTION! This forum has moved to:

https://community.mongoose-os.com

Do not post any new messages.

Compile project from outside of mongoose-iot repository

Hi.

I have the following file structure for my project
/home/project/Makefile
/home/project/Makefile.build
/home/project/src/*
/home/mongoose-iot/*

And with the latest version of mongoose I get errors when trying to build my project.
The mongoose examples compile fine.
Could you post a Makefile/Makefile.build that works for projects outside of the mongoose-iot tree.

Comments

  • rojerrojer Dublin, Ireland

    yes, we made a few changes recently exactly to improve out-of-tree builds.
    the only change is the addition of MIOT_PATH, which you point to where mongoose-iot is (possibly as a submodule) and you should be all set.
    i created a repo with our examples to demonstrate it - https://github.com/cesanta/mongoose-iot-examples

  • tsvetan.filevtsvetan.filev Sofia, Bulgaria
    edited September 2016

    I cloned mongoose-iot-examples and the folder mongoose-iot is linked to the latest mongoose-iot repository.

    But I get this:

    cat: /home/ceco/She/mongoose-iot-examples//home/ceco/She/m-iot/fw/platforms/cc3200/sdk.version: No such file or directory
    Unable to find image '/bin/bash:latest' locally
    repository name component must match "a-z0-9(?:[._]a-z0-9)*"
    ../mongoose-iot/fw/docker_common.mk:56: recipe for target 'all' failed
    make: *** [all] Error 1

    I had to copy the mongoose-iot repository to make it work.

  • tsvetan.filevtsvetan.filev Sofia, Bulgaria
    edited September 2016

    Here is my file structure:

    /home/ceco/cc3200/project/*
    /home/ceco/mongoose-iot/*

    My Makefile:

    APP = project
    MIOT_PATH = ../../mongoose-iot
    PLATFORM = cc3200
    APP_SLFS_PATH = $(CURDIR)/slfs
    SDK_PATH ?= /opt/cc3200-sdk

    include $(MIOT_PATH)/fw/platforms/$(PLATFORM)/Makefile

    My Makefile.build:

    APP = project
    PLATFORM = cc3200
    APP_MODULES = src src/AA-ST7735
    APP_EXTRA_SRCS = timer.c gpio.c
    APP_FS_PATH = $(CURDIR)/fs
    APP_CONF_DEFAULTS = $(APP_FS_PATH)/conf_app_defaults.json
    APP_SLFS_PATH = $(CURDIR)/slfs
    APP_CFLAGS = -DCS_DISABLE_JS -DSHSW_DEVICE=SHSW_CCDIN4
    FREEZE = 0
    SDK_PATH = /opt/cc3200-sdk

    SJ_ENABLE_JS = 0
    SJ_ENABLE_CLUBBY = 0

    MG_FEATURES = \
    -DMG_DISABLE_JSON_RPC \
    -DMG_DISABLE_SYNC_RESOLVER \
    -DMG_DISABLE_MD5 \
    -DMG_DISABLE_SOCKETPAIR \
    -DMG_DISABLE_HTTP_KEEP_ALIVE \
    -DMG_DISABLE_DAV_AUTH \
    -DMG_DISABLE_CGI \
    -DMG_DISABLE_SSI \
    -DMG_DISABLE_DAV \
    -DMG_ENABLE_HTTP_STREAMING_MULTIPART \
    -DMG_NO_BSD_SOCKETS \
    -DMG_LOCALS \
    -DMG_FS_SPIFFS \
    -DDISABLE_C_CLUBBY \
    -DMG_ENABLE_SSL

    include $(REPO_PATH)/fw/platforms/$(PLATFORM)/Makefile.build

    And the result is:

    pc:/home/ceco/cc3200/project # make clean
    cat: /home/ceco/cc3200//home/ceco/mongoose-iot/fw/platforms/cc3200/sdk.version: No such file or directory
    Unable to find image '/bin/bash:latest' locally
    repository name component must match "a-z0-9(?:[._]a-z0-9)*"
    ../../mongoose-iot/fw/docker_common.mk:56: recipe for target 'clean' failed
    make: *** [clean] Error 1

    I put the c_hello example in my fs structure and got the same error.

    What might be wrong ?

  • tsvetan.filevtsvetan.filev Sofia, Bulgaria
    edited September 2016

    It seems that when the project is outside of the cesanta repository there is a build error.
    In mongoose-iot-examples try to move mongoose-iot one folder up next to the mongoose-iot-examples folder and modify the c_hello Makefile like this
    MIOT_PATH = ../../mongoose-iot

    You will get an error !

    The problem is in mongoose-iot/fw/docker_common.mk:

    REPO_ABS_PATH = $(realpath $(REPO_PATH))
    MIOT_ABS_PATH = $(realpath $(MIOT_PATH))
    MIOT_REPO_SUBDIR = $(subst $(REPO_ABS_PATH),,$(MIOT_ABS_PATH))
    APP_ABS_PATH = $(CURDIR)
    APP_SUBDIR ?= $(subst $(REPO_ABS_PATH),,$(APP_ABS_PATH))

    MIOT_PLATFORM_SUBDIR = $(MIOT_REPO_SUBDIR)/fw/platforms/$(APP_PLATFORM)
    MIOT_PLATFORM_ABS_PATH = $(REPO_ABS_PATH)/$(MIOT_PLATFORM_SUBDIR)
    SDK_VERSION ?= $(shell cat $(MIOT_PLATFORM_ABS_PATH)/sdk.version)

  • Using mongoose-iot as a submodule in a parent repo used to not work -- common/tools/fw_meta.py failed, so we switched to using it from an external, sibling directory.

    We've switched back to mongoose-iot as a submodule which works nicely, and generates an informative build_info. Thanks.

  • tsvetan.filevtsvetan.filev Sofia, Bulgaria

    Yes we set it as a submodule and now all works fine.

Sign In or Register to comment.