How to do a local build?

ulsoulso Stockholm

I would like to do a local build using "mos build --local --arch CC3200" but I can't find any docs on how to do it. I'm on a Mac and have installed docker via "brew install docker".
When I try the "mos build --local" command, it complains about not finding a running docker instance.
I guess I have to start docker with some docker image, but where do I find the image?
Any detailed documentation on this somewhere?


  • SergeySergey Dublin, Ireland
    edited March 15

    Well, there is not much to add to that,
    you need to have docker installed to run local builds - the rest is pretty much the same as for the remote build.

    E.g. when building mongoose-os examples, I do:

    mos build --local --repo ../../.. --verbose
  • ulsoulso Stockholm

    Ok. So, I issued the following command while being in the mjs_base example directory:
    mos build --local --arch cc3200 --repo ../../.. --verbose

    I then got the following message:

    docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
    See 'docker run --help'.
    make: *** [all] Error 125
    Error: exit status 2
  • SergeySergey Dublin, Ireland

    Please refer to the docker docs on how to run docker.

    Run a docker terminal, that has docker environment set up for you?

  • ulsoulso Stockholm

    I have searched the docker docs but unfortunately I'm no wiser.

    So, the following command:

    mos build --local --arch cc3200 --repo ../../.. --verbose

    Results in the following response:

    Using mongoose-os located at "../../.."
    The flag --module is not given for the module "mjs", going to use the repository
    Make arguments: -j -f ../../../fw/platforms/cc3200/Makefile PLATFORM=cc3200 BUILD_DIR=build/objs FS_STAGING_DIR=build/fs FFI_SYMBOLS=fclose fopen fread free fwrite malloc strdup get_led_gpio_pin get_cfg mg_send mg_time mgos_adc_read mgos_add_http_endpoint mgos_aws_shadow_set_state_handler_simple mgos_aws_shadow_update_simple mgos_bind mgos_bind_http mgos_bitbang_write_bits_js mgos_connect mgos_connect_http mgos_connect_http_ssl mgos_conf_find_schema_entry mgos_conf_value_type mgos_conf_value_string mgos_conf_value_int mgos_disconnect mgos_get_free_heap_size mgos_get_heap_size mgos_get_http_message_param mgos_get_sys_http_server mgos_gpio_* mgos_i2c_* mgos_mqtt_pub mgos_mqtt_sub mgos_peek mgos_set_timer mgos_system_restart mgos_usleep remove mgos_rpc_add_handler mgos_rpc_send_response mg_rpc_call sys_config_schema APP_CONF_SCHEMA=src/conf_schema.yaml FW_DIR=build/fw APP_MODULES=src mjs MGOS_ENABLE_AWS_SHADOW=1 SSL=mbedTLS GEN_DIR=build/gen APP_FS_PATH=fs MGOS_ENABLE_MQTT=1 APP=mjs_base APP_VERSION=1.0 MGOS_PATH=../../..
    docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
    See 'docker run --help'.
    make: *** [all] Error 125
    Error: exit status 2

    I don't understand the complaint about the missing --module flag for "mjs". Doing a mos help build reveals nothing about a --module command line switch.

    Just to see what's going on, and see what the docker command line looks like, I modified the fw/ file by adding a few "echo" lines like this:

    all clean menuconfig:
        echo "--- Docker command here ---"
        echo @docker run --rm -i --tty=$T \
          -v $(APP_MOUNT_PATH):$(DOCKER_APP_PATH) \
          -v $(MGOS_PATH_ABS):$(DOCKER_MGOS_PATH) \
          -v $(MGOS_PATH_ABS):$(MGOS_PATH_ABS) \
          $(DOCKER_USER_ARG) \
          $(DOCKER_EXTRA) $(SDK_VERSION) \
          /bin/bash -c "\
            nice $(MAKE_CMD) \
          echo "--- End of docker command ---"

    and the got the following response:

    --- Docker command here ---
    @docker run --rm -i --tty=false -v /Users/ulf/Documents/Projects/mongoose/mongoose-os:/app -v /Users/ulf/Documents/Projects/mongoose/mongoose-os:/mongoose-os -v /Users/ulf/Documents/Projects/mongoose/mongoose-os:/Users/ulf/Documents/Projects/mongoose/mongoose-os /bin/bash -c     nice make -j4 -C /app/fw/examples/mjs_base -f /mongoose-os/fw/platforms/cc3200/ - --warn-undefined-variables -sj -- SSL=mbedTLS MGOS_PATH=../../.. APP_FS_PATH=fs APP_MODULES=src\ mjs BUILD_DIR=build/objs APP=mjs_base GEN_DIR=build/gen MGOS_ENABLE_MQTT=1 FW_DIR=build/fw MGOS_ENABLE_AWS_SHADOW=1 APP_CONF_SCHEMA=src/conf_schema.yaml APP_VERSION=1.0 PLATFORM=cc3200 FS_STAGING_DIR=build/fs FFI_SYMBOLS=fclose\ fopen\ fread\ free\ fwrite\ malloc\ strdup\ get_led_gpio_pin\ get_cfg\ mg_send\ mg_time\ mgos_adc_read\ mgos_add_http_endpoint\ mgos_aws_shadow_set_state_handler_simple\ mgos_aws_shadow_update_simple\ mgos_bind\ mgos_bind_http\ mgos_bitbang_write_bits_js\ mgos_connect\ mgos_connect_http\ mgos_connect_http_ssl\ mgos_conf_find_schema_entry\ mgos_conf_value_type\ mgos_conf_value_string\ mgos_conf_value_int\ mgos_disconnect\ mgos_get_free_heap_size\ mgos_get_heap_size\ mgos_get_http_message_param\ mgos_get_sys_http_server\ mgos_gpio_*\ mgos_i2c_*\ mgos_mqtt_pub\ mgos_mqtt_sub\ mgos_peek\ mgos_set_timer\ mgos_system_restart\ mgos_usleep\ remove\ mgos_rpc_add_handler\ mgos_rpc_send_response\ mg_rpc_call\ sys_config_schema APP=mjs_base APP_VERSION=1.0 APP_BUILD_ID= MGOS_PATH=/mongoose-os PLATFORM=cc3200 all   
    --- End of docker command ---

    If I do a docker version, I get:

     Version:      17.03.0-ce
     API version:  1.26
     Go version:   go1.8
     Git commit:   60ccb22
     OS/Arch:      darwin/amd64
    Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
  • ulsoulso Stockholm

    Problem solved. After uninstalling the homebrew version of docker and installing docker from the Docker website, build --local works fine.

  • SergeySergey Dublin, Ireland
    edited March 17

    awesome, thanks Ulf!

Sign In or Register to comment.