Issue including "non-recognized" library

I always get confused how to include libraries which platformio doesn’t identify (Collected 0 compatible libraries)

Specifically, my folder structure is:

/
ext
ext/uGFX
src/PGESP-2/lib/uGFX -> symlink to /ext/uGFX
src/PGESP-2/src/main.cpp
src/PGESP-2/platformio.ini

I can’t get PIO to see uGFX. How can I? Apologies because I know I’ve probed about this kind of thing before, but I never can quite get it.

Interesting points:

  • uGFX has no library.json nor would it be practical for me to give it one
  • uGFX is a submodule checkout via git and it’s important it stay symlinked as presented
  • “Not seeing” in this context means main.cpp is unable to #include <gfx.h>, even though gfx.h is located within ext/uGFX

platformio.ini file is quite simple:

[env:esp32]
platform=espressif32
framework=espidf
board=lolin32
1 Like

Please provide tree -L3 src/PGESP-2/lib/uGFX

I get…

bash: tree: command not found, then tree: Invalid level, must be greater than 0.

Just kidding :slight_smile: useful response:

src/PGESP-2/lib/uGFX
├── 3rdparty
│   ├── fatfs-0.10b
│   │   ├── doc
│   │   └── src
│   ├── freetype-2.6.1
│   │   └── readme.txt
│   ├── petitfs-0.03
│   │   ├── doc
│   │   └── src
│   ├── readme.txt
│   ├── tinygl-0.4-ugfx
│   │   ├── BeOS
│   │   ├── Changelog
│   │   ├── config.mk
│   │   ├── examples
│   │   ├── include
│   │   ├── INSTALL
│   │   ├── LICENCE
│   │   ├── LIMITATIONS
│   │   ├── Makefile
│   │   ├── README
│   │   ├── README.BEOS
│   │   ├── README.uGFX
│   │   └── src
│   └── yaffs2
│       └── readme.txt
├── boards
│   ├── addons
│   │   ├── gdisp
│   │   └── ginput
│   └── base
│       ├── Altera-MAX10-Neek
│       ├── ArduinoTinyScreen
│       ├── eCos-Synthetic-Framebuffer
│       ├── Embest-STM32-DMSTF4BB
│       ├── FireBull-STM32F103-FB
│       ├── HY-MiniSTM32V
│       ├── Linux-Framebuffer
│       ├── Linux-Framebuffer-Touch
│       ├── Linux-SDL
│       ├── Linux-X
│       ├── Marlin
│       ├── Mikromedia-Plus-STM32-M4
│       ├── Mikromedia-STM32-M4-ILI9341
│       ├── Olimex-SAM7EX256-GE12
│       ├── Olimex-SAM7EX256-GE8
│       ├── Olimex-STM32-LCD
│       ├── OSX
│       ├── RaspberryPi
│       ├── STM32F429i-Discovery
│       ├── STM32F439i-Eval
│       ├── STM32F746-Discovery
│       └── Win32
├── changelog.txt
├── demos
│   ├── 3rdparty
│   │   ├── bubbles
│   │   ├── notepad-2
│   │   └── readme.txt
│   ├── applications
│   │   ├── combo
│   │   ├── mandelbrot
│   │   └── notepad
│   ├── benchmarks
│   │   ├── demo.mk
│   │   ├── gfxconf.h
│   │   └── main.c
│   ├── games
│   │   ├── justget10
│   │   ├── minesweeper
│   │   └── tetris
│   ├── modules
│   │   ├── gadc
│   │   ├── gaudio
│   │   ├── gdisp
│   │   ├── ginput
│   │   ├── gos
│   │   ├── gtimer
│   │   ├── gtrans
│   │   └── gwin
│   ├── readme.txt
│   └── tools
│       ├── touch_calibration_grabber
│       ├── touch_driver_test
│       ├── touch_raw_readings
│       └── uGFXnetDisplay
├── docs
│   ├── codingstyle.txt
│   ├── readme.txt
│   ├── rsc
│   │   ├── layout.xml
│   │   └── ugfx_logo_doxygen.png
│   └── src
│       ├── containers.dox
│       ├── main.dox
│       ├── widgets.dox
│       └── windows.dox
├── Doxygenfile
├── drivers
│   ├── gadc
│   │   └── AT91SAM7
│   ├── gaudio
│   │   ├── gadc
│   │   ├── pwm
│   │   ├── vs1053
│   │   └── Win32
│   ├── gdisp
│   │   ├── ED060SC4
│   │   ├── framebuffer
│   │   ├── HX8347D
│   │   ├── ILI9225
│   │   ├── ILI9320
│   │   ├── ILI9325
│   │   ├── ILI9341
│   │   ├── ILI9342
│   │   ├── ILI93xx
│   │   ├── ILI9481
│   │   ├── ILI9488
│   │   ├── LGDP4532
│   │   ├── Nokia6610GE12
│   │   ├── Nokia6610GE8
│   │   ├── PCD8544
│   │   ├── PCF8812
│   │   ├── QImage
│   │   ├── R61505U
│   │   ├── RA8875
│   │   ├── readme.txt
│   │   ├── S6D1121
│   │   ├── SPFD54124B
│   │   ├── SSD1289
│   │   ├── SSD1306
│   │   ├── SSD1331
│   │   ├── SSD1351
│   │   ├── SSD1848
│   │   ├── SSD1963
│   │   ├── SSD2119
│   │   ├── ST7565
│   │   ├── ST7735
│   │   ├── STM32LTDC
│   │   ├── TestStub
│   │   └── TLS8204
│   ├── ginput
│   │   ├── dial
│   │   ├── toggle
│   │   └── touch
│   └── multiple
│       ├── SDL
│       ├── uGFXnet
│       ├── uGFXnetESP8266
│       ├── Win32
│       └── X
├── ffconf.h
├── gfxconf.example.h
├── gfx.h
├── gfx.mk
├── license.html
├── mf_bwfont.h
├── mf_rlefont.h
├── mf_scaledfont.h
├── pffconf.h
├── readme.txt
├── src
│   ├── gadc
│   │   ├── gadc.c
│   │   ├── gadc_driver.h
│   │   ├── gadc.h
│   │   ├── gadc.mk
│   │   ├── gadc_mk.c
│   │   ├── gadc_options.h
│   │   └── gadc_rules.h
│   ├── gaudio
│   │   ├── gaudio.c
│   │   ├── gaudio_driver_play.h
│   │   ├── gaudio_driver_record.h
│   │   ├── gaudio.h
│   │   ├── gaudio.mk
│   │   ├── gaudio_mk.c
│   │   ├── gaudio_options.h
│   │   └── gaudio_rules.h
│   ├── gdisp
│   │   ├── fonts
│   │   ├── gdisp.c
│   │   ├── gdisp_colors.h
│   │   ├── gdisp_driver.h
│   │   ├── gdisp_fonts.c
│   │   ├── gdisp.h
│   │   ├── gdisp_image_bmp.c
│   │   ├── gdisp_image.c
│   │   ├── gdisp_image_gif.c
│   │   ├── gdisp_image.h
│   │   ├── gdisp_image_jpg.c
│   │   ├── gdisp_image_native.c
│   │   ├── gdisp_image_png.c
│   │   ├── gdisp_image_support.h
│   │   ├── gdisp.mk
│   │   ├── gdisp_mk.c
│   │   ├── gdisp_options.h
│   │   ├── gdisp_pixmap.c
│   │   ├── gdisp_pixmap.h
│   │   ├── gdisp_rules.h
│   │   └── mcufont
│   ├── gdriver
│   │   ├── gdriver.c
│   │   ├── gdriver.h
│   │   ├── gdriver.mk
│   │   ├── gdriver_mk.c
│   │   ├── gdriver_options.h
│   │   └── gdriver_rules.h
│   ├── gevent
│   │   ├── gevent.c
│   │   ├── gevent.h
│   │   ├── gevent.mk
│   │   ├── gevent_mk.c
│   │   ├── gevent_options.h
│   │   └── gevent_rules.h
│   ├── gfile
│   │   ├── gfile.c
│   │   ├── gfile_fatfs_diskio_chibios.c
│   │   ├── gfile_fatfs_wrapper.c
│   │   ├── gfile_fatfs_wrapper.h
│   │   ├── gfile_fs_chibios.c
│   │   ├── gfile_fs_fatfs.c
│   │   ├── gfile_fs.h
│   │   ├── gfile_fs_mem.c
│   │   ├── gfile_fs_native.c
│   │   ├── gfile_fs_petitfs.c
│   │   ├── gfile_fs_ram.c
│   │   ├── gfile_fs_rom.c
│   │   ├── gfile_fs_strings.c
│   │   ├── gfile.h
│   │   ├── gfile.mk
│   │   ├── gfile_mk.c
│   │   ├── gfile_options.h
│   │   ├── gfile_petitfs_diskio_chibios.c
│   │   ├── gfile_petitfs_wrapper.c
│   │   ├── gfile_petitfs_wrapper.h
│   │   ├── gfile_printg.c
│   │   ├── gfile_rules.h
│   │   ├── gfile_scang.c
│   │   └── gfile_stdio.c
│   ├── gfx.c
│   ├── gfx_compilers.h
│   ├── gfx_mk.c
│   ├── ginput
│   │   ├── ginput.c
│   │   ├── ginput_dial.c
│   │   ├── ginput_dial.h
│   │   ├── ginput_driver_dial.h
│   │   ├── ginput_driver_keyboard.h
│   │   ├── ginput_driver_mouse.h
│   │   ├── ginput_driver_toggle.h
│   │   ├── ginput.h
│   │   ├── ginput_keyboard.c
│   │   ├── ginput_keyboard.h
│   │   ├── ginput_keyboard_microcode.c
│   │   ├── ginput_keyboard_microcode.h
│   │   ├── ginput.mk
│   │   ├── ginput_mk.c
│   │   ├── ginput_mouse.c
│   │   ├── ginput_mouse.h
│   │   ├── ginput_options.h
│   │   ├── ginput_rules.h
│   │   ├── ginput_toggle.c
│   │   └── ginput_toggle.h
│   ├── gmisc
│   │   ├── gmisc_arrayops.c
│   │   ├── gmisc.c
│   │   ├── gmisc.h
│   │   ├── gmisc_hittest.c
│   │   ├── gmisc_matrix2d.c
│   │   ├── gmisc.mk
│   │   ├── gmisc_mk.c
│   │   ├── gmisc_options.h
│   │   ├── gmisc_rules.h
│   │   └── gmisc_trig.c
│   ├── gos
│   │   ├── gos_arduino.c
│   │   ├── gos_arduino.h
│   │   ├── gos_chibios.c
│   │   ├── gos_chibios.h
│   │   ├── gos_cmsis.c
│   │   ├── gos_cmsis.h
│   │   ├── gos_ecos.c
│   │   ├── gos_ecos.h
│   │   ├── gos_freertos.c
│   │   ├── gos_freertos.h
│   │   ├── gos.h
│   │   ├── gos_keil.h
│   │   ├── gos_linux.c
│   │   ├── gos_linux.h
│   │   ├── gos.mk
│   │   ├── gos_mk.c
│   │   ├── gos_nios.c
│   │   ├── gos_nios.h
│   │   ├── gos_options.h
│   │   ├── gos_osx.c
│   │   ├── gos_osx.h
│   │   ├── gos_qt.cpp
│   │   ├── gos_qt.h
│   │   ├── gos_raw32.c
│   │   ├── gos_raw32.h
│   │   ├── gos_rawrtos.c
│   │   ├── gos_rawrtos.h
│   │   ├── gos_rules.h
│   │   ├── gos_win32.c
│   │   ├── gos_win32.h
│   │   ├── gos_x_heap.c
│   │   ├── gos_x_heap.h
│   │   ├── gos_x_threads.c
│   │   ├── gos_x_threads_cortexm01.h
│   │   ├── gos_x_threads_cortexm347.h
│   │   ├── gos_x_threads_cortexm47fp.h
│   │   └── gos_x_threads.h
│   ├── gqueue
│   │   ├── gqueue.c
│   │   ├── gqueue.h
│   │   ├── gqueue.mk
│   │   ├── gqueue_mk.c
│   │   ├── gqueue_options.h
│   │   └── gqueue_rules.h
│   ├── gtimer
│   │   ├── gtimer.c
│   │   ├── gtimer.h
│   │   ├── gtimer.mk
│   │   ├── gtimer_mk.c
│   │   ├── gtimer_options.h
│   │   └── gtimer_rules.h
│   ├── gtrans
│   │   ├── gtrans.c
│   │   ├── gtrans.h
│   │   ├── gtrans.mk
│   │   ├── gtrans_mk.c
│   │   ├── gtrans_options.h
│   │   └── gtrans_rules.h
│   └── gwin
│       ├── gwin_button.c
│       ├── gwin_button.h
│       ├── gwin.c
│       ├── gwin_checkbox.c
│       ├── gwin_checkbox.h
│       ├── gwin_class.h
│       ├── gwin_console.c
│       ├── gwin_console.h
│       ├── gwin_container.c
│       ├── gwin_container.h
│       ├── gwin_frame.c
│       ├── gwin_frame.h
│       ├── gwin_gl3d.c
│       ├── gwin_gl3d.h
│       ├── gwin_graph.c
│       ├── gwin_graph.h
│       ├── gwin.h
│       ├── gwin_image.c
│       ├── gwin_image.h
│       ├── gwin_keyboard.c
│       ├── gwin_keyboard.h
│       ├── gwin_keyboard_layout.c
│       ├── gwin_keyboard_layout.h
│       ├── gwin_label.c
│       ├── gwin_label.h
│       ├── gwin_list.c
│       ├── gwin_list.h
│       ├── gwin.mk
│       ├── gwin_mk.c
│       ├── gwin_options.h
│       ├── gwin_progressbar.c
│       ├── gwin_progressbar.h
│       ├── gwin_radio.c
│       ├── gwin_radio.h
│       ├── gwin_rules.h
│       ├── gwin_slider.c
│       ├── gwin_slider.h
│       ├── gwin_tabset.c
│       ├── gwin_tabset.h
│       ├── gwin_textedit.c
│       ├── gwin_textedit.h
│       ├── gwin_widget.c
│       ├── gwin_widget.h
│       └── gwin_wm.c
└── tools
    ├── file2c
    │   ├── binaries
    │   ├── readme.txt
    │   └── src
    ├── gmake_scripts
    │   ├── compiler_gcc.mk
    │   ├── cpu_armv6.mk
    │   ├── cpu_at91sam7.mk
    │   ├── cpu_raspberrypi.mk
    │   ├── cpu_stm32m1.mk
    │   ├── cpu_stm32m3.mk
    │   ├── cpu_stm32m4.mk
    │   ├── cpu_stm32m7.mk
    │   ├── cpu_x64.mk
    │   ├── cpu_x86.mk
    │   ├── library_ugfx.mk
    │   ├── os_chibios_2.mk
    │   ├── os_chibios_3.mk
    │   ├── os_chibios.mk
    │   ├── os_ecos.mk
    │   ├── os_freertos.mk
    │   ├── os_linux.mk
    │   ├── os_osx.mk
    │   ├── os_raw32.mk
    │   ├── os_win32.chibios.mk
    │   ├── os_win32.mk
    │   ├── os_win32.raw32.mk
    │   └── readme.txt
    └── mcufontencoder
        ├── binaries
        └── src

147 directories, 264 files

Does it work without symlink?

No, it does not. Output is the same in either case:

[Thu Jun 29 15:49:41 2017] Processing esp32 (platform: espressif32; board: lolin32; framework: espidf)
------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
Collected 0 compatible libraries
Looking for dependencies...
Project does not have dependencies
Compiling .pioenvs/esp32/src/main.o
src/main.cpp:6:17: fatal error: gfx.h: No such file or directory
compilation terminated.
Generating partitions .pioenvs/esp32/partitions_table.bin
Generating LD script .pioenvs/esp32/esp32_out.ld
*** [.pioenvs/esp32/src/main.o] Error 1
Compiling .pioenvs/esp32/bootloader/bootloader_start.o

On reflection, I’m thinking the library is probably complex enough for me to take on the library.json approach. Will play with that and report my findings

UPDATE: library.json approach works, though I was surprised to find out tree structure wants to be:

[root]
+ lib
  + uGFX
    - library.json
    + src [=> symlink to actual uGFX lib]

Putting source files alongside library.json didn’t work. But, it’s better this way

Could you share a content of library.json for other users who will come to this issue? Thanks!

You got it, once it’s working at a basic level

EDIT: I have hammered it into functioning, but it involved something a little bit nasty. I was unable to instruct platformio srcFilter to ignore header files in particular folders.

Within uGFX library, there are some font header files in:

[uGFX]/src/gdisp/fonts/mk_*.h

and has those same header file names duplicated in:

[uGFX]/mk_*.h

The latter ones are empty stubs. The build picks up these empty stubs, which then halts the build with errors. To get around this, I had to make a 3rd set of header files whose contents look kinda like:

#include "../lib/uGFX/src/src/gdisp/mcufont/mf_rlefont.h"

These 3rd set then sit in the user’s src folder (outside the lib)

Here’s the current state of library.json, given aforementioned caveats:

{
    "name": "uGFX",
    "keywords": "uGFX, graphics, windowing",
    "description": "Portable graphics library",
    "version": "2.7",
    "repository":
    {
        "type": "git",
        "url": "https://git.ugfx.io/uGFX/uGFX"
    },
    "build": {
        "srcFilter": [
            "+<src/gfx.c>",
            "-<src/gfx_mk.c>",
            "+<src/*/>",
            "-<src/*/*_mk.c>",
            "-<3rdparty/>",
            "-<boards/>",
            "-<demos/>",
            "-<drivers/gdisp/QImage>",
            "-<drivers/ginput/touch/Linux-Event>",
            "-<drivers/>"
        ] 
    },
    "frameworks": "*"
}
1 Like

So, I’m working on a helper lib to make it easier to use uGFX.

However, the amount of juggling with the aforementioned header files in my Jul 2 post is making it a bit cumbersome.

Could someone offer some guidance for how I might clean it up a bit? Here’s the repo

The folder of interest is test/basic/src and has both the mk_*.h file scenario as well as some FreeRTOS shim header files. As previously mentioned, these shim files are a “3rd set” of headers so that the compiler chooses the right headers

A little older and wiser, I’m able to craft the library.json properly. Love that build flags option Ivan :slight_smile: You can see how it’s done in the aforementioned repo, though be warned I haven’t fully cleaned it up

I am trying to integrate uGFX to PlatformIO as well, but I spent looots of time going nowhere :frowning:
I tried to write my own library.json, I tried yours, but nothing worked.

I am working on STM32 F7 discovery board [env:disco_f746ng] and using stm32cube framework, without RTOS or anything.

How did you make it work? I added uGFX library to the lib_extra_dirs/, included gfxconf.h in the (PIO project) include folder, copied gfx_mk.c to the src/ folder. And I have "#include<gfx.h>" in my main.c file.
I also tried various LDF_modes (currently left LDF_mode at “deep+”) -> still doesn’t compile.

It throws bunch of compilation errors - first one being, that it doesn’t find “gfx.c”.

I then tried to add “+” to the srcFilter @ library.json -> still the same.
I tried to add the folder to the include path build_flags = -I/home/--pathToLib--/uGFX_library/src/ and it found gfx.c, but the rest of the errors didn’t go away.

Now it doesn’t find gdisp_lld_config.h (which is inside uGFX_root/drivers/gdisp/STM32LTDC/).
I add also that folder to include path @ build flags -> still doesnt’ work.
Now it doesn’t find the gfxconf.h which is in my pio project’s include folder all the time! I noticed the warning in the LDF documentation - but changing the LDF mode to deep doesn’t help.

Basically as I understand, uGFX is made in such a way that you control what gets included/compiled by changing options in gfxconf.h. Since PIO doesn’t use conventional CPPP but has it’s own dependency finder - you would have to include/exclude files manually, which is a great headace from my experience.

What is the right way forward? I really don’t want to hack around library and include every file by hand using build_flags - there must be a nicer way…right?