pgcc unknown switch [libpng-1.2.44]

Hi,

I am having issues compiling libpng and receiving this error upon make check:

make check
source=‘png.c’ object=‘libpng12_la-png.lo’ libtool=yes
DEPDIR=.deps depmode=none /bin/sh ./depcomp
/bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c -o libpng12_la-png.lo test -f 'png.c' || echo './'png.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c png.c -DPIC -o .libs/libpng12_la-png.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c png.c -o libpng12_la-png.o >/dev/null 2>&1
source=‘pngset.c’ object=‘libpng12_la-pngset.lo’ libtool=yes
DEPDIR=.deps depmode=none /bin/sh ./depcomp
/bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c -o libpng12_la-pngset.lo test -f 'pngset.c' || echo './'pngset.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngset.c -DPIC -o .libs/libpng12_la-pngset.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngset.c -o libpng12_la-pngset.o >/dev/null 2>&1
source=‘pngget.c’ object=‘libpng12_la-pngget.lo’ libtool=yes
DEPDIR=.deps depmode=none /bin/sh ./depcomp
/bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c -o libpng12_la-pngget.lo test -f 'pngget.c' || echo './'pngget.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngget.c -DPIC -o .libs/libpng12_la-pngget.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngget.c -o libpng12_la-pngget.o >/dev/null 2>&1
source=‘pngrutil.c’ object=‘libpng12_la-pngrutil.lo’ libtool=yes
DEPDIR=.deps depmode=none /bin/sh ./depcomp
/bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c -o libpng12_la-pngrutil.lo test -f 'pngrutil.c' || echo './'pngrutil.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngrutil.c -DPIC -o .libs/libpng12_la-pngrutil.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngrutil.c -o libpng12_la-pngrutil.o >/dev/null 2>&1
source=‘pngtrans.c’ object=‘libpng12_la-pngtrans.lo’ libtool=yes
DEPDIR=.deps depmode=none /bin/sh ./depcomp
/bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c -o libpng12_la-pngtrans.lo test -f 'pngtrans.c' || echo './'pngtrans.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngtrans.c -DPIC -o .libs/libpng12_la-pngtrans.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngtrans.c -o libpng12_la-pngtrans.o >/dev/null 2>&1
source=‘pngwutil.c’ object=‘libpng12_la-pngwutil.lo’ libtool=yes
DEPDIR=.deps depmode=none /bin/sh ./depcomp
/bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c -o libpng12_la-pngwutil.lo test -f 'pngwutil.c' || echo './'pngwutil.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngwutil.c -DPIC -o .libs/libpng12_la-pngwutil.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngwutil.c -o libpng12_la-pngwutil.o >/dev/null 2>&1
source=‘pngread.c’ object=‘libpng12_la-pngread.lo’ libtool=yes
DEPDIR=.deps depmode=none /bin/sh ./depcomp
/bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c -o libpng12_la-pngread.lo test -f 'pngread.c' || echo './'pngread.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngread.c -DPIC -o .libs/libpng12_la-pngread.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngread.c -o libpng12_la-pngread.o >/dev/null 2>&1
source=‘pngrio.c’ object=‘libpng12_la-pngrio.lo’ libtool=yes
DEPDIR=.deps depmode=none /bin/sh ./depcomp
/bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c -o libpng12_la-pngrio.lo test -f 'pngrio.c' || echo './'pngrio.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngrio.c -DPIC -o .libs/libpng12_la-pngrio.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngrio.c -o libpng12_la-pngrio.o >/dev/null 2>&1
source=‘pngwio.c’ object=‘libpng12_la-pngwio.lo’ libtool=yes
DEPDIR=.deps depmode=none /bin/sh ./depcomp
/bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c -o libpng12_la-pngwio.lo test -f 'pngwio.c' || echo './'pngwio.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngwio.c -DPIC -o .libs/libpng12_la-pngwio.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngwio.c -o libpng12_la-pngwio.o >/dev/null 2>&1
source=‘pngwrite.c’ object=‘libpng12_la-pngwrite.lo’ libtool=yes
DEPDIR=.deps depmode=none /bin/sh ./depcomp
/bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c -o libpng12_la-pngwrite.lo test -f 'pngwrite.c' || echo './'pngwrite.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngwrite.c -DPIC -o .libs/libpng12_la-pngwrite.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngwrite.c -o libpng12_la-pngwrite.o >/dev/null 2>&1
source=‘pngrtran.c’ object=‘libpng12_la-pngrtran.lo’ libtool=yes
DEPDIR=.deps depmode=none /bin/sh ./depcomp
/bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c -o libpng12_la-pngrtran.lo test -f 'pngrtran.c' || echo './'pngrtran.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngrtran.c -DPIC -o .libs/libpng12_la-pngrtran.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngrtran.c -o libpng12_la-pngrtran.o >/dev/null 2>&1
source=‘pngwtran.c’ object=‘libpng12_la-pngwtran.lo’ libtool=yes
DEPDIR=.deps depmode=none /bin/sh ./depcomp
/bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c -o libpng12_la-pngwtran.lo test -f 'pngwtran.c' || echo './'pngwtran.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngwtran.c -DPIC -o .libs/libpng12_la-pngwtran.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngwtran.c -o libpng12_la-pngwtran.o >/dev/null 2>&1
source=‘pngmem.c’ object=‘libpng12_la-pngmem.lo’ libtool=yes
DEPDIR=.deps depmode=none /bin/sh ./depcomp
/bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c -o libpng12_la-pngmem.lo test -f 'pngmem.c' || echo './'pngmem.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngmem.c -DPIC -o .libs/libpng12_la-pngmem.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngmem.c -o libpng12_la-pngmem.o >/dev/null 2>&1
source=‘pngerror.c’ object=‘libpng12_la-pngerror.lo’ libtool=yes
DEPDIR=.deps depmode=none /bin/sh ./depcomp
/bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c -o libpng12_la-pngerror.lo test -f 'pngerror.c' || echo './'pngerror.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngerror.c -DPIC -o .libs/libpng12_la-pngerror.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngerror.c -o libpng12_la-pngerror.o >/dev/null 2>&1
source=‘pngpread.c’ object=‘libpng12_la-pngpread.lo’ libtool=yes
DEPDIR=.deps depmode=none /bin/sh ./depcomp
/bin/sh ./libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c -o libpng12_la-pngpread.lo test -f 'pngpread.c' || echo './'pngpread.c
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngpread.c -DPIC -o .libs/libpng12_la-pngpread.o
libtool: compile: cc -DHAVE_CONFIG_H -I. -DPNG_CONFIGURE_LIBPNG -g -c pngpread.c -o libpng12_la-pngpread.o >/dev/null 2>&1
rm -f libpng.sym libpng.sym.new
cc -E -DPNG_CONFIGURE_LIBPNG -DPNG_BUILDSYMS ./png.h |
/usr/bin/sed -n -e
‘s|^.PNG_FUNCTION_EXPORT[ ]([’_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789’]).$|\1|p’
-e ‘s|^.PNG_DATA_EXPORT[ ]([’_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789’]).$|\1|p’
libpng.sym.new
PREPRO-I-0222-Redundant definition for symbol __THROW (/opt/cray/xe-sysroot/4.0.46.securitypatch.20120828/usr/include/sys/cdefs.h: 63)
PREPRO-I-0222-Redundant definition for symbol extension (/opt/cray/xe-sysroot/4.0.46.securitypatch.20120828/usr/include/sys/cdefs.h: 327)
PREPRO-I-0222-Redundant definition for symbol PNG_READ_INTERLACING_SUPPORTED (./pngconf.h: 669)
mv libpng.sym.new libpng.sym
rm -f libpng.vers libpng.vers.new
echo PNG12_0 ‘{global:’ > libpng.vers.new
/usr/bin/sed s/$/;/ libpng.sym >> libpng.vers.new
echo ‘local: *; };’ >> libpng.vers.new
mv libpng.vers.new libpng.vers
/bin/sh ./libtool --tag=CC --mode=link cc -g -no-undefined -export-dynamic -version-number 0:44:0 -Wl,–version-script=libpng.vers -o libpng12.la -rpath /usr/local/grib2/libpng-1.2.44/lib libpng12_la-png.lo libpng12_la-pngset.lo libpng12_la-pngget.lo libpng12_la-pngrutil.lo libpng12_la-pngtrans.lo libpng12_la-pngwutil.lo libpng12_la-pngread.lo libpng12_la-pngrio.lo libpng12_la-pngwio.lo libpng12_la-pngwrite.lo libpng12_la-pngrtran.lo libpng12_la-pngwtran.lo libpng12_la-pngmem.lo libpng12_la-pngerror.lo libpng12_la-pngpread.lo -lz
libtool: link: cc -shared .libs/libpng12_la-png.o .libs/libpng12_la-pngset.o .libs/libpng12_la-pngget.o .libs/libpng12_la-pngrutil.o .libs/libpng12_la-pngtrans.o .libs/libpng12_la-pngwutil.o .libs/libpng12_la-pngread.o .libs/libpng12_la-pngrio.o .libs/libpng12_la-pngwio.o .libs/libpng12_la-pngwrite.o .libs/libpng12_la-pngrtran.o .libs/libpng12_la-pngwtran.o .libs/libpng12_la-pngmem.o .libs/libpng12_la-pngerror.o .libs/libpng12_la-pngpread.o -lz -lc --version-script=libpng.vers -soname libpng12.so.0 -o .libs/libpng12.so.0.44.0
pgcc-Error-Unknown switch: --version-script=libpng.vers
make: *** [libpng12.la] Error 1

Hi isuclim13,

It looks like libtool is stripping off the “-Wl,” before passing “–version-script=libpng.vers” to pgcc. The “-Wl” flag tells the compiler to pass this the flag to the linker. Since “-Wl” gets removed, the compiler doesn’t know what to do with the flag.

The quick solution would be to add the PGI flag “-noswitcherror” so the compiler simply ignores the unknown flag. However, this may cause other issues depending upon how necessary the version script is.

Otherwise, you’ll need to contact libtool or the libpng folks. I did see a similar error with OpenMPI which was solved by updating the version of libtool used, but I don’t know if this would solve your issue.

  • Mat

Hi mkcolg,

Thanks for the reply. This fix appears to have worked as it compiled and everything looks in place. Make check failed when running test-pngtest.sh (core dumped) but this appears to be a bug inherent to the version of libpng I am using. Thanks again for your help.

Cheers.