Arduino not finding library 2

Hello,

I have a very frustrating problem, as the title says: Arduino cannot find the library...

I have read this thread: Arduino not finding library - Programming Questions - Arduino Forum
but it does not solve my issue.

Arduino placed under [user]\Downloads\Arduino.
Ssketch running from [user]\Documents\Arduino\STM32F4_blink\STM32F4_blink.ino
STM32 files from: [user]\Documents\Arduino\hardware\Arduino_STM32, where there is one \STM32F1\ and one \STM32F4\ subfolder, respectively.
Each family (F1 and F4) has a core, a library and a variant subfolder.
There is an identical SPI library in both \libraries\SPI\src\ subfolders, with identical named .cpp and .h files.
Both platforms are almost identical, the difference is only due to the M3 and M4 core difference.

Now, when building the same empty sketch where I add "#include <SPI.h>, if I chose one F1 variant, the SPI library will be recognized by Arduino:

C:\Users\[user]\Downloads\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Users\[user]\Downloads\Arduino\hardware -hardware C:\Users\[user]\AppData\Local\Arduino15\packages -hardware C:\Users\[user]\Documents\Arduino\hardware -tools C:\Users\[user]\Downloads\Arduino\tools-builder -tools C:\Users\[user]\Downloads\Arduino\hardware\tools\avr -tools C:\Users\[user]\AppData\Local\Arduino15\packages -built-in-libraries C:\Users\[user]\Downloads\Arduino\libraries -libraries C:\Users\[user]\Documents\Arduino\libraries -fqbn=Arduino_STM32:STM32F1:genericSTM32F103C:device_variant=STM32F103CB,upload_method=DFUUploadMethod,cpu_speed=speed_72mhz -ide-version=10612 -build-path C:\Users\[user]\AppData\Local\Temp\arduino_build_793233 -warnings=default -prefs=build.warn_data_percentage=75 -verbose C:\Users\[user]\Documents\Arduino\STM32F4_blink\STM32F4_blink.ino
C:\Users\[user]\Downloads\Arduino\arduino-builder -compile -logger=machine -hardware C:\Users\[user]\Downloads\Arduino\hardware -hardware C:\Users\[user]\AppData\Local\Arduino15\packages -hardware C:\Users\[user]\Documents\Arduino\hardware -tools C:\Users\[user]\Downloads\Arduino\tools-builder -tools C:\Users\[user]\Downloads\Arduino\hardware\tools\avr -tools C:\Users\[user]\AppData\Local\Arduino15\packages -built-in-libraries C:\Users\[user]\Downloads\Arduino\libraries -libraries C:\Users\[user]\Documents\Arduino\libraries -fqbn=Arduino_STM32:STM32F1:genericSTM32F103C:device_variant=STM32F103CB,upload_method=DFUUploadMethod,cpu_speed=speed_72mhz -ide-version=10612 -build-path C:\Users\[user]\AppData\Local\Temp\arduino_build_793233 -warnings=default -prefs=build.warn_data_percentage=75 -verbose C:\Users\[user]\Documents\Arduino\STM32F4_blink\STM32F4_blink.ino

Using board 'genericSTM32F103C' from platform in folder: C:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1
Using core 'maple' from platform in folder: C:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1

Detecting libraries used...
"C:\Users\[user]\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE  -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8002000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -w -x c++ -E -CC -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10612 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1  -DSERIAL_USB -DGENERIC_BOOTLOADER -DMCU_STM32F103CB  -mthumb  -march=armv7-m -D__STM32F1__ -DMCU_STM32F103CB  -mthumb  -march=armv7-m -D__STM32F1__ "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/include" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/stm32f1/include" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/stm32f1" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/usb_lib" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\cores\maple" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c" "C:\Users\[user]\AppData\Local\Temp\arduino_build_793233\sketch\STM32F4_blink.ino.cpp" -o "nul"
"C:\Users\[user]\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE  -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8002000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -w -x c++ -E -CC -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10612 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1  -DSERIAL_USB -DGENERIC_BOOTLOADER -DMCU_STM32F103CB  -mthumb  -march=armv7-m -D__STM32F1__ -DMCU_STM32F103CB  -mthumb  -march=armv7-m -D__STM32F1__ "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/include" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/stm32f1/include" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/stm32f1" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/usb_lib" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\cores\maple" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\SPI\src" "C:\Users\[user]\AppData\Local\Temp\arduino_build_793233\sketch\STM32F4_blink.ino.cpp" -o "nul"
"C:\Users\[user]\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE  -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8002000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -w -x c++ -E -CC -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10612 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1  -DSERIAL_USB -DGENERIC_BOOTLOADER -DMCU_STM32F103CB  -mthumb  -march=armv7-m -D__STM32F1__ -DMCU_STM32F103CB  -mthumb  -march=armv7-m -D__STM32F1__ "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/include" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/stm32f1/include" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/stm32f1" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\system/libmaple/usb/usb_lib" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\cores\maple" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\variants\generic_stm32f103c" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\SPI\src" "C:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\SPI\src\SPI.cpp" -o "nul"

