lancaster-university / microbit-dal

http://lancaster-university.github.io/microbit-docs
Other
254 stars 130 forks source link

[Mbed] Cannot compile "microbit-hello-world" with Mbed CLI, fatal error in BLE_API #393

Closed yennster closed 4 years ago

yennster commented 5 years ago

Hi, I am trying to compile the "microbit-hello-world" example here: https://os.mbed.com/teams/BBC/code/microbit-hello-world/ with the Mbed CLI: mbed compile -t gcc_arm -m nrf51_microbit and I get the following error output:

$ mbed compile -t gcc_arm -m nrf51_microbit
Using targets from /Users/jenplu01/Repos/questions/microbit-hello-world/mbed/e95d10626187/targets.json
[Error] @,: Compiler version mismatch: Have 7.2.1; expected version >= 6.0.0 and < 7.0.0
Building project microbit-hello-world (NRF51_MICROBIT, GCC_ARM)
Scan: microbit-hello-world
Compile [  1.0%]: ble_radio_notification.c
Compile [  2.0%]: ble_dfu.c
[Fatal Error] BLEProtocol.h@22,10: algorithm: No such file or directory
[ERROR] In file included from ./microbit/microbit-dal/BLE_API/ble/Gap.h:20:0,
                 from ./microbit/microbit-dal/BLE_API/ble/ble.h:21,
                 from ./microbit/microbit-dal/nRF51822/nrf51-sdk/source/nordic_sdk/components/ble/ble_services/ble_dfu/ble_dfu.h:53,
                 from ./microbit/microbit-dal/nRF51822/nrf51-sdk/source/nordic_sdk/components/ble/ble_services/ble_dfu/ble_dfu.c:33:
./microbit/microbit-dal/BLE_API/ble/BLEProtocol.h:22:10: fatal error: algorithm: No such file or directory
 #include <algorithm>
          ^~~~~~~~~~~
compilation terminated.

[mbed] ERROR: "/usr/local/opt/python@2/bin/python2.7" returned error.
       Code: 1
       Path: "/Users/jenplu01/Repos/questions/microbit-hello-world"
       Command: "/usr/local/opt/python@2/bin/python2.7 -u /Users/jenplu01/Repos/questions/microbit-hello-world/.temp/tools/make.py -t gcc_arm -m nrf51_microbit --source . --build ./BUILD/NRF51_MICROBIT/GCC_ARM"
       Tip: You could retry the last command with "-v" flag for verbose output
---

Any tips on how I can resolve these errors? Thanks!

finneyj commented 5 years ago

hi @yennster

hmmm.. afraid I haven't tried building against mbed cli for a long time.

For offline development, most people are compiling this repo using the instructions here: https://lancaster-university.github.io/microbit-docs/offline-toolchains/

Anyone out there with a working mbed-cli build that can advise here?

DavidWhaleMEF commented 5 years ago

Looking at the error message, it seems you are using the wrong version of the compiler??

On 3 Oct 2018 10:06 am, Joe Finney notifications@github.com wrote:

hi @yennsterhttps://github.com/yennster

hmmm.. afraid I haven't tried building against mbed cli for a long time.

For offline development, most people are compiling this repo using the instructions here: https://lancaster-university.github.io/microbit-docs/offline-toolchains/

Anyone out there with a working mbed-cli build that can advise here?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/lancaster-university/microbit-dal/issues/393#issuecomment-426563930, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AX6vIhZ1iR_0GM28rNFLD037scmqXtEdks5uhH4VgaJpZM4XEtOo.

carlosperate commented 5 years ago

Previous discussion in the mbed-cli repo for more context: https://github.com/ARMmbed/mbed-cli/issues/327

yennster commented 5 years ago

@DavidWhaleMEF Using the wrong version of GCC_ARM?

yennster commented 5 years ago

@DavidWhaleMEF Oh I see, you're referring to the Mbed CLI warning: [Error] @,: Compiler version mismatch: Have 7.2.1; expected version >= 6.0.0 and < 7.0.0

I'll give another version a try then

toyowata commented 5 years ago

@yennster GCC reports the error because including C++ header file from C source code (ble_dfu.c). This should guard something like:

#ifdef __cplusplus
#include <algorithm>
#endif