Trouble Building g3a Add-in with gint + GiteaPC + CMake
Posté le 05/05/2025 14:11
Hi everyone,
I'm currently trying to create a .g3a add-in for the Casio fx-CG50 using gint, but I'm running into repeated issues during the build process. I followed all documented steps as carefully as possible and I am on WSL for Windows.
Here’s exactly what I’ve done so far, including the commands and any errors I got:
First I installed base dependencies with no errors
sudo apt update
sudo apt install curl git python3 build-essential pkg-config
Installed GiteaPC and runs without issues
curl "https://git.planet-casio.com/Lephenixnoir/GiteaPC/raw/branch/master/install.sh" -o /tmp/giteapc-install.sh
bash /tmp/giteapc-install.sh
Installed the toolchain using GiteaPC
giteapc install Lephenixnoir/fxsdk Lephenixnoir/sh-elf-binutils Lephenixnoir/sh-elf-gcc Lephenixnoir/sh-elf-gdb
Which first failed with
error: error 2 in command: gmake -f /home/<username>/.local/share/giteapc/Lephenixnoir/fxsdk/giteapc.make configure
/bin/sh: 1: cmake: not found
So I ran
sudo apt install cmake
After installing CMake, the above **giteapc install** worked correctly
Installed libraries required by gint with no errors
giteapc install Lephenixnoir/OpenLibm Vhex-Kernel-Core/fxlibc
giteapc install Lephenixnoir/sh-elf-gcc
giteapc install Lephenixnoir/gint Lephenixnoir/libprof
Verified installed packages with no issues
giteapc list
Installed additional system libraries (for completeness) no issues again
sudo apt install cmake libpng-dev libusb-1.0-0-dev libglib2.0-dev libncurses-dev libsdl2-dev
Created my test project
nano main.c
nano CMakeLists.txt
nano manifest.toml
Made a build directory and ran cmake
mkdir build
cd build
cmake ..
make
Which returned this error
CMake Error at CMakeLists.txt:4 (find_package):
By not providing "FindGint.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Gint", but
CMake did not find one.
Could not find a package configuration file provided by "Gint" with any of
the following names:
GintConfig.cmake
gint-config.cmake
I tried pointing CMake to the directory using this command but the error persisted
cmake .. -DGint_DIR=$HOME/.local/share/giteapc/dev/Lephenixnoir/gint
I also ran this it returned no results, which I believe confirms that gint does not provide a GintConfig.cmake file, so CMake cannot find it this way.
find ~/.local/share/giteapc/dev/Lephenixnoir/gint -name "GintConfig.cmake"
I would really appreciate if anyone could let me know if I am doing something entirely wrong or some steps are missing or if this is the right way to get fxsdk and make my own g3a file
I am new to this so Any help is greatly appreciated Thank you!
Citer : Posté le 05/05/2025 14:20 | #
You were almost there! I see you went through quite a bit of troubleshooting on the way here, thanks for your patience. The part you're missing is using the tools from the fxSDK (which you installed).
You don't have to, but as a start, it's recommended to create a project from the fxSDK template with fxsdk new and that'll give you a CMakeLists.txt and some source files.
The key then is to build with fxsdk build-cg which just does CMake + make but gives CMake the path to the fxSDK's CMake files, including FindGint.cmake which is is provided by gint and then installed in the fxSDK's sysroot.
If you want to do this manually, you can find the arguments that the fxSDK gives CMake here: https://git.planet-casio.com/Lephenixnoir/fxsdk/src/branch/master/fxsdk/fxsdk.sh#L224-L228
Citer : Posté le 05/05/2025 17:07 | #
Thank you really appreciate it this helped solved the issue and now I can actually build.
Do you also happen to know if there is any resource or guide that outlines the purpose and usage of fxSDK functions like the ones you put into your main.c file so it can aid in the making of my own add in.
Thank you for your help!
Citer : Posté le 05/05/2025 17:34 | #
There's this tutorial which goes through the basics and reads reasonably well under machine translation: https://www.planet-casio.com/Fr/forums/topic14914-1-tutoriels-dutilisation-de-gint.html
And then gint's API is documented in the headers (https://git.planet-casio.com/Lephenixnoir/gint/src/branch/master/include/gint), which is not great, but it's quite detailed for the common functions (drawing, keyboard, timers, etc).
Admittedly, the last line of support is myself on the forum. ^^"
Citer : Posté le 06/05/2025 00:03 | #
I can definitely see your support.
Did use the website to help make my mini test g3a file the first one I placed into the fx-cg50 worked but its functionality did not work which I believe may of been some coding error/issue as it kicked me out instantly. However the second time my retry when I placed it the files into the calculator via a USB connection just how you are meant to do but the add in just decided it does not want to appear and I have no idea what to do I tried resetting the calculator and added my own g3a but nothing then added CASIO Conv.g3a which worked fine with no issues the add in named MyAddin.g3a does appear by checking the calculators storage memory so definitely does exist on the calculator so I have no clue if this is coding related or calculator related.
Any solution which I am sure you may have would be appreciated.
Thanks for the on going help!
Citer : Posté le 06/05/2025 00:09 | #
This all seems pretty weird! Not sure what website you're referring to. When you build with fxsdk build-cg the fxSDK automatically generates a g3a file with appropriate metadata.
The "kicked me out instantly" part is probably what happens then program aborts (you get sent back to the main menu).
Add-ins that do not appear in the main menu are rare. Make sure you put it on the root folder of the storage memory. Otherwise that usually means the g3a file is malformed or corrupted. You can use fxgxa -d to dump a g3a file and see if it's valid.
Citer : Posté le 06/05/2025 23:34 | #
Hi again by the website I meant this link (https://git.planet-casio.com/Lephenixnoir/gint/src/branch/master/include/gint) which I used to make my add in g3a file however was having the issue of it not appearing so I then decided something may be wrong with my code so then decided to use the default add in src/main.c file however this had no change to the issue of it not appearing so I decided to fully reinstall fxsdk with GiteaPC here is what I did:
rm -rf ~/.local/share/fxsdk/ ~/.local/bin/fxsdk ~/.local/share/giteapc/dev/Lephenixnoir/fxsdk && \
sed -i '/FXSDK/d' ~/.bashrc && source ~/.bashrc
giteapc install Lephenixnoir/fxsdk Lephenixnoir/sh-elf-binutils Lephenixnoir/sh-elf-gcc Lephenixnoir/sh-elf-gdb && \
giteapc install Lephenixnoir/OpenLibm Vhex-Kernel-Core/fxlibc && \
giteapc install Lephenixnoir/sh-elf-gcc && \
giteapc install Lephenixnoir/gint Lephenixnoir/libprof
Upon reinstallation of fxsdk I came across more issues the .g3a file wasn’t being generated initially for some reason basically no g3a file came I believe the cause was CMake wasn’t converting the compiled ELF (myaddin) to .g3a format. So I added a manual objcopy step to CMakeLists.txt:
TARGET myaddin POST_BUILD
COMMAND sh-elf-objcopy -O binary $<TARGET_FILE:myaddin> MyAddin.g3a
)
Then another issue Builds failed with no metadata specified for icon-uns.png because Icons required a metadata.toml file and exact 16x16 dimensions which I temporarily bypassed icons in CMakeLists.txt with ICONS NONE.
Eventually I had success when running fxsdk build-cg and a .g3a file appeared however,
As a verification I ran this:
This returned nothing which I believe means the file has probably not been compiled properly but still not to sure what's causing the add in to not appear in main menu. I am currently thinking of reinstalling the entire thing including GiteaPC and start fresh because as you said it not appearing in main menu is rare so something beyond my capabilities may be wrong here.
Any explanation/help appreciated Thank you!
Citer : Posté le 06/05/2025 23:41 | #
Did you try to just run the default sequence of fxsdk new, go into the folder, fxsdk build-cg, and get the g3a?
If you're writing your CMakeLists.txt by hand you'll clearly be missing some steps. I strongly suggest starting from the provided CMakeLists.txt: https://git.planet-casio.com/Lephenixnoir/fxsdk/src/branch/master/fxsdk/assets
This uses the generate_g3a() function (which you seem to have found eventually) that handles objcopy plus the generation of a header. objcopy alone is not enough.
"no metadata specified for icon-uns.png" shouldn't happen unless you declare it as an asset. This is for images that you're gonna use in the program (converted via fxconv). Icons for the g3a aren't part of this process, which is why you'll see that the default CMakeLists.txt names them in generate_g3a() but not in the assets management.
I'm not sure why you're expecting file to return anything containing "SH". A g3a is a flat binary with a CASIO-specific header on it. The file utility doesn't know about this format and anyway you wouldn't have the ELF metadata there. If you want to check whether something is a valid g3a, as mentioned before you should use fxgxa -d on it which will dump out the header if it's valid.
Citer : Posté le 07/05/2025 16:50 | #
I decided I had overcomplicated everything so decided to uninstall and reinstall everything just like the steps in my first post and then use the usual steps of fxsdk new then fxsdk build-cg using the CMakeLists.txt @ https://git.planet-casio.com/Lephenixnoir/fxsdk/src/branch/master/fxsdk/assets
which you said should correctly generate the g3a file however it did not instead generated myaddin the ELF binary and myaddin.bin only not g3a file leaving me confused as I thought that it should not give errors as I did full installation from scratch again.
Citer : Posté le 07/05/2025 16:53 | #
The g3a file generates in the main project folder for convenience instead of the build folder. Could this be the confusion?
Citer : Posté le 07/05/2025 17:03 | #
I checked for g3a files in my whole WSL system it returned nothing so noApologies for this never mind have just found it let me check if it actually shows on my calc this time. Ok it finally worked thank you for the help!Citer : Posté le 07/05/2025 17:11 | #
Glad you got it sorted out. Enjoy!