Generating function prototypes...
  • t.b.c. -

[continued]

When I choose one F4 variant, the SPI library will not be recognized:

C:\Users\[user]\Downloads\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Users\[user]\Downloads\Arduino\hardware -hardware C:\Users\[user]\AppData\Local\Arduino15\packages -hardware C:\Users\[user]\Documents\Arduino\hardware -tools C:\Users\[user]\Downloads\Arduino\tools-builder -tools C:\Users\[user]\Downloads\Arduino\hardware\tools\avr -tools C:\Users\[user]\AppData\Local\Arduino15\packages -built-in-libraries C:\Users\[user]\Downloads\Arduino\libraries -libraries C:\Users\[user]\Documents\Arduino\libraries -fqbn=Arduino_STM32:STM32F4:generic_f407v:usb_cfg=usb_serial -ide-version=10612 -build-path C:\Users\[user]\AppData\Local\Temp\arduino_build_52489 -warnings=default -prefs=build.warn_data_percentage=75 -verbose C:\Users\[user]\Documents\Arduino\STM32F4_blink\STM32F4_blink.ino
C:\Users\[user]\Downloads\Arduino\arduino-builder -compile -logger=machine -hardware C:\Users\[user]\Downloads\Arduino\hardware -hardware C:\Users\[user]\AppData\Local\Arduino15\packages -hardware C:\Users\[user]\Documents\Arduino\hardware -tools C:\Users\[user]\Downloads\Arduino\tools-builder -tools C:\Users\[user]\Downloads\Arduino\hardware\tools\avr -tools C:\Users\[user]\AppData\Local\Arduino15\packages -built-in-libraries C:\Users\[user]\Downloads\Arduino\libraries -libraries C:\Users\[user]\Documents\Arduino\libraries -fqbn=Arduino_STM32:STM32F4:generic_f407v:usb_cfg=usb_serial -ide-version=10612 -build-path C:\Users\[user]\AppData\Local\Temp\arduino_build_52489 -warnings=default -prefs=build.warn_data_percentage=75 -verbose C:\Users\[user]\Documents\Arduino\STM32F4_blink\STM32F4_blink.ino

Using board 'generic_f407v' from platform in folder: C:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F4
Using core 'maple' from platform in folder: C:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F4

Detecting libraries used...
"C:\Users\[user]\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++" -c -g -Os -Wall  -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_f407v -DVECT_TAB_BASE -DERROR_LED_PORT=GPIOA -DERROR_LED_PIN=7 -w -x c++ -E -CC -mcpu=cortex-m4 -DF_CPU=168000000L -DARDUINO=10612 -DARDUINO_STM32GenericF407VET6 -DARDUINO_ARCH_STM32F4  -mthumb -DSTM32_HIGH_DENSITY -DSTM32F4 -DBOARD_generic_f407v -DSERIAL_USB  -mthumb -D__STM32F4__ "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4/STM32_USB_Device_Library/Core/inc" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4/STM32_USB_Device_Library/Class/cdc/inc" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4/STM32_USB_OTG_Driver/inc" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple/libmaple/usbF4/VCP" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F4\cores\maple" "-IC:\Users\[user]\Documents\Arduino\hardware\Arduino_STM32\STM32F4\variants\generic_f407v" "C:\Users\[user]\AppData\Local\Temp\arduino_build_52489\sketch\STM32F4_blink.ino.cpp" -o "nul"

Generating function prototypes...

Can anyone please guide me how can I make Arduino to recognize the SPI library for F4 as well?

EDIT
In this later case, the SPI lbrary will not be recognized even if I place it under [user]\Documents\Arduino\libraries\ folder...

In what folder do you have the IDE installed?
In what folder do you have your sketches?
In what folder do you have the libraries?

It looks to me like you have your sketches in the same folder as the IDE. That is not a good idea.

stevestrong:
Arduino placed under [user]\Downloads\Arduino.
Sketch running from [user]\Documents\Arduino\STM32F4_blink\STM32F4_blink.ino
STM32 files from: [user]\Documents\Arduino\hardware\Arduino_STM32, where there is one \STM32F1\ and one \STM32F4\ subfolder, respectively.
Each family (F1 and F4) has a core, a library and a variant subfolder.
There is an identical SPI library in both \libraries\SPI\src\ subfolders, with identical named .cpp and .h files.
Both platforms are almost identical, the difference is only due to the M3 and M4 core difference.

Is that the information you asked?

More information you can get from the build output message, I think from that is clear what Arduino is doing.

Is there a way to see more messages from Arduino when trying to detect libraries? A kind of verbose output?
I have searched the github sources to find out how exactly are the libraries detected but had no success.

Sketch running from [user]\Documents\Arduino\STM32F4_blink\STM32F4_blink.ino

And it appears that you have the IDE installed in [user]\Documents\Arduino.

Storing sketches in the IDE folder is not a good idea.