# png won't make



## kb6rxe (Dec 21, 2012)

I've tried on several computers with different versions of FreeBSD to upgrade graphics/png.
I *cd /usr/ports/graphics/png* and then type make. It compiles and fails when it runs the test:

```
The following tests FAILED:
       1 - pngtest (Failed)
Errors while running CTest
*** Error code 8
1 error
*** Error code 1

Stop in /usr/ports/graphics/png
```
What to I do now?


----------



## m6tt (Dec 23, 2012)

First, you should copy record the entire make output, whether from command line or copy pasting it into a text editor.
Search the recorded output for "error".
The error at the end is a "summary"...the real error happened somewhere during the build, and we need to find it to determine the issue.


----------



## roens (May 11, 2013)

I too am running into this issue, which is further keeping other packages from being updated (that rely on  libpng).

That full make output doesn't seem to offer much (that I can tell) in the way of clues:


```
root@fs:/usr/ports/graphics/png# 24> make clean
===>  Cleaning for png-1.5.15
root@fs:/usr/ports/graphics/png# 25> make
===>  Found saved configuration for png-1.5.15
===>   png-1.5.15 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by png-1.5.15 for building
===>  Extracting for png-1.5.15
=> SHA256 Checksum OK for libpng-1.5.15.tar.xz.
=> SHA256 Checksum OK for libpng-1.5.15-apng.patch.gz.
/bin/cp /usr/ports/distfiles//libpng-1.5.15-apng.patch.gz /usr/ports/graphics/png/work/libpng-1.5.15/
/usr/bin/gzip -nf -9 -d /usr/ports/graphics/png/work/libpng-1.5.15/libpng-1.5.15-apng.patch.gz
===>  Patching for png-1.5.15
===>  Applying extra patch /usr/ports/graphics/png/work/libpng-1.5.15/libpng-1.5.15-apng.patch
===>  Applying FreeBSD patches for png-1.5.15
/usr/bin/sed -i.bak  -e 's|RELEASE}.0|RELEASE}|'  -e 's|LIBDIR}/pkgconfig|LIBDIR}data/pkgconfig|'  /usr/ports/graphics/png/work/libpng-1.5.15/CMakeLists.txt
===>   png-1.5.15 depends on file: /usr/local/bin/cmake - found
===>  Configuring for png-1.5.15
===>  Performing in-source build
/bin/mkdir -p /usr/ports/graphics/png/work/libpng-1.5.15
-- The C compiler identification is GNU 4.2.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found ZLIB: /usr/lib/libz.so (found version "1.2.7") 
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_CXX_COMPILER
    CMAKE_CXX_FLAGS
    CMAKE_CXX_FLAGS_DEBUG
    CMAKE_CXX_FLAGS_RELEASE
    CMAKE_C_FLAGS_DEBUG
    CMAKE_MODULE_LINKER_FLAGS
    THREADS_HAVE_PTHREAD_ARG


-- Build files have been written to: /usr/ports/graphics/png/work/libpng-1.5.15
===>  Building for png-1.5.15
Scanning dependencies of target png15_static
Scanning dependencies of target png15
[  9%] Building C object CMakeFiles/png15_static.dir/png.o
[  9%] Building C object CMakeFiles/png15.dir/pngerror.o
[ 12%] Building C object CMakeFiles/png15_static.dir/pngerror.o
[ 15%] Building C object CMakeFiles/png15_static.dir/pngget.o
[  3%] Building C object CMakeFiles/png15.dir/png.o
[ 18%] Building C object CMakeFiles/png15.dir/pngget.o
[ 28%] Building C object CMakeFiles/png15.dir/pngpread.o
[ 34%] Building C object CMakeFiles/png15.dir/pngrtran.o
[ 43%] Building C object CMakeFiles/png15_static.dir/pngrio.o
[ 40%] Building C object CMakeFiles/png15.dir/pngread.o
[ 34%] Building C object CMakeFiles/png15_static.dir/pngmem.o
[ 34%] Building C object CMakeFiles/png15_static.dir/pngread.o
[ 46%] Building C object CMakeFiles/png15_static.dir/pngrtran.o
[ 28%] Building C object CMakeFiles/png15.dir/pngmem.o
[ 40%] Building C object CMakeFiles/png15.dir/pngrio.o
[ 50%] Building C object CMakeFiles/png15_static.dir/pngpread.o
[ 53%] Building C object CMakeFiles/png15_static.dir/pngrutil.o
[ 56%] Building C object CMakeFiles/png15.dir/pngrutil.o
[ 59%] Building C object CMakeFiles/png15_static.dir/pngset.o
/usr/ports/graphics/png/work/libpng-1.5.15/pngset.c: In function 'png_set_text_2':
/usr/ports/graphics/png/work/libpng-1.5.15/pngset.c:703: warning: comparison is always false due to limited range of data type
/usr/ports/graphics/png/work/libpng-1.5.15/pngset.c: In function 'png_set_sPLT':
/usr/ports/graphics/png/work/libpng-1.5.15/pngset.c:992: warning: comparison is always false due to limited range of data type
/usr/ports/graphics/png/work/libpng-1.5.15/pngset.c: In function 'png_set_unknown_chunks':
/usr/ports/graphics/png/work/libpng-1.5.15/pngset.c:1212: warning: comparison is always false due to limited range of data type
[ 62%] Building C object CMakeFiles/png15.dir/pngset.o
/usr/ports/graphics/png/work/libpng-1.5.15/pngset.c: In function 'png_set_text_2':
/usr/ports/graphics/png/work/libpng-1.5.15/pngset.c:703: warning: comparison is always false due to limited range of data type
/usr/ports/graphics/png/work/libpng-1.5.15/pngset.c: In function 'png_set_sPLT':
/usr/ports/graphics/png/work/libpng-1.5.15/pngset.c:992: warning: comparison is always false due to limited range of data type
/usr/ports/graphics/png/work/libpng-1.5.15/pngset.c: In function 'png_set_unknown_chunks':
/usr/ports/graphics/png/work/libpng-1.5.15/pngset.c:1212: warning: comparison is always false due to limited range of data type
[ 68%] Building C object CMakeFiles/png15.dir/pngtrans.o
[ 68%] Building C object CMakeFiles/png15_static.dir/pngtrans.o
[ 71%] Building C object CMakeFiles/png15_static.dir/pngwio.o
[ 75%] Building C object CMakeFiles/png15.dir/pngwio.o
[ 81%] Building C object CMakeFiles/png15.dir/pngwrite.o
[ 84%] Building C object CMakeFiles/png15.dir/pngwtran.o
[ 78%] Building C object CMakeFiles/png15_static.dir/pngwrite.o
[ 87%] Building C object CMakeFiles/png15_static.dir/pngwtran.o
[ 90%] Building C object CMakeFiles/png15_static.dir/pngwutil.o
[ 93%] Building C object CMakeFiles/png15.dir/pngwutil.o
Linking C shared library libpng15.so
[ 93%] Built target png15
Scanning dependencies of target pngtest
Scanning dependencies of target pngvalid
[ 96%] Building C object CMakeFiles/pngtest.dir/pngtest.o
[100%] Building C object CMakeFiles/pngvalid.dir/contrib/libtests/pngvalid.o
Linking C static library libpng15.a
[100%] Built target png15_static
Linking C executable pngtest
[100%] Built target pngtest
Linking C executable pngvalid
[100%] Built target pngvalid
Running tests...
Test project /usr/ports/graphics/png/work/libpng-1.5.15
    Start 1: pngtest
1/2 Test #1: pngtest ..........................***Failed    0.01 sec
    Start 2: pngvalid
2/2 Test #2: pngvalid .........................   Passed   15.91 sec

50% tests passed, 1 tests failed out of 2

Total Test time (real) =  15.92 sec

The following tests FAILED:
	  1 - pngtest (Failed)
Errors while running CTest
*** [test] Error code 8
1 error
*** [post-build] Error code 1

Stop in /usr/ports/graphics/png.
*** [build] Error code 1

Stop in /usr/ports/graphics/png.
```


----------



## wblock@ (May 11, 2013)

When was the last time you updated ports?  Have you been following /usr/ports/UPDATING?


----------



## roens (May 11, 2013)

Well, via cron, I've got my ports tree updating weekly with `/usr/sbin/portsnap cron && /usr/sbin/portsnap update`. And from what I can tell, that is being successful.

Before my reply to this thread, I did check UPDATING (and other similar files in /usr/ports) for any mention of things related to graphics/png/libpng. But I only see mentions that libpng had itself been updated in ports and that dependent ports should also be updated (with `portmaster -r png-` or the like). But that's about it, that I could find.

I'm currently using portmaster-3.16, and FreeBSD 9.1-RELEASE-p3.


----------



## wblock@ (May 11, 2013)

roens said:
			
		

> Well, via cron, I've got my ports tree updating weekly with `/usr/sbin/portsnap cron && /usr/sbin/portsnap update`. And from what I can tell, that is being successful.



Sorry, I meant when was the last time you updated installed applications?  /usr/ports/UPDATING sometimes has general instructions for changes that need to be made to the ports infrastructure or build dependencies that need to be reinstalled or modified.

So /usr/ports/UPDATING should be checked for changes before installing any new ports, or ideally after updating the ports tree.


----------



## roens (May 13, 2013)

Yes, thank you for the reminder that updating ports in FreeBSD isn't quite as simple as merely updating them. I should check in with UPDATING more. (â€¦and just discovered `pkg updating` for parsing down the list to what is relevant.)

However, in spite of checking with UPDATING *and* attempting to apply changes/reinstalls/etc mentioned there (back to when I first set up this machine: Jan 2012), I still cannot get libpng to install because it fails its own pngtest. It fails even when run manually:


```
root@fs:/usr/ports/graphics/png/work/libpng-1.5.15# 29> ./pngtest 

 Testing libpng version 1.5.15
   with zlib   version 1.2.7

libpng version 1.5.12 - July 11, 2012
Copyright (c) 1998-2012 Glenn Randers-Pehrson
Copyright (c) 1996-1997 Andreas Dilger
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
 library (10512): libpng version 1.5.12 - July 11, 2012

 pngtest (10515): libpng version 1.5.15 - March 28, 2013
Warning: versions are different between png.h and png.c
  png.h version: 1.5.15
  png.c version: 1.5.12


 Testing pngtest.png:
 Testing pngtest.png:
 Pass 0: rwrwrwrwrwrwrwrwrw
 Pass 1: rwrwrwrwrwrwrwrwrw
 Pass 2: rwrwrwrwrwrwrwrw
 Pass 3: rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
 Pass 4: rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
 Pass 5: rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
         rwrwrwrw
 Pass 6: rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
         rwrwrwrwrw
 Testing pngtest.png:
 PASS (9782 zero samples)
 Filter 0 was used 21 times
 Filter 1 was used 15 times
 Filter 2 was used 52 times
 Filter 3 was used 10 times
 Filter 4 was used 33 times
 tIME = 7 Jun 1996 17:58:08 +0000
 libpng FAILS test
```

This would appear to me to be date related, given the test's output. But the embedded dates in the pngtest.png it created has the date it was created (today).

I have tried reinstalling/updating other ports, as per relevant listings in /usr/ports/UPDATING. All compile *and* install without trouble, unless libpng is among the required ports. I've been prodding at this for days, trying to work from what information I can find (both on the system and online).

In any case, I've added to this thread, reaching out to the community, in attempt to find help with getting libpng to compile *and* install.


----------



## kpa (May 13, 2013)

> Warning: versions are different between png.h and png.c



Try to uninstall the old version of the package before compiling a new one, by force if necessary. To me it looks like the compilation of the new package has picked up a wrong version of the png.h file from /usr/local/include.

These kinds of problems will go away if you start using a package builder like ports-mgmt/poudriere-devel that always guarantee a clean build environment.


----------



## roens (May 13, 2013)

Oh man, thanks. I did miss noticing that. Indeed, PNG does now compile/test/install without issue, after removing the already installed version.

Being more familiar with Linux (Debian *and* variants), I'm still learning my way around FreeBSD (mostly enjoying it). It has been fairly confusing, how to manage ports/packages. I began with info from the Handbook, then realized info there is a mix of current/out-of-date/misleading info. I've lately been using portmaster for managing ports. How does poudriere compare to portmaster? It looks like it'd be more than I should require?


----------



## kpa (May 13, 2013)

Using it is not that difficult but first you have to get yourself familiar with FreeBSD jail(8)s and how they work. When you have a package builder working you can then update your system by updating the ports tree, running the package builder in the jail using `poudriere bulk` command to get the updated packages built and lastly install them on the host system using `pkg upgrade`. 

I have written a HOWTO on the subject, see http://forums.freebsd.org/showthread.php?t=38859

This is also a real problem with the graphics/png port, it should still build correctly even if the old version of the package is installed on the host system. I suggest filing a PR.


----------



## kb6rxe (May 15, 2013)

*solved*

Uninstalling PNG before making PNG solved my problem.
Thanks.


----------



## roens (May 27, 2013)

Well, that was unexpected. This "problem" occurred for me again. (libpng got updated in ports, and so portmaster tried to upgrade it, along with many other installed ports.) So, I finally created a PR. But the response seems to be (strangely) that "upgrading is not supported" .. or that the person responding to the report thinks I'm attempting to update a very old version of libpng. This certainly is not the case with my latest encounter with the problem (updated previous release to current).

I just thought I'd again reach out to the community here since I seem to be afforded no capacity to add comment to the now suspended PR.


----------

