rprata / sgfx

SGFX is a lightweight embedded library for displays and touchscreens providing everything required to build a fully featured embedded GUI.
MIT License
24 stars 8 forks source link

Linking problem #28

Open MichaelYankin opened 1 month ago

MichaelYankin commented 1 month ago

Hello! I've come across linking problems while trying to compile your library :(

First error was caused by uninitialized two structures "huffman_tree" in sgfx_upng.c After I've fixed this error, I tried to build the library by following readme tutorial: $ cd sgfx $ mkdir build $ cmake CMakeLists.txt -Bbuild -GNinja $ cmake --build build

It gave me the following errors: /usr/bin/ld: src/CMakeFiles/sgfx.dir/core/sgfx_font.c.o:(.bss+0x8): redefinition of «m_bfcs»; src/CMakeFiles/sgfx.dir/utils/sgfx_config.c.o:(.bss+0x0): defined here first /usr/bin/ld: src/CMakeFiles/sgfx.dir/core/sgfx_event.c.o:(.bss+0x8): redefinition of «m_sgfs»; src/CMakeFiles/sgfx.dir/core/sgfx.c.o:(.bss+0x0): defined here first /usr/bin/ld: src/CMakeFiles/sgfx.dir/core/sgfx_event.c.o:(.bss+0x10): redefinition of «m_bfcs»; src/CMakeFiles/sgfx.dir/utils/sgfx_config.c.o:(.bss+0x0): defined here first etc.

I'm using gcc (Ubuntu 12.3.0-1ubuntu1~22.04), cmake & Ninja packages are up-to-date. Same error is occuring while I try to link this library with custom toolchain. My project looks like this: -Project -- libs / sgfx -- display service / CMakeLists.txt

In the CMakeLists for the project sgfx is included as library and as subdirectory. Toolchain is for the target platform with linux-lichee-5.2.0. Compiler: arm-buildroot-linux-uclibcgnueabihf-gcc.br_real (Buildroot 2022.02-168-g7d00d9f50f) 11.2.0 Project is for v3s board, and I want to use this library to make use of monochrome oled display connected to this board. I was very happy when I found it, as my task is utilize framebuffer and only use text and simple primitives. Unfortunately, can't compile it :(

If you need more specific information, I'll be happy to provide it.

rprata commented 1 month ago

For cross compile you need to create a toolchain cmake file (https://github.com/rprata/sgfx/tree/master/toolchains):

$ cd sgfx
$ mkdir build
$ cmake CMakeLists.txt -Bbuild -GNinja -DCMAKE_TOOLCHAIN_FILE=toolchains/<toolchain_file>.cmake
$ cmake --build build

Now, we don't support this architecture.. however can you provide this toolchain? If you will use this in your project I can help you to port sgfx for this arch. Feel free to contribute with sfgx project too.

MichaelYankin commented 1 month ago

For cross compile you need to create a toolchain cmake file (https://github.com/rprata/sgfx/tree/master/toolchains):

$ cd sgfx
$ mkdir build
$ cmake CMakeLists.txt -Bbuild -GNinja -DCMAKE_TOOLCHAIN_FILE=toolchains/<toolchain_file>.cmake
$ cmake --build build

Now, we don't support this architecture.. however can you provide this toolchain? If you will use this in your project I can help you to port sgfx for this arch. Feel free to contribute with sfgx project too.

Thank you so much, your help will be very appreciated. I've tried "cmake CMakeLists.txt -Bbuild -GNinja -DCMAKE_TOOLCHAIN_FILE=toolchains/.cmake" for my toolchain.

The attached file is a toolchain cmake file (renamed to .txt to attach here). toolchainfile.txt As you can see there, it's for arm architecture, gcc version is 11.2.0.

rprata commented 1 month ago

@MichaelYankin do you have the download link to this: Toolchain is for the target platform with linux-lichee-5.2.0. Compiler: arm-buildroot-linux-uclibcgnueabihf-gcc.br_real (Buildroot 2022.02-168-g7d00d9f50f) 11.2.0

MichaelYankin commented 1 month ago

If I understand you correctly, it's there: https://lore.kernel.org/buildroot/874jqhxbnr.fsf@dell.be.48ers.dk/T/

rprata commented 1 month ago

I'm trying generate toolchain using this tutorial: https://www.kancloud.cn/zepan/zero_tutorial/342701. So, I'm using origin/zero-5.2.y branch. However build failed. Please, confirm how can I generate toolchain (compilers, etc) to work in my side:

/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x20): multiple definition ofyylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here`

MichaelYankin commented 1 month ago

Please, confirm how can I generate toolchain (compilers, etc) to work in my side:

Hey. Sorry, unfortunately, I'm not the one who started this project in my company, I'm one of the programmers, who work with SW for the board, not responsible for other things.

However, if it helps, it's Allwinner v3s processsor, linux lichee kernel v. 5.2.0. Source of the project is in these repos: https://github.com/Lichee-Pi Maybe this one will help you too: https://github.com/topics/v3s

Thank you for your patience and enthusiasm.