{"action":"created","issue":{"url":"https://api.github.com/repos/platformio/platform-ststm32/issues/113","repository_url":"https://api.github.com/repos/platformio/platform-ststm32","labels_url":"https://api.github.com/repos/platformio/platform-ststm32/issues/113/labels{/name}","comments_url":"https://api.github.com/repos/platformio/platform-ststm32/issues/113/comments","events_url":"https://api.github.com/repos/platformio/platform-ststm32/issues/113/events","html_url":"https://github.com/platformio/platform-ststm32/issues/113","id":327526169,"node_id":"MDU6SXNzdWUzMjc1MjYxNjk=","number":113,"title":"Installed library include paths being appended to framework compile","user":{"login":"MrSurly","id":395016,"node_id":"MDQ6VXNlcjM5NTAxNg==","avatar_url":"https://avatars2.githubusercontent.com/u/395016?v=4","gravatar_id":"","url":"https://api.github.com/users/MrSurly","html_url":"https://github.com/MrSurly","followers_url":"https://api.github.com/users/MrSurly/followers","following_url":"https://api.github.com/users/MrSurly/following{/other_user}","gists_url":"https://api.github.com/users/MrSurly/gists{/gist_id}","starred_url":"https://api.github.com/users/MrSurly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrSurly/subscriptions","organizations_url":"https://api.github.com/users/MrSurly/orgs","repos_url":"https://api.github.com/users/MrSurly/repos","events_url":"https://api.github.com/users/MrSurly/events{/privacy}","received_events_url":"https://api.github.com/users/MrSurly/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"valeros","id":886732,"node_id":"MDQ6VXNlcjg4NjczMg==","avatar_url":"https://avatars0.githubusercontent.com/u/886732?v=4","gravatar_id":"","url":"https://api.github.com/users/valeros","html_url":"https://github.com/valeros","followers_url":"https://api.github.com/users/valeros/followers","following_url":"https://api.github.com/users/valeros/following{/other_user}","gists_url":"https://api.github.com/users/valeros/gists{/gist_id}","starred_url":"https://api.github.com/users/valeros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/valeros/subscriptions","organizations_url":"https://api.github.com/users/valeros/orgs","repos_url":"https://api.github.com/users/valeros/repos","events_url":"https://api.github.com/users/valeros/events{/privacy}","received_events_url":"https://api.github.com/users/valeros/received_events","type":"User","site_admin":false},"assignees":[{"login":"valeros","id":886732,"node_id":"MDQ6VXNlcjg4NjczMg==","avatar_url":"https://avatars0.githubusercontent.com/u/886732?v=4","gravatar_id":"","url":"https://api.github.com/users/valeros","html_url":"https://github.com/valeros","followers_url":"https://api.github.com/users/valeros/followers","following_url":"https://api.github.com/users/valeros/following{/other_user}","gists_url":"https://api.github.com/users/valeros/gists{/gist_id}","starred_url":"https://api.github.com/users/valeros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/valeros/subscriptions","organizations_url":"https://api.github.com/users/valeros/orgs","repos_url":"https://api.github.com/users/valeros/repos","events_url":"https://api.github.com/users/valeros/events{/privacy}","received_events_url":"https://api.github.com/users/valeros/received_events","type":"User","site_admin":false}],"milestone":null,"comments":0,"created_at":"2018-05-29T23:53:58Z","updated_at":"2018-06-06T19:51:49Z","closed_at":null,"author_association":"NONE","body":"### Configuration\r\n\r\n**Operating system**: Ubuntu 18.04\r\n\r\n**PlatformIO Version** (`platformio --version`): PlatformIO, version 3.5.2\r\n\r\n### Description of problem\r\n\r\nAdding the `SX1276Lib` (2757) causes a compile error in the MBED framework.\r\n\r\n\r\n#### Steps to Reproduce\r\n\r\n1. `pio init --board disco_l072cz_lrwan1`\r\n2. `echo >>platformio.ini 'lib_deps=2757'`\r\n3. `echo >src/main.cpp 'int main() {}'`\r\n4. `pio run`\r\n\r\n### Actual Results\r\n\r\n```\r\n[Tue May 29 12:17:31 2018] Processing disco_l072cz_lrwan1 (platform: ststm32; board: disco_l072cz_lrwan1; framework: mbed)\r\n---------------------------------------------------------------------------------------------------------\r\nVerbose mode can be enabled via `-v, --verbose` option\r\nPLATFORM: ST STM32 > ST DISCO-L072CZ-LRWAN1\r\nSYSTEM: STM32L072CZ 32MHz 20KB RAM (192KB Flash)\r\nDEBUG: CURRENT(stlink) ON-BOARD(stlink) EXTERNAL(blackmagic, jlink)\r\nLibrary Dependency Finder -> http://bit.ly/configure-pio-ldf\r\nLDF MODES: FINDER(chain) COMPATIBILITY(light)\r\nCollected 16 compatible libraries\r\nScanning dependencies...\r\nDependency Graph\r\n|-- <SX1276Lib>\r\nCompiling .pioenvs/disco_l072cz_lrwan1/FrameworkMbedCore/drivers/FlashIAP.o\r\nCompiling .pioenvs/disco_l072cz_lrwan1/FrameworkMbedCore/drivers/InterruptManager.o\r\nCompiling .pioenvs/disco_l072cz_lrwan1/FrameworkMbedCore/drivers/MbedCRC.o\r\nCompiling .pioenvs/disco_l072cz_lrwan1/FrameworkMbedCore/drivers/RawSerial.o\r\nIn file included from /home/epoulsen/.platformio/packages/framework-mbed/platform/NonCopyable.h:21:0,\r\nfrom /home/epoulsen/.platformio/packages/framework-mbed/platform/PlatformMutex.h:26,\r\nfrom /home/epoulsen/.platformio/packages/framework-mbed/drivers/FlashIAP.h:29,\r\nfrom /home/epoulsen/.platformio/packages/framework-mbed/drivers/FlashIAP.cpp:26:\r\n/home/epoulsen/.platformio/packages/framework-mbed/platform/mbed_debug.h: In function 'void debug(const char*, ...)':\r\n/home/epoulsen/.platformio/packages/framework-mbed/platform/mbed_debug.h:40:20: error: redefinition of 'void debug(const char*, ...)'\r\nstatic inline void debug(const char *format, ...) {\r\n^~~~~\r\nIn file included from /home/epoulsen/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/7.2.1/bits/stl_algobase.h:69:0,\r\nfrom /home/epoulsen/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/7.2.1/algorithm:61,\r\nfrom /home/epoulsen/.platformio/packages/framework-mbed/drivers/FlashIAP.cpp:25:\r\n.piolibdeps/SX1276Lib_ID2757/debug/debug.h:56:20: note: 'void debug(const char*, ...)' previously defined here\r\nstatic inline void debug(const char *format, ...) {}\r\n^~~~~\r\n*** [.pioenvs/disco_l072cz_lrwan1/FrameworkMbedCore/drivers/FlashIAP.o] Error 1\r\n======================================= [ERROR] Took 0.79 seconds =======================================\r\n```\r\n\r\n### Expected Results\r\n\r\nError-free compilation.\r\n\r\n\r\n### If problems with PlatformIO Build System:\r\n\r\n**The content of `platformio.ini`:**\r\n```ini\r\n[env:disco_l072cz_lrwan1]\r\nplatform = ststm32\r\nboard = disco_l072cz_lrwan1\r\nframework = mbed\r\nlib_deps=2757\r\n```\r\n\r\n**Source file to reproduce issue:**\r\n```cpp\r\nint main() {}\r\n```\r\n\r\n### Additional info\r\n\r\nAlso posted this issue [here](https://community.platformio.org/t/sx1276lib-not-compatible-with-mbed-framework/4170). \r\n\r\nProblem seems to be that PIO will append _library_ include directories when compiling framework source code, which doesn't seem useful -- the framework shouldn't rely on library includes.\r\n\r\nAbbreviated command line:\r\n\r\n```bash\r\narm-none-eabi-g++ \\\r\n-o .pioenvs/disco_l072cz_lrwan1/FrameworkMbedCore/drivers/Serial.o \\\r\n<redacted> \\\r\n-I/home/epoulsen/.platformio/packages/framework-mbed \\\r\n<other includes> \\\r\n-I/home/epoulsen/.platformio/packages/framework-mbed/platformio/variants/DISCO_L072CZ_LRWAN1 \\\r\n-Isrc \\\r\n-I.piolibdeps/SX1276Lib_ID2757 \\\r\n/home/epoulsen/.platformio/packages/framework-mbed/drivers/Serial.cpp\r\n```\r\n\r\nSpecifically, this: `-I.piolibdeps/SX1276Lib_ID2757`\r\n\r\nFull command line:\r\n```bash\r\narm-none-eabi-g++ -o .pioenvs/disco_l072cz_lrwan1/FrameworkMbedCore/drivers/Serial.o -c -std=gnu++98 -fno-rtti -Wvla -mcpu=cortex-m0plus -mthumb -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -Os -DNDEBUG -g1 -include mbed_config.h -D__MBED__=1 -DDEVICE_I2CSLAVE=1 -DTARGET_LIKE_MBED -DDEVICE_PORTOUT=1 -DDEVICE_PORTINOUT=1 -D__MBED_CMSIS_RTOS_CM -DDEVICE_LOWPOWERTIMER=1 -DDEVICE_RTC=1 -DTOOLCHAIN_object -DDEVICE_SERIAL_ASYNCH=1 -D__CMSIS_RTOS -DMBED_BUILD_TIMESTAMP=1524075067.19 -DDEVICE_ANALOGOUT=1 -DTARGET_STM32L072CZ -DTOOLCHAIN_GCC -DTARGET_STM32L0 -DTARGET_CORTEX_M -DTARGET_M0P -DDEVICE_TRNG=1 -DTARGET_UVISOR_UNSUPPORTED -DTARGET_STM32L072xx -DDEVICE_SPI_ASYNCH=1 -DDEVICE_PWMOUT=1 -DDEVICE_INTERRUPTIN=1 -DTARGET_CORTEX -DDEVICE_I2C=1 -DTRANSACTION_QUEUE_SIZE_SPI=2 -D__CORTEX_M0PLUS -DDEVICE_STDIO_MESSAGES=1 -DTARGET_FF_MORPHO -DTARGET_FAMILY_STM32 -DTARGET_FF_ARDUINO -DTARGET_RELEASE -DTARGET_STM -DDEVICE_SERIAL_FC=1 -DTARGET_DISCO_L072CZ_LRWAN1 -DARM_MATH_CM0PLUS -DDEVICE_PORTIN=1 -DDEVICE_SLEEP=1 -DTOOLCHAIN_GCC_ARM -DDEVICE_SPI=1 -DDEVICE_SPISLAVE=1 -DDEVICE_ANALOGIN=1 -DDEVICE_SERIAL=1 -DDEVICE_FLASH=1 -DDEVICE_I2C_ASYNCH=1 -DTARGET_STM32L072xZ -DTARGET_LIKE_CORTEX_M0 -DSTM32L072xx -DPLATFORMIO=30502 -I/home/epoulsen/.platformio/packages/framework-mbed -I/home/epoulsen/.platformio/packages/framework-mbed/cmsis -I/home/epoulsen/.platformio/packages/framework-mbed/cmsis/TARGET_CORTEX_M -I/home/epoulsen/.platformio/packages/framework-mbed/drivers -I/home/epoulsen/.platformio/packages/framework-mbed/hal -I/home/epoulsen/.platformio/packages/framework-mbed/hal/storage_abstraction -I/home/epoulsen/.platformio/packages/framework-mbed/platform -I/home/epoulsen/.platformio/packages/framework-mbed/targets -I/home/epoulsen/.platformio/packages/framework-mbed/targets/TARGET_STM -I/home/epoulsen/.platformio/packages/framework-mbed/targets/TARGET_STM/TARGET_STM32L0 -I/home/epoulsen/.platformio/packages/framework-mbed/targets/TARGET_STM/TARGET_STM32L0/device -I/home/epoulsen/.platformio/packages/framework-mbed/targets/TARGET_STM/TARGET_STM32L0/TARGET_STM32L072xZ -I/home/epoulsen/.platformio/packages/framework-mbed/targets/TARGET_STM/TARGET_STM32L0/TARGET_STM32L072xZ/device -I/home/epoulsen/.platformio/packages/framework-mbed/targets/TARGET_STM/TARGET_STM32L0/TARGET_STM32L072xZ/device/TOOLCHAIN_GCC_ARM -I/home/epoulsen/.platformio/packages/framework-mbed/targets/TARGET_STM/TARGET_STM32L0/TARGET_STM32L072xZ/TARGET_DISCO_L072CZ_LRWAN1 -I/home/epoulsen/.platformio/packages/framework-mbed -I/home/epoulsen/.platformio/packages/framework-mbed/platformio/variants/DISCO_L072CZ_LRWAN1 -Isrc -I.piolibdeps/SX1276Lib_ID2757 /home/epoulsen/.platformio/packages/framework-mbed/drivers/Serial.cpp\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/platformio/platform-ststm32/issues/comments/395192416","html_url":"https://github.com/platformio/platform-ststm32/issues/113#issuecomment-395192416","issue_url":"https://api.github.com/repos/platformio/platform-ststm32/issues/113","id":395192416,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NTE5MjQxNg==","user":{"login":"valeros","id":886732,"node_id":"MDQ6VXNlcjg4NjczMg==","avatar_url":"https://avatars0.githubusercontent.com/u/886732?v=4","gravatar_id":"","url":"https://api.github.com/users/valeros","html_url":"https://github.com/valeros","followers_url":"https://api.github.com/users/valeros/followers","following_url":"https://api.github.com/users/valeros/following{/other_user}","gists_url":"https://api.github.com/users/valeros/gists{/gist_id}","starred_url":"https://api.github.com/users/valeros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/valeros/subscriptions","organizations_url":"https://api.github.com/users/valeros/orgs","repos_url":"https://api.github.com/users/valeros/repos","events_url":"https://api.github.com/users/valeros/events{/privacy}","received_events_url":"https://api.github.com/users/valeros/received_events","type":"User","site_admin":false},"created_at":"2018-06-06T19:51:49Z","updated_at":"2018-06-06T19:51:49Z","author_association":"MEMBER","body":"Hi @MrSurly! Actually, appending the library path is not the issue.\r\nHere are a few points that prevent this library from compiling correctly:\r\n1. The `SX1276Lib` library has the next path in its structure `debug/debug.h`. Unfortunately, this path is also used in one of the internal files from the GCC compiler (`stl_iterator_base_funcs.h:65` to be precise) and thus build system decided to pick this file instead of default one.\r\n2. Currently, PlatformIO build system has basic support for mbed libraries, especially for those that have an unusual source files structure, so some of them require additional modifications to be used with PlatformIO. For example, for this library, you need to add extra include paths to `library.json`\r\n\r\nSo, I'd recommend the next workaround:\r\n1. Rename file `debug/debug.h` to `debug/_debug.h` in the library folder.\r\n2. Add extra include paths to the `library.json` file\r\n```\r\n{\r\n    .... \r\n    \"repository\": {\r\n        \"type\": \"hg\",\r\n        \"url\": \"https://os.mbed.com/teams/Semtech/code/SX1276Lib/\"\r\n    },\r\n    \"build\": {\r\n        \"flags\": \"-Iradio -Ienums -Iregisters -Iregisters -Isx1276 -Itypedefs\"\r\n    }\r\n}\r\n```"}}
{"actor":{"display_login":"valeros"}}