Skip to content
Lee Ballard edited this page Apr 29, 2024 · 25 revisions

Install, Configuration

see also https://github.com/sfeakes/AqualinkD/wiki

Install

sudo apt-get install git libsystemd-dev
cd ~
mkdir git
cd git
git clone https://github.com/ballle98/AqualinkD.git
make clean
make
sudo make install

run in foreground with logging

sudo systemctl stop aqualinkd
sudo release/aqualinkd -v -d -c /etc/aqualinkd.conf

capture logs from the browser

go to the debug page http://[ip address]/debug.html (see https://github.com/sfeakes/AqualinkD#all-web-interfaces)

Developer instructions

Cross Compile and Eclipse IDE

  1. start with these instructions based on https://www.cososo.co.uk/2015/12/cross-development-using-eclipse-and-gcc-for-the-rpi/
    1. Install GCC Cross compiler from http://gnutoolchains.com/raspberry/ (alternatively you can get the toolchain here https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads)
    2. Synchronise header file and library versions
      1. with older versions of the tool chain use c:\SysGCC\Raspberry\TOOLS\UpdateSysroot.bat
      2. With newer versions download and install https://sysprogs.com/SmarTTY/download/ then execute something like this to update sysroot

"C:\Program Files (x86)\Sysprogs\SmarTTY\SmarTTY.exe" /UpdateSysroot:C:\SysGCC\raspberry64\aarch64-linux-gnu\sysroot

or

"C:\Program Files (x86)\Sysprogs\SmarTTY\SmarTTY.exe" /UpdateSysroot:C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot

  1. import project from github. If you clone project using git import as general git project then convert to C/C++ project
  2. configure as makefile project
  3. Use these instructions to configure the toolchain https://stackoverflow.com/a/27180772/454658
    1. Unfortunately it's not obvious or intuitive, how to set the properties for a particular (cross-)toolchain, that should be bound to a project. To make these property settings available, first go to the C++ Build/Builder Settings Tab in the project properties dialog and check the Generate Makefiles automatically option. Don't click the Apply or OK button now!

    2. Proceed to the C++ Build->Settings sub page and fill in the cross-toolchain prefix, and path where the binaries are actually located. image

    3. Go back to the "C++ Build:Builder Settings" Tab and uncheck the Generate Makefiles automatically

    4. Override the compiler in "C++ Build:Behavior" Tab. Build arguments set to

CC=aarch64-linux-gnu-gcc GCCFLAGS="-Wall -g -Og -fsanitize=address -static-libasan" -j

or

CC=arm-linux-gnueabihf-gcc GCCFLAGS="-Wall -g -Og -fsanitize=address -static-libasan" -j

image

  1. (No longer needed with Eclipse 2022-06) Configure Build Output Parser compiler pattern https://help.eclipse.org/2020-06/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Fconcepts%2Fcdt_c_scanner_discovery.htm
    1. Go to either "Window -> Preferences -> C/C++ -> Build -> Settings -> Discovery Tab -> CDT GCC Build Output Parser" or "Project -> Properties -> C/C++ General -> Preprocessor Include... -> Providers -> CDT GCC Build Output Parser"

    2. Change compiler pattern to add wildcard match in front of gcc so it will match arm-linux-gnueabihf-gcc (.*g?cc)|(.*[gc]\+\+)|(clang) image

    3. When you build you should see wrench icons on the c files and the grey out sections in the editor related to #ifdef should be correct. Note you may need to change the active build configuration or select "Project -> C/C++ Index -> Rebuild"

Enable Core Dumps

You can follow these instructions to enable core files https://pve.proxmox.com/wiki/Enable_Core_Dump_systemd

rebuild the code with debug symbols, and turn on address sanitize (we're looking for memory corruption)

make DBG="-g -Og -fsanitize=address -static-libasan"
make install
export ASAN_OPTIONS=abort_on_error=1
aqualinkd -v -d -c /etc/aqualinkd.conf

when it crashes "sudo -i" to become root, run gbd and dump the back trace with the bt command

cd /var/lib/coredumps/
ls
gdb /home/pi/git/AqualinkD/release/aqualinkd core-aqualinkd-sig11-user0-group0-pid386-time1554347133
bt

Eclipse remove file explorer

image