Closed bjotos closed 1 year ago
Okay, github messed-up the diff (preview looked fine, argh), here is the a diff as attachment vcdgraph-linux-compile-fix-diff.txt
The -lpng seems to just missing, pkg-config does not generate -lpng for me, as it has no --libs-only-l
flag, so I wonder where you get the -l in the front.
Test Environment (required)
Describe the bug Check-out the latest version of mega65-tools (9098dea22ae1c7a0bd19da55d88b15df1ffe646c) and try to build on Ubuntu 22.04 LTS. Linking vcdgraph fails.
This can be reproduced by running the compile step for vcdgraph on its own:
Solution The default linker on Ubuntu resolves symbols/dependencies in order of appearance. The vcdgraph.c introduces a new (and thus unresolved) symbol dependency to png_write_image, thus the linker needs '-lpng' after this file.
The simple solution is to apply this diff:
Note: It looks like some other targets (i.e. readdisk) had similar issues and did same trick. Cleaner (and common) solution would be to differentiate between CFLAGS (i.e. compiler flags) and LFLAGS (i.e. linker flags) and add linker flags at the very end of each build step.