Local library with remote build?

Is it possible to have a local library but do a remote build? I’m trying to create, at first, just an empty library and build it. I’m trying a remote build (mos --build).

I have followed the instructions for creating a new library:

https://mongoose-os.com/docs/mongoose-os/userguide/build.md#how-to-create-a-new-library

I did a local build to get the deps directory, which was then full of other directories. I removed all of them, then proceeded to create my own per the instructions.

When I build with:

mos --build

I get a failure (which I’ll link below).

I have added the library to my mos.yml file like this:

libs:
  - origin: https://github.com/mongoose-os-libs/boards
  - origin: https://github.com/mongoose-os-libs/ca-bundle
  - origin: https://github.com/mongoose-os-libs/rpc-service-config
  - origin: https://github.com/mongoose-os-libs/rpc-service-fs
  - origin: https://github.com/mongoose-os-libs/rpc-uart

  # JWA Test library
  - name: N2K

I have created both:

/deps/N2K/src/
/deps/N2K/include

And put the files in as documented. Is this something I can only do with a local build or should a remote build work?

Here is the build error:

https://pastebin.com/FAQCkFJC

Thanks very much…

I also tried creating a simple library on github, with an include directory, a src directory and a mos.yml file. The mos.yml file is at the same level as the src and include directories. It seems that the build process can access the library on github but perhaps not read the files… Still trying to figure out why:

Handling lib "rpc-service-fs"...
Handling lib "rpc-service-config"...
Handling lib "mgos_n2k_lib"...
Handling lib "zz_boards"...
Handling lib "rpc-uart"...
Handling lib "ca-bundle"...
Handling lib "core"...
rpc-service-fs: Does not exist, cloning from "https://github.com/mongoose-os-libs/rpc-service-fs"...
rpc-service-config: Does not exist, cloning from "https://github.com/mongoose-os-libs/rpc-service-config"...
rpc-uart: Does not exist, cloning from "https://github.com/mongoose-os-libs/rpc-uart"...
ca-bundle: Does not exist, cloning from "https://github.com/mongoose-os-libs/ca-bundle"...
core: Does not exist, cloning from "https://github.com/mongoose-os-libs/core"...
mgos_n2k_lib: Checking out master...
zz_boards: Checking out 2.15.0...
zz_boards: Done, hash 897a76f9b7306751dea4596f38df4486548ae2da
zz_boards: Hash unchanged at 897a76f9b7306751dea4596f38df4486548ae2da (dir "/data/fwbuild-volumes/2.15.0/apps/N2K-Test-App/esp32/build_contexts/build_ctx_122030958/deps/boards")
zz_boards: Prepared local dir: "/data/fwbuild-volumes/2.15.0/apps/N2K-Test-App/esp32/build_contexts/build_ctx_122030958/deps/boards"
mgos_n2k_lib: Done, hash 6a316b85214bff4a12e12032123bed2c9c64bf11
mgos_n2k_lib: Hash unchanged at 6a316b85214bff4a12e12032123bed2c9c64bf11 (dir "/data/fwbuild-volumes/2.15.0/apps/N2K-Test-App/esp32/build_contexts/build_ctx_122030958/deps/mgos_n2k_lib")
mgos_n2k_lib: Prepared local dir: "/data/fwbuild-volumes/2.15.0/apps/N2K-Test-App/esp32/build_contexts/build_ctx_122030958/deps/mgos_n2k_lib"
Error: open /data/fwbuild-volumes/2.15.0/apps/N2K-Test-App/esp32/build_contexts/build_ctx_122030958/deps/mgos_n2k_lib/mos.yml: no such file or directory
/go/src/github.com/mongoose-os/mos/mos/manifest_parser/manifest_parser.go:929: reading manifest "/data/fwbuild-volumes/2.15.0/apps/N2K-Test-App/esp32/build_contexts/build_ctx_122030958/deps/mgos_n2k_lib/mos.yml"
/go/src/github.com/mongoose-os/mos/mos/manifest_parser/manifest_parser.go:836: 
/go/src/github.com/mongoose-os/mos/mos/manifest_parser/manifest_parser.go:615: 
/go/src/github.com/mongoose-os/mos/mos/manifest_parser/manifest_parser.go:784: 
/go/src/github.com/mongoose-os/mos/mos/manifest_parser/manifest_parser.go:698: 
/go/src/github.com/mongoose-os/mos/mos/manifest_parser/manifest_parser.go:479: 
/go/src/github.com/mongoose-os/mos/mos/manifest_parser/manifest_parser.go:150: 
/go/src/github.com/mongoose-os/mos/mos/build_local.go:144: 
/go/src/github.com/mongoose-os/mos/mos/build.go:223: 
/go/src/github.com/mongoose-os/mos/mos/build.go:166: 
/go/src/github.com/mongoose-os/mos/mos/main.go:196: build failed

The log for the remote build says that mgos_N2K.h does not exist.

/data/fwbuild-volumes/2.15.0/apps/N2K-Test-App/esp32/build_contexts/build_ctx_122030958/deps/N2K/src/N2K_lib.c:1:22: fatal error: mgos_N2K.h: No such file or directory
compilation terminated.

The mos.yml of the empty lib does not have a includes: directive. Either add it to your library’s mos.yml, or move mgos_N2K.h in the src directory. It should work either way.

Using the default mos.yml of the empty lib the layout is:

ls -R deps/
N2K

deps//N2K:
LICENSE   README.md mos.yml   src

deps//N2K/src:
mgos_N2K.c mgos_N2K.h

The git version is here

Thanks!!! I have it working now.

Well, I sort of had it working. When I put a bunch of cpp files in the src directory and a bunch of h files in the include directory and did a build, the h files included from the cpp files are not found. The sample c and h files I put in the library work. The h files are included with double quotes. What could cause this?

Solved - Apparently it didn’t like my repository name starting with mgos_