graphics/png does not build with lang/gcc

b. f. bf1783 at googlemail.com
Fri Mar 9 00:10:17 UTC 2012


On 3/8/12, Tijl Coosemans <tijl at coosemans.org> wrote:
> On Thursday 08 March 2012 11:10:42 Gautam wrote:
>> On Thu, Mar 8, 2012 at 3:39 PM, Gautam <list at execve.net> wrote:
>>> On Wed, Mar 7, 2012 at 5:41 PM, b. f. <bf1783 at googlemail.com> wrote:
>>>>> On Mon, Feb 27, 2012 at 9:51 PM, Gautam <list at execve.net> wrote:
>>>>> Should I file a PR for this?
>>>>
>>>> There are some unresolved problems with stack protection, but you
>>>> should not have to encounter them when building this port.  The custom
>>>> gcc article that you are attempting to use was written at a time when
>>>> some of the related port Makefiles had some shortcomings that no
>>>> longer exist, and is not the recommended way to use lang/gcc* for
>>>> ports.  For all but a handful of ports that lang/gcc* depends upon, or
>>>> those that don't respect the toolchain-related variables, you can just
>>>> install lang/gcc or lang/gcc46 and set USE_GCC=4.6 in your build
>>>> environment, an included Makefile, or on the command line. I have been
>>>> building graphics/png in this way for years.  You can and should
>>>> dispense with the libmap.conf additions, the hardcoded CC, CXX, and
>>>> CPP in make.conf, etc.
>>>
>>> Thanks for your comments. I now tried this on the fresh 9.0-REL system I
>>> created, -- I cleared out make.conf, deleted libmap.conf. The problem
>>> still
>>> exists. Any pointers?
>>>
>>> Here is the log:
>>>
>>> uname -a
>>>
>>> FreeBSD vmboX 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:15:25 UTC
>>> 2012     root at obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>>> vmboX# pkg_version -0v [K [Kv
>>>
>>> binutils-2.22                       <   needs updating (port has 2.22_1)
>>> gcc-4.6.2                           <   needs updating (port has 4.6.2_1)
>>> gmp-5.0.2                           <   needs updating (port has 5.0.3)
>>> libiconv-1.13.1_1                   =   up-to-date with port
>>> mpc-0.9                             =   up-to-date with port
>>> mpfr-3.1.0_2                        =   up-to-date with port
>>> vmboX# cd /etc
>>>
>>>  vmboX# cat /etc/make.conf
>>>
>>> vmboX# cat /etc/liba [Kmap.conf
>>>
>>> cat: /etc/libmap.conf: No such file or directory
>>>
>>> vmboX# cd /usr/ports/graphics/png
>>>
>>> vmboX# make clean
>>>
>>> ===>  Cleaning for png-1.4.8_1
>>>
>>> vmboX# env USE_GCC=4.6 make
>>>
>>> ===>  Vulnerability check disabled, database not found
>>>
>>> ===>  License check disabled, port has not defined LICENSE
>>> ===>  Found saved configuration for png-1.4.8_1
>>> ===>  Extracting for png-1.4.8_1
>>>
>>> => SHA256 Checksum OK for libpng-1.4.8.tar.xz.
>>> => SHA256 Checksum OK for libpng-1.4.8-apng.patch.gz.
>>> /bin/cp /usr/ports/distfiles//libpng-1.4.8-apng.patch.gz
>>> /usr/ports/graphics/png/work/libpng-1.4.8/
>>> /usr/bin/gzip -nf -9 -d
>>> /usr/ports/graphics/png/work/libpng-1.4.8/libpng-1.4.8-apng.patch.gz
>>> ===>  Patching for png-1.4.8_1
>>> ===>  Applying extra patch
>>> /usr/ports/graphics/png/work/libpng-1.4.8/libpng-1.4.8-apng.patch
>>> ===>  Applying FreeBSD patches for png-1.4.8_1
>>> ===>   png-1.4.8_1 depends on executable: gcc46 - found
>>> ===>   png-1.4.8_1 depends on file: /usr/local/bin/as - found
>>> ===>  Configuring for png-1.4.8_1
>>> ===>  Building for png-1.4.8_1
>>> ( cat scripts/libpng-config-head.in;  echo prefix=\"/usr/local\";  echo
>>> libdir=\"/usr/local/lib\";  echo ccopts=\"-O2 -pipe
>>> -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing\";  echo
>>> cppflags=\"\";  echo I_opts=\"-I/usr/local/include/libpng\";  echo
>>> L_opts=\"-L/usr/local/lib\";  echo libs=\"-lpng -lz -lm\";  echo
>>> ldopts=\"-Wl,-rpath=/usr/local/lib/gcc46\";  cat scripts/
>>> libpng-config-body.in ) > libpng-config
>>> chmod +x libpng-config
>>> gcc46 -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing  -I.
>>> -std=gnu99 -fstack-protector  -c png.c
>>> gcc46 -fpic -DPIC -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46
>>> -fno-strict-aliasing  -I. -std=gnu99 -fstack-protector  -c png.c -o
>>> png.So
>>> gcc46 -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing  -I.
>>> -std=gnu99 -fstack-protector  -c pngset.c
>>> gcc46 -fpic -DPIC -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46
>>> -fno-strict-aliasing  -I. -std=gnu99 -fstack-protector  -c pngset.c -o
>>> pngset.So
>>> gcc46 -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing  -I.
>>> -std=gnu99 -fstack-protector  -c pngget.c
>>> gcc46 -fpic -DPIC -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46
>>> -fno-strict-aliasing  -I. -std=gnu99 -fstack-protector  -c pngget.c -o
>>> pngget.So
>>> gcc46 -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing  -I.
>>> -std=gnu99 -fstack-protector  -c pngrutil.c
>>> gcc46 -fpic -DPIC -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46
>>> -fno-strict-aliasing  -I. -std=gnu99 -fstack-protector  -c pngrutil.c -o
>>> pngrutil.So
>>> gcc46 -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing  -I.
>>> -std=gnu99 -fstack-protector  -c pngtrans.c
>>> gcc46 -fpic -DPIC -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46
>>> -fno-strict-aliasing  -I. -std=gnu99 -fstack-protector  -c pngtrans.c -o
>>> pngtrans.So
>>> gcc46 -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing  -I.
>>> -std=gnu99 -fstack-protector  -c pngwutil.c
>>> gcc46 -fpic -DPIC -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46
>>> -fno-strict-aliasing  -I. -std=gnu99 -fstack-protector  -c pngwutil.c -o
>>> pngwutil.So
>>> gcc46 -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing  -I.
>>> -std=gnu99 -fstack-protector  -c pngread.c
>>> gcc46 -fpic -DPIC -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46
>>> -fno-strict-aliasing  -I. -std=gnu99 -fstack-protector  -c pngread.c -o
>>> pngread.So
>>> gcc46 -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing  -I.
>>> -std=gnu99 -fstack-protector  -c pngrio.c
>>> gcc46 -fpic -DPIC -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46
>>> -fno-strict-aliasing  -I. -std=gnu99 -fstack-protector  -c pngrio.c -o
>>> pngrio.So
>>> gcc46 -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing  -I.
>>> -std=gnu99 -fstack-protector  -c pngwio.c
>>> gcc46 -fpic -DPIC -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46
>>> -fno-strict-aliasing  -I. -std=gnu99 -fstack-protector  -c pngwio.c -o
>>> pngwio.So
>>> gcc46 -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing  -I.
>>> -std=gnu99 -fstack-protector  -c pngwrite.c
>>> gcc46 -fpic -DPIC -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46
>>> -fno-strict-aliasing  -I. -std=gnu99 -fstack-protector  -c pngwrite.c -o
>>> pngwrite.So
>>> gcc46 -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing  -I.
>>> -std=gnu99 -fstack-protector  -c pngrtran.c
>>> gcc46 -fpic -DPIC -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46
>>> -fno-strict-aliasing  -I. -std=gnu99 -fstack-protector  -c pngrtran.c -o
>>> pngrtran.So
>>> gcc46 -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing  -I.
>>> -std=gnu99 -fstack-protector  -c pngwtran.c
>>> gcc46 -fpic -DPIC -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46
>>> -fno-strict-aliasing  -I. -std=gnu99 -fstack-protector  -c pngwtran.c -o
>>> pngwtran.So
>>> gcc46 -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing  -I.
>>> -std=gnu99 -fstack-protector  -c pngmem.c
>>> gcc46 -fpic -DPIC -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46
>>> -fno-strict-aliasing  -I. -std=gnu99 -fstack-protector  -c pngmem.c -o
>>> pngmem.So
>>> gcc46 -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing  -I.
>>> -std=gnu99 -fstack-protector  -c pngerror.c
>>> gcc46 -fpic -DPIC -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46
>>> -fno-strict-aliasing  -I. -std=gnu99 -fstack-protector  -c pngerror.c -o
>>> pngerror.So
>>> gcc46 -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing  -I.
>>> -std=gnu99 -fstack-protector  -c pngpread.c
>>> gcc46 -fpic -DPIC -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46
>>> -fno-strict-aliasing  -I. -std=gnu99 -fstack-protector  -c pngpread.c -o
>>> pngpread.So
>>>
>>> gzip -cn libpng.3 > libpng.3.gz
>>> gzip -cn libpngpf.3 > libpngpf.3.gz
>>> gzip -cn png.5 > png.5.gz
>>> gcc46 -O2 -pipe -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing  -I.
>>> -std=gnu99 -fstack-protector  -c pngtest.c
>>> building static png library
>>> /usr/local/bin/ranlib libpng.a
>>> building shared library libpng.so.6
>>> pngread.So: In function `png_create_read_struct_2':
>>> pngread.c:(.text+0x4da): undefined reference to `__stack_chk_fail_local'
>>> pngrutil.So: In function `png_inflate':
>>> pngrutil.c:(.text+0x168): undefined reference to `__stack_chk_fail_local'
>>> pngrutil.So: In function `png_decompress_chunk':
>>> pngrutil.c:(.text+0x79c): undefined reference to `__stack_chk_fail_local'
>>> pngrutil.So: In function `.L72':
>>> pngrutil.c:(.text+0x9cb): undefined reference to `__stack_chk_fail_local'
>>> pngrutil.So: In function `png_handle_cHRM':
>>> pngrutil.c:(.text+0x15fe): undefined reference to
>>> `__stack_chk_fail_local'
>>> pngrutil.So:pngrutil.c:(.text+0x1b99): more undefined references to
>>> `__stack_chk_fail_local' follow
>>>
>>> collect2: ld returned 1 exit status
>>> *** Error code 1
>>> 1 error
>>> *** Error code 1
>>>
>>> Stop in /usr/ports/graphics/png.
>>> *** Error code 1
>>>
>>> Stop in /usr/ports/graphics/png.
>>> vmboX#
>
> It's /usr/share/bsd.sys.mk that is adding the -fstack-protector flag.
> You can disable it with "env USE_GCC=4.6 WITHOUT_SSP=yes make".
>
> This has been fixed in GCC 4.7 but hasn't been backported to 4.6 yet.
>

Yes, thanks, I told him that off-list, shortly after his earlier
message. I had forgotten that that workaround was necessary in some
cases.

 I was a bit surprised to learn that gcc r183670 and allied changes
hadn't been merged to the 4.6 branch in some form before the new
release.

b.


More information about the freebsd-ports mailing list