Bug 195090

Summary: databases/postgis21 and graphics/geos: Error on install : /usr/bin/ld: cannot find -lstdc++
Product: Ports & Packages Reporter: martin
Component: Individual Port(s)Assignee: Po-Chuan Hsieh <sunpoet>
Status: Closed FIXED    
Severity: Affects Many People CC: martin, trevor
Priority: ---    
Version: Latest   
Hardware: i386   
OS: Any   

Description martin 2014-11-17 01:50:44 UTC
Hello,

Go easy on me here - first time reporting what looks like a bug.  I was on 9.1 and had a disaster hardware crash (2 drives - what luck - in RAID 5).  Anyhow, my data was backed up.  I reinstalled 9.1 from CD but had issues with re-installing Postgis and Geos.  So I upgraded (might as well) to 10.1 release but still get the issue below.  I tried compiling Geos pkg from source (no luck).  It's the gcc linker that keeps complaining about the lstdc++ library not being there and it is correct.  If I look in /usr/bin, I do not see that library. ???

Any help is appreciated.

om.a geomgraph/.libs/libgeomgraph.a index/.libs/libindex.a io/.libs/libio.a linearref/.libs/liblinearref.a noding/.libs/libnoding.a operation/.libs/liboperation.a planargraph/.libs/libplanargraph.a precision/.libs/libprecision.a simplify/.libs/libsimplify.a triangulate/.libs/libtriangulate.a util/.libs/libutil.a -Wl,--no-whole-archive -L/usr/lib -lstdc++ -lm -lc -lgcc_s /usr/lib/crtendS.o /usr/lib/crtn.o -Wl,-soname -Wl,libgeos-3.4.2.so -o .libs/libgeos-3.4.2.so

/usr/bin/ld: cannot find -lstdc++

c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[7]: *** [libgeos.la] Error 1
Comment 1 martin 2014-11-17 01:53:33 UTC
In my post, I put /usr/bin, I meant /usr/lib but I figure anyone reading this would see it was a typo.
Comment 2 martin 2014-11-18 23:27:03 UTC
I wanted to add a couple of things that I have tried:

- Checked the Makefiles for lstdc++ to comment it out and try again but the ports to not have this at all in the Makefile

- Tried doing a deinstall of libtool, verified I had the latest ports and then reinstalled libtools - no difference.  Unless I did something wrong here.

- FreeBSD database 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 22:51:51 UTC 2014     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  i386

- Finally, I also setenv: LDFLAGS=-lstdc++

Martin
Comment 3 martin 2014-11-18 23:39:34 UTC
Here are the two packages in question and the libtool version:

libtool-2.4.2.418              Generic shared library support script

geos-3.4.2.tar.bz2
postgis-1.5.3.tar.gz

Martin
Comment 4 martin 2014-11-20 15:23:42 UTC
Ok, I made headway on this... VERY STRANGE ... I found some packages that were installed to support GEOS showed a certain version with the "pkg info" command but when I tried to deinstall and make clean inside that version, it said the package was not installed.  I would then go into another port version... and THEN I could deinstall even though pkg info showed a different version.  I don't get it.  Anyhow, I deinstalled all Postgis dependencies, make clean and then reinstalled them.  NOW, the pkg info command shows the correct version and all dependencies installed without a problem (including geos).  However, I have one remaining problem:

"./liblwgeom/.libs/liblwgeom.so: undefined reference to `geos::operation::valid::IsValidOp::getValidationError()'
../liblwgeom/.libs/liblwgeom.so: undefined reference to `geos::io::WKBReader::read(std::__1::basic_istream<char, std::__1::char_traits<char> >&)'
../liblwgeom/.libs/liblwgeom.so: undefined reference to `std::terminate()'
../liblwgeom/.libs/liblwgeom.so: undefined reference to `geos::triangulate::DelaunayTriangulationBuilder::setSites(geos::geom::Geometry const&)'
../liblwgeom/.libs/liblwgeom.so: undefined reference to `geos::geom::GeometryFactory::createMultiPolygon() const'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:103: recipe for target 'shp2pgsql' failed
gmake[4]: *** [shp2pgsql] Error 1
gmake[4]: Leaving directory '/usr/ports/databases/postgis21/work/postgis-2.1.3/loader'
GNUmakefile:14: recipe for target 'all' failed
gmake[3]: *** [all] Error 1
gmake[3]: Leaving directory '/usr/ports/databases/postgis21/work/postgis-2.1.3'
"

I cannot explain this.  This is on make install clean for:
 /usr/ports/database/postgis21

Martin
Comment 5 martin 2014-11-20 15:24:40 UTC
Woops... I said:

"installed to support GEOS showed a certain"

I meant:

"installed to support Postgis21 showed a certain"
Comment 6 martin 2014-11-20 15:29:35 UTC
I just tried postgis20 and I get:

usr/local/include/iconv.h:83:48: note: passing argument to parameter 'inbuf' here
extern size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
                                               ^
shp2pgsql-core.c:108:3: warning: implicit declaration of function 'iconvctl' is invalid in C99 [-Wimplicit-function-declaration]
                iconvctl(cd, ICONV_SET_TRANSLITERATE, &on);
                ^
shp2pgsql-core.c:108:16: error: use of undeclared identifier 'ICONV_SET_TRANSLITERATE'
                iconvctl(cd, ICONV_SET_TRANSLITERATE, &on);
                             ^
shp2pgsql-core.c:109:18: warning: passing 'char **' to parameter of type 'const char **' discards qualifiers in nested pointer types
      [-Wincompatible-pointer-types-discards-qualifiers]
                if ( iconv(cd, &inputbuf, &inbytesleft, &outputptr, &outbytesleft) == -1 )
                               ^~~~~~~~~
/usr/local/include/iconv.h:83:48: note: passing argument to parameter 'inbuf' here
extern size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
                                               ^
shp2pgsql-core.c:112:17: error: use of undeclared identifier 'ICONV_SET_DISCARD_ILSEQ'
                        iconvctl(cd, ICONV_SET_DISCARD_ILSEQ, &on);
                                     ^
shp2pgsql-core.c:113:19: warning: passing 'char **' to parameter of type 'const char **' discards qualifiers in nested pointer types
      [-Wincompatible-pointer-types-discards-qualifiers]
                        if ( iconv(cd, &inputbuf, &inbytesleft, &outputptr, &outbytesleft) == -1 )
                                       ^~~~~~~~~
/usr/local/include/iconv.h:83:48: note: passing argument to parameter 'inbuf' here
extern size_t iconv (iconv_t cd, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
                                               ^
4 warnings and 2 errors generated.
Makefile:90: recipe for target 'shp2pgsql-core.o' failed
gmake[4]: *** [shp2pgsql-core.o] Error 1
gmake[4]: Leaving directory '/usr/ports/databases/postgis20/work/postgis-2.0.6/loader'
GNUmakefile:14: recipe for target 'all' failed
gmake[3]: *** [all] Error 1
gmake[3]: Leaving directory '/usr/ports/databases/postgis20/work/postg
Comment 7 martin 2014-11-20 16:32:15 UTC
Postgis ticket opened as well:

http://trac.osgeo.org/postgis/ticket/2999#comment:1
Comment 8 Mark Linimon freebsd_committer freebsd_triage 2014-11-23 05:16:25 UTC
fix Synopsis and notify maintainers.
Comment 9 martin 2014-11-23 12:59:29 UTC
Hi Mark,

Not sure by what you mean to fix synopsis.  I can definitely reduce this now to the following issue:

Makefile:90: recipe for target 'shp2pgsql-core.o' failed
gmake[4]: *** [shp2pgsql-core.o] Error 1

I've attempted Postgis 2.0, 2.1.3 and even 2.1.4 (from source).  They all give me the same error.  I can contact the port maintainer but seeing it is failing from Source (downloaded from the Postgis website), I don't think it is s port issue.

Martin
Comment 10 commit-hook freebsd_committer freebsd_triage 2014-11-24 18:30:45 UTC
A commit references this bug:

Author: sunpoet
Date: Mon Nov 24 18:30:07 UTC 2014
New revision: 373304
URL: https://svnweb.freebsd.org/changeset/ports/373304

Log:
  - Remove hard-coded -lstdc++

  PR:		ports/195090
  Submitted by:	Martin Laflamm <martin@marketbridge.com>

Changes:
  head/graphics/geos/Makefile
Comment 11 martin 2014-11-25 01:55:44 UTC
For some reason, I had managed to get geos installed after all.  However, thank you sunpoet for addressing the goes issue anyways.  Now, I have verified every single dependency (including gtk+ for shp2pgsql) for Postgis21 install.  But I still keep getting:

../liblwgeom/.libs/liblwgeom.so: undefined reference to `geos::geom::GeometryFactory::createMultiPolygon() const'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:103: recipe for target 'shp2pgsql' failed
gmake[4]: *** [shp2pgsql] Error 1
gmake[4]: Leaving directory '/usr/ports/databases/postgis21/work/postgis-2.1.3/loader'
GNUmakefile:14: recipe for target 'all' failed

At this time, the Postgis folks believe it is a Port problem.  It'd be great if we could assign this to trevor at bitba.se (port maintainer)

Martin
Comment 12 martin 2014-11-26 02:19:33 UTC
Here is the full paste bin:

http://pastebin.com/HfNZ4NPS
Comment 13 martin 2014-11-26 03:10:48 UTC
I know the shp2pgsql requires GTK so that could be the issue but it IS installed...sigh.

checking for GTK+ - version >= 2.8.0... no
*** Could not run GTK+ test program, checking why...
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means GTK+ is incorrectly installed.
CPPFLAGS:  -I/usr/local/include  -I/usr/local/include/libxml2 -I/usr/include  -I/usr/local/include

But it is installed:

oot@database:/usr/ports/databases/postgis21 # pkg info | grep gtk
gtk-update-icon-cache-2.24.25  Gtk-update-icon-cache utility from the Gtk+ toolkit
gtk3-3.14.3_1                  Gimp Toolkit for X11 GUI (current stable version)
Comment 14 martin 2014-11-28 15:14:21 UTC
See Postgis bug at:

http://trac.osgeo.org/postgis/report/3

Bug #3003

I don't know if it's a Port issue, OS issue, source issue.  Need Help.

MArtin
Comment 15 martin 2014-12-05 00:34:03 UTC
I've decided to do a fresh install a freebsd on a newer 64-bit server.  Will update this ticket when it is done.
Comment 16 martin 2014-12-14 02:29:06 UTC
Ok, I ended up doing a fresh install on a 32-bit system (because I had the chassis) of FreeBSD 9.3.  I installed Postgres 9.3 and then installed Postgis21.  It went off without a hitch!

There was definitely an issue with either the upgrade from 9.1 to 10.1 or an issue with 10.1 period.  Anyways, I'm glad it's working now!!

Martin