raspidmx icon indicating copy to clipboard operation
raspidmx copied to clipboard

Can not install libpng12-dev on raspberry 4

Open susheelbanyal opened this issue 3 years ago • 7 comments

Reading package lists... Done Building dependency tree... Done Reading state information... Done Package libpng12-dev is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'libpng12-dev' has no installation candidate Due to this it isnot installing any package.

uname -m: armv7l

susheelbanyal avatar Dec 07 '21 15:12 susheelbanyal

A package is something the distro that you are using has provided, ready to use. So libpng12-dev seems not to be available on the distro you are using. You could try to compile and install the libs you need "by hand". Not an issue with this project specifically, because this project is distro-agnostic.

nagualcode avatar Dec 07 '21 16:12 nagualcode

Thanks for the information. Could you please how we can install libpng12-dev on raspberry pi 4 ?

susheelbanyal avatar Dec 09 '21 12:12 susheelbanyal

I am running archlinux-arm on my raspberry pi, so I dont have this problem, but I did a google search for you, and the first result says: "Replace libpng12-dev with libpng-dev"

https://stackoverflow.com/questions/64694699/problem-installing-libpng-dev-along-with-libpng12-dev-on-raspberry-pi-zero

If that does not work, dig into google and you may find more clues.

nagualcode avatar Dec 09 '21 15:12 nagualcode

I have tried that option but the pngview command is not available yet.

susheelbanyal avatar Dec 10 '21 13:12 susheelbanyal

libpng12 is not available for raspberry pi os buster. the package libpng-dev will install libpng16 which can't compile pngview. You need to get libpng12 source from https://sourceforge.net/projects/libpng/files/libpng12/1.2.59/ and build it yourself using:

./configure
make
make install

aahmed7 avatar Nov 11 '22 11:11 aahmed7

libpng12 is not available for raspberry pi os buster. the package libpng-dev will install libpng16 which can't compile pngview. You need to get libpng12 source from https://sourceforge.net/projects/libpng/files/libpng12/1.2.59/ and build it yourself using:

./configure
make
make install

Anyone has fixed this issue? Even after install manually libpng12 it isn't working,

/usr/bin/ld: ../lib/libraspidmxPng.a(loadpng.o): in function `loadPngFile':
/home/pi/Setup/raspidmx/lib/../common/loadpng.c:68: undefined reference to `png_create_read_struct'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:78: undefined reference to `png_create_info_struct'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:88: undefined reference to `png_destroy_read_struct'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:94: undefined reference to `png_init_io'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:96: undefined reference to `png_read_info'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:100: undefined reference to `png_get_color_type'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:101: undefined reference to `png_get_bit_depth'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:112: undefined reference to `png_get_image_width'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:113: undefined reference to `png_get_image_height'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:120: undefined reference to `png_get_gAMA'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:134: undefined reference to `png_set_expand_gray_1_2_4_to_8'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:137: undefined reference to `png_get_valid'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:159: undefined reference to `png_read_update_info'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:173: undefined reference to `png_read_image'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:179: undefined reference to `png_destroy_read_struct'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:154: undefined reference to `png_set_gray_to_rgb'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:122: undefined reference to `png_set_gamma'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:139: undefined reference to `png_set_tRNS_to_alpha'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:147: undefined reference to `png_set_strip_16'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:82: undefined reference to `png_destroy_read_struct'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/loadpng.c:129: undefined reference to `png_set_palette_to_rgb'
/usr/bin/ld: ../lib/libraspidmxPng.a(savepng.o): in function `pngWriteImageRGB565':
/home/pi/Setup/raspidmx/lib/../common/savepng.c:75: undefined reference to `png_write_row'
/usr/bin/ld: ../lib/libraspidmxPng.a(savepng.o): in function `pngWriteImageRGB888':
/home/pi/Setup/raspidmx/lib/../common/savepng.c:95: undefined reference to `png_write_row'
/usr/bin/ld: ../lib/libraspidmxPng.a(savepng.o): in function `pngWriteImageRGBA16':
/home/pi/Setup/raspidmx/lib/../common/savepng.c:139: undefined reference to `png_write_row'
/usr/bin/ld: ../lib/libraspidmxPng.a(savepng.o): in function `pngWriteImageRGBA32':
/home/pi/Setup/raspidmx/lib/../common/savepng.c:115: undefined reference to `png_write_row'
/usr/bin/ld: ../lib/libraspidmxPng.a(savepng.o): in function `savePng':
/home/pi/Setup/raspidmx/lib/../common/savepng.c:169: undefined reference to `png_create_write_struct'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/savepng.c:182: undefined reference to `png_create_info_struct'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/savepng.c:210: undefined reference to `png_init_io'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/savepng.c:220: undefined reference to `png_set_IHDR'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/savepng.c:231: undefined reference to `png_write_info'
/usr/bin/ld: ../lib/libraspidmxPng.a(savepng.o): in function `pngWriteImageRGB888':
/home/pi/Setup/raspidmx/lib/../common/savepng.c:95: undefined reference to `png_write_row'
/usr/bin/ld: ../lib/libraspidmxPng.a(savepng.o): in function `savePng':
/home/pi/Setup/raspidmx/lib/../common/savepng.c:262: undefined reference to `png_write_end'
/usr/bin/ld: /home/pi/Setup/raspidmx/lib/../common/savepng.c:263: undefined reference to `png_destroy_write_struct'
/usr/bin/ld: ../lib/libraspidmxPng.a(savepng.o): in function `pngWriteImageRGBA32':
/home/pi/Setup/raspidmx/lib/../common/savepng.c:159: undefined reference to `png_write_row'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:16: pngview] Error 1
make[1]: Leaving directory '/home/pi/Setup/raspidmx/pngview'
make: *** [Makefile:7: all] Error 2

deadca763 avatar Feb 03 '23 22:02 deadca763

libpng12 is not available for raspberry pi os buster. the package libpng-dev will install libpng16 which can't compile pngview. You need to get libpng12 source from https://sourceforge.net/projects/libpng/files/libpng12/1.2.59/ and build it yourself using:

./configure
make
make install

Anyone has fixed this issue? Even after install manually libpng12 it isn't working,

I suspect there's something wrong when using libraspidmxPng.a.

workaround:

  1. apt remove libpng-dev and manually Install libpng12
  2. Copy & Paste loadpng.c and loadpng.h to pngview folder
  3. Add include "loadpng.h" to pngview.c
  4. Update makefile there
OBJS=pngview.o loadpng.o
BIN=pngview

CFLAGS+=-Wall -g -O3 -I../common
LDFLAGS+=-L/usr/lib/ -lbcm_host -lm $(shell libpng-config --ldflags) -L../lib -lraspidmx

INCLUDES+=$(shell libpng-config --cflags) -I/usr/include/ -I/usr/include/interface/vcos/pthreads -I/usr/include/interface/vmcs_host/linux

all: $(BIN)

%.o: %.c
	@rm -f $@ 
	$(CC) $(CFLAGS) $(INCLUDES) -g -c $< -o $@ -Wno-deprecated-declarations

$(BIN): $(OBJS)
	$(CC) -o $@ -Wl,--whole-archive $(OBJS) $(LDFLAGS) -Wl,--no-whole-archive -rdynamic

clean:
	@rm -f $(OBJS)
	@rm -f $(BIN)

Worked for me on bullseye.

YuxinLin000 avatar Mar 17 '23 13:03 YuxinLin000