Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not install libpng12-dev on raspberry 4 #35

Open
susheelbanyal opened this issue Dec 7, 2021 · 7 comments
Open

Can not install libpng12-dev on raspberry 4 #35

susheelbanyal opened this issue Dec 7, 2021 · 7 comments

Comments

@susheelbanyal
Copy link

susheelbanyal commented Dec 7, 2021

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

@nagualcode
Copy link

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.

@susheelbanyal
Copy link
Author

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

@nagualcode
Copy link

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.

@susheelbanyal
Copy link
Author

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

@aahmed7
Copy link

aahmed7 commented Nov 11, 2022

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

@deadca763
Copy link

deadca763 commented Feb 3, 2023

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

@YuxinLin000
Copy link

YuxinLin000 commented Mar 17, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants