ARMmbed / mbed-os

Arm Mbed OS is a platform operating system designed for the internet of things
https://mbed.com
Other
4.67k stars 2.98k forks source link

mbed_lib.json conflicts when compiling for a binary application #3209

Closed motgon01 closed 7 years ago

motgon01 commented 7 years ago

Description

mbed CLI tool copies *.json*, .a** files and potentially some other stuff that is given in --source <path>


Bug

Target K64F

Toolchain: GCC_ARM|ARM

Toolchain version: 4.9.3

mbed-cli version: 0.9.5

meed-os sha: 56f60a0

Steps to reproduce

  1. Compile mbed-os as a static library (using --build libmbed-os)
  2. Compile mbed-client as a static library (using --build libmbed-client)
  3. Compile some foo application that has a single main.cpp (prints hello world or something) and uses --source libmbed-os and --source libmbed-client when compiling, e.g.:

mbed compile -j1 --build .build-foo -t GCC_ARM -m K64F --artifact-name foo -v --source .build-libmbed-os --source .build-libmbed-client -v

Expected behavior foo application should cleanly compile

Actual behavior ConfigException: Library name 'mbed-os' is not unique (defined in '.build-libmbed-os/mbed_lib.json' and '.build-libmbed-client/mbed_lib.json')

@jenia81 @screamerbg @bridadan

bridadan commented 7 years ago

@mottigondabi So to be clear, this is what your project looks like from a shared parent directory:

/mbed-os            # cloned from https://github.com/ARMmbed/mbed-os
/mbed-client        # cloned from https://github.com/ARMmbed/mbed-client
/foo                # your own project

Then you do the following steps:

  1. cd mbed-os
  2. mbed compile --library --build .libmbed-os ...
  3. cd ../mbed-client
  4. mbed compile --library --build .libmbed-client ...
  5. cd ../foo
  6. mbed compile --source ../mbed-os/.libmbed-os --source ../mbed-client/.libmbed-client --source .

And this gives you the following Exception: ConfigException: Library name 'mbed-os' is not unique (defined in '.build-libmbed-os/mbed_lib.json' and '.build-libmbed-client/mbed_lib.json')

Is this correct?

theotherjimmy commented 7 years ago

I take issue with the expected behavior: you are including the mbed and its compiled form twice (as liblmbed-os and as part of limbed-client), so you should get an error like Library name 'mbed-os' is not unique

0xc0170 commented 7 years ago

@mottigondabi Is this still an issue?

bridadan commented 7 years ago

@mottigondabi bump #2, any update?

motgon01 commented 7 years ago

No. Issue is closed.

bqam-ublox commented 7 years ago

This is usually due to another folder copied inside mbed os which contains a library with the same name as in mbed os due to which there is a conflict. Delete the already created library and it would build again. Its better to build it outside mbed os to avoid such issues using --build =