How Does One Compile qrencode with PNG support?

I'm trying to create some QR codes for WireGuard so that I can scan the configurations in on the client devices displayed from a PC or phone. I've installed qrencode and I'm trying to create PNG files from the conf files but I am getting the following error:

PNG output is disabled at compile time. No output generated.

This issue is also reported here.

As I compile my own OpenWrt firmware for my routers this gives me the opportunity to customise the packages as part of the overall compiled OpenWrt firmware. I had a look at the makefile for qrencode and removed the --without-png line from the CONFIGURE_ARGS+= section making sure the libpng library was included in the firmware compile. I flashed it to my router and it stills gives me the error message from above.

Am I missing something?

Did you start from a clean build or did you first built a firmware with no changes?

If you built first a firmware with no change, then you probably have partially compiled files in the build cache. Even if you change the config it will still not recompile the binaries if it finds already compiled files.

make clean

should delete the build cache and then you can recompile.

That command does not delete the build toolchain so it should not require a lot of time to recompile a new firmware like the first time.

Otherwise you can go in the build_dir/target-xxxxxx folder (select the right targetfor your device) and just delete the qrencode folder.

1 Like

I usually often run make -j* clean download world when I re-compile. Would be safe to say deleting qrencode directory under build_dir/target-xxxxxx would be enough?

Sadly I'm unable to do any compiling at the moment because I'm having some issues with my servers at the moment. Once I've got it up and running I will have a look at the directory above and post back.

So I don't have to keep flashing firmware to the entire router all the time, could I compile just the package and then upload and install it using okpg?


yeah you can use opkg to install local packages
for example you upload the package in /tmp (ram disk) with scp and then
opkg install /tmp/hiawatha_7.7-2_ar71xx.ipk

I managed to spin up a VM on my personal PC and compiled the firmware. I installed the following three packages:

  • libpng
  • libqrencode
  • qrencode

and used the following commands:

opkg --force-overwrite install libpng_1.6.37-3_arm_cortex-a9_vfpv3-d16.ipk
opkg --force-overwrite install libqrencode_4.0.2-2_arm_cortex-a9_vfpv3-d16.ipk
opkg --force-overwrite install qrencode_4.0.2-2_arm_cortex-a9_vfpv3-d16.ipk

Unfortunately I'm still presented with the same message.

qrencode -t PNG -o qrcode.png < some_file_file

Rebuild the packages incrementing their version in the makefile.
Or decrease the versions for initially installed packages in /usr/lib/opkg/status.
This is a prerequisite to properly install the modified packages.

I tried your second method and renamed the versions to all start with 0 but same error appears.

root@OpenWrt-AP1:/tmp# opkg install libpng_1.6.37-3_arm_cortex-a9_vfpv3-d16.ipk
Upgrading libpng on root from 0.6.37-3 to 1.6.37-3...
Configuring libpng.
root@OpenWrt-AP1:/tmp# opkg install libqrencode_4.0.2-2_arm_cortex-a9_vfpv3-d16.ipk
Upgrading libqrencode on root from 0.0.2-2 to 4.0.2-2...
Configuring libqrencode.
root@OpenWrt-AP1:/tmp# opkg install qrencode_4.0.2-2_arm_cortex-a9_vfpv3-d16.ipk
Upgrading qrencode on root from 0.0.2-2 to 4.0.2-2...
Configuring qrencode.
root@OpenWrt-AP1:/tmp# qrencode -t PNG -o qrcode.png < /etc/wireguard/networks/lan/
lan_server_private.key  lan_server_public.key   peers/
root@OpenWrt-AP1:/tmp# qrencode -t PNG -o qrcode.png < /etc/wireguard/networks/lan/peers/1_lan_Will/1_lan_Will.conf
PNG output is disabled at compile time. No output generated.

For reference I am editing the makefile at feeds/packages/libs/qrencode/Makefile