Opened 8 years ago

Last modified 5 years ago

#2940 new defect

Compiling Grass-7.0.3 under FreeBSD: tplot directory (with log)

Reported by: pieside Owned by: grass-dev@…
Priority: normal Milestone: 8.0.0
Component: Python Version: svn-trunk
Keywords: FreeBSD Cc: lbartoletti
CPU: x86-64 Platform: Other Unix

Description

Dear all,

I'm trying to compile Grass-7.0.3 under FreeBSD (with Zsh) and the compilation stops in

include/Make/GuiScript.make:37: recipe for target 'g.gui.tplot.tmp.html' failed include/Make/GuiScript.make:23: recipe for target 'guiscript' failed

Here you can find the log created by running

cd grass-7.0.3/gui/wxpython/tplot &&
make
gmake /home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/docs/html/g.gui.tplot.html
gmake[1]: Entering directory '/home/pierre/tmp/grass7/grass-7.0.3/gui/wxpython/tplot'
GISRC=/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/demolocation/.grassrc70 GISBASE=/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2 PATH="/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/bin:/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/bin:/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/scripts:$PATH" PYTHONPATH="/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/etc/python:/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/gui/wxpython:$PYTHONPATH" LD_LIBRARY_PATH="/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/bin:/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/bin:/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/scripts:/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/lib:/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/lib:" LC_ALL=C /home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/scripts/g.gui.tplot --html-description < /dev/null | grep -v '</body>\|</html>' > g.gui.tplot.tmp.html
Traceback (most recent call last):
  File "/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/scripts/g.gui.tplot", line 131, in <module>
    main()
  File "/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/scripts/g.gui.tplot", line 78, in main
    options, flags = gscript.parser()
  File "/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/etc/python/grass/script/core.py", line 712, in parser
    p = subprocess.Popen([prog, '-n'] + argv, stdout=subprocess.PIPE)
  File "/usr/local/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/local/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
../../../include/Make/GuiScript.make:37: recipe for target 'g.gui.tplot.tmp.html' failed
gmake[1]: *** [g.gui.tplot.tmp.html] Error 1
rm g.gui.tplot.tmp.html
gmake[1]: Leaving directory '/home/pierre/tmp/grass7/grass-7.0.3/gui/wxpython/tplot'
../../../include/Make/GuiScript.make:23: recipe for target 'guiscript' failed
gmake: *** [guiscript] Error 2

What do you think about all that?

Thank you,

Pierre.

Attachments (1)

error.log (19.7 KB ) - added by pieside 8 years ago.
Error log

Download all attachments as: .zip

Change History (26)

by pieside, 8 years ago

Attachment: error.log added

Error log

comment:1 by neteler, 8 years ago

From the log I see that the first error came up in

/home/pierre/tmp/grass7/grass-7.0.3/lib/vector/diglib

Please run

cd /home/pierre/tmp/grass7/grass-7.0.3/lib/vector/diglib
make

to see what's missing. Likewise for the others. Note that later errors may result from previous ones since some libraries such as above are a dependency for subsequent code.

comment:2 by pieside, 8 years ago

The problems seems to be an old friend:

/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/lib/libgrass_gis.7.0.3.so: undefined reference to `libiconv'
/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/lib/libgrass_gis.7.0.3.so: undefined reference to `libiconv_open'
/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/lib/libgrass_gis.7.0.3.so: undefined reference to `libiconv_close'

As written in the Porter's Handbook (https://www.freebsd.org/doc/en/books/porters-handbook/index.html), there are two versions of libiconv in FreeBSD: "FreeBSD 10-CURRENT and newer versions have a native iconv in the operating system (in libc). On earlier versions, converters/libiconv was used as a dependency". So we have a System iconv and Libiconv iconv (/usr/local/include/iconv.h).

One way to overcome this is to deinstall and remove /usr/local/include/iconv.h. But some really important softwares depend on it: "Despite the default implementation of iconv enabled by default in libc, a few ports (like http://www.freshports.org/devel/glib20/) depend on converters/libiconv again due to missing functionality in the base iconv implementation" (written in the /usr/ports/UPDATING file).

Another solution is suggested in this post (http://osdir.com/ml/grass-development-gis/2014-12/msg00435.html). I did add "ICONVLIB = -liconv" in include/Make/Platform.make but it doesn't compile for me.

What all this evoke to you?

in reply to:  2 ; comment:3 by glynn, 8 years ago

Replying to pieside:

The problems seems to be an old friend:

/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/lib/libgrass_gis.7.0.3.so: undefined reference to `libiconv'

This usually means that it's including <iconv.h> from libiconv but linking against the system iconv (which may be part of libc).

One way to solve issues with multiple library versions is to create "include" and "lib" directories, populate them with symlinks to the desired versions of the headers and libraries, and use --with-includes= and --with-libs= to put those directories at the front of the search path.

in reply to:  3 comment:4 by mmetz, 8 years ago

Replying to glynn:

Replying to pieside:

The problems seems to be an old friend:

/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/lib/libgrass_gis.7.0.3.so: undefined reference to `libiconv'

This usually means that it's including <iconv.h> from libiconv but linking against the system iconv (which may be part of libc).

One way to solve issues with multiple library versions is to create "include" and "lib" directories, populate them with symlinks to the desired versions of the headers and libraries, and use --with-includes= and --with-libs= to put those directories at the front of the search path.

You can also configure GRASS, then manually edit include/Make/Platform.make and set

ICONVLIB            = 

to

ICONVLIB            = -liconv

Most of GRASS then compiles for me on FreeBSD 10.3 with both clang and gcc, with the exception of wxnviz and the temporal modules (problem with numpy + ctypes), but that is a different problem.

comment:5 by martinl, 8 years ago

Milestone: 7.0.47.0.5

comment:6 by pieside, 8 years ago

I can continue compiling by editing /include/Make/Platform.make:

ICONVLIB = -liconv

But, as you said, others errors arise and I'm wondering if using the FreeBSD ports tree would not help us to compile Grass7 on this OS. In order to avoid duplicated work, I inform the GRASS community that I'm trying to do it. For now, I'm not pretty sure how, so I'm completely opened to suggestions.

I've also opened a ticket on the FreeBSD forum: https://forums.freebsd.org/threads/56558/.

comment:7 by neteler, 7 years ago

Milestone: 7.0.57.0.6

comment:8 by lbartoletti, 7 years ago

Hi,

I've tried to build grass 7.2 on our poudriere system (FreeBSD 11 amd 64 without success). Here the log and the discussion on FreeBSD Forum.

I can't be present at FOSS4G-E code sprint, but if something can help us :)

Thanks!

comment:9 by lbartoletti, 7 years ago

Cc: lbartoletti added
Milestone: 7.0.67.2.2
Version: 7.0.37.2.0

in reply to:  8 comment:10 by neteler, 7 years ago

Replying to lbartoletti:

Hi,

I've tried to build grass 7.2 on our poudriere system (FreeBSD 11 amd 64 without success). Here the log and the discussion on FreeBSD Forum.

I can't be present at FOSS4G-E code sprint, but if something can help us :)

Yes :)

So, the log contains:

env: python: No such file or directory

The reason is that there is not link from python2.7 --> python on your system (or it is not in $PATH), so that the first line in GRASS' Python scripts fails:

#!/usr/bin/env python

A lot of the errors there might be secondary ones due to this link missing. Can you add this link, try again and report here?

comment:11 by lbartoletti, 7 years ago

Normally, Python is already present. It does not matter, I'll start from scratch. Here's what I get by compiling directly log.

That's how I configured it:

./configure --with-includes=/usr/local/include --with-libs=/usr/local/lib --with-freetype-includes=/usr/local/include/freetype2 --with-cairo --with-nls --with-cxx --with-readline --with-proj-share=/usr/local/share/proj

and the log for it

in reply to:  11 comment:12 by neteler, 7 years ago

Replying to lbartoletti:

Normally, Python is already present. It does not matter, I'll start from scratch. Here's what I get by compiling directly log.

Here is a line from your log, appearing for most t.* modules:

gmake[5]: Entering directory '/usr/home/Loic/grass7/work/grass-7.2.0/temporal/t.create'
/usr/bin/install -c  t.create.py /usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/scripts/t.create
if [ "/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/scripts/t.create" != "" ] ; then GISRC=/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/demolocation/.grassrc72 GISBASE=/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0 PATH="/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/bin:/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/bin:/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/scripts:$PATH" PYTHONPATH="/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/etc/python:/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/gui/wxpython:$PYTHONPATH" LD_LIBRARY_PATH="/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/bin:/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/bin:/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/scripts:/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/lib:/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/lib:" LC_ALL=C /usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/scripts/t.create --html-description < /dev/null | grep -v '</body>\|</html>' > t.create.tmp.html ; fi
Traceback (most recent call last):
  File "/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/scripts/t.create", line 62, in <module>
    import grass.temporal as tgis
  File "/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/etc/python/grass/temporal/__init__.py", line 3, in <module>
    from .core import *
  File "/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/etc/python/grass/temporal/core.py", line 45, in <module>
    from .c_libraries_interface import *
  File "/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/etc/python/grass/temporal/c_libraries_interface.py", line 28, in <module>
    from grass.pygrass.rpc.base import RPCServerBase
  File "/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/etc/python/grass/pygrass/rpc/__init__.py", line 21, in <module>
    from grass.pygrass.vector import *
  File "/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/etc/python/grass/pygrass/vector/__init__.py", line 13, in <module>
    from grass.pygrass.vector.vector_type import VTYPE
  File "/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/etc/python/grass/pygrass/vector/vector_type.py", line 9, in <module>
    from grass.pygrass.vector import geometry as geo
  File "/usr/home/Loic/grass7/work/grass-7.2.0/dist.amd64-portbld-freebsd11.0/etc/python/grass/pygrass/vector/geometry.py", line 12, in <module>
    import numpy as np
  File "/usr/local/lib/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/usr/local/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/usr/local/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/usr/local/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/usr/local/lib/python2.7/site-packages/numpy/core/__init__.py", line 14, in <module>
    from . import multiarray
ImportError: /lib/libgcc_s.so.1: version GCC_4.6.0 required by /usr/local/lib/gcc5/libgfortran.so.3 not found
gmake[5]: *** [../..//include/Make/Html.make:14: t.create.tmp.html] Error 1

... to be fixed on your server.

in reply to:  11 comment:13 by mmetz, 7 years ago

Replying to lbartoletti:

Normally, Python is already present.

... but not the link python -> python2

You need to pkg install python

this creates that link (at least on FreeBSD 12).

It does not matter, I'll start from scratch.

No need to start from scratch, just run gmake again.

I get GRASS trunk (7.3) compiled on FreeBSD 12 without errors. GRASS is running, but there is no GUI because there is a problem with numpy:

ImportError: /lib/libgcc_s.so.1: version GCC_4.6.0 required by /usr/local/lib/gcc5/libgfortran.so.3 not found

That seems to be an error in the numpy/gcc ports because a gcc5 lib requires a gcc4 lib which seems odd.

Here's what I get by compiling directly log.

That's how I configured it:

./configure --with-includes=/usr/local/include --with-libs=/usr/local/lib --with-freetype-includes=/usr/local/include/freetype2 --with-cairo --with-nls --with-cxx --with-readline --with-proj-share=/usr/local/share/proj

and the log for it

in reply to:  3 comment:14 by mmetz, 7 years ago

Replying to glynn:

Replying to pieside:

The problems seems to be an old friend:

/home/pierre/tmp/grass7/grass-7.0.3/dist.x86_64-unknown-freebsd10.2/lib/libgrass_gis.7.0.3.so: undefined reference to `libiconv'

This usually means that it's including <iconv.h> from libiconv but linking against the system iconv (which may be part of libc).

Both the configure tests and the compilation use the same CPPFLAGS "-I/usr/local/include", i.e. the libiconv version of iconv.h should be found first for both configure and compilation. The problem is that configure tests for iconv() include /usr/include/iconv.h from libc despite CPPFLAGS while the actual compilation includes /usr/local/include/iconv.h from libiconv which requires linking against libiconv.

One way to solve issues with multiple library versions is to create "include" and "lib" directories, populate them with symlinks to the desired versions of the headers and libraries, and use --with-includes= and --with-libs= to put those directories at the front of the search path.

Or ensure that configure tests and compilation use the same order of include dirs.

comment:15 by lbartoletti, 7 years ago

Hello,

Good news, it's works! :) https://raw.githubusercontent.com/lbartoletti/grass7/master/grass_freebsd.png

There was an error in the configuration for the package and also some grass' files need to be patched.

After the review, the FreeBSD package will be available soon!

You can close this ticket.

Thanks.

in reply to:  15 ; comment:16 by mmetz, 7 years ago

Replying to lbartoletti:

Hello,

Good news, it's works! :)

There was an error in the configuration for the package and also some grass' files need to be patched.

Could you point to or attach the patches? Maybe we can include them in GRASS.

in reply to:  16 ; comment:17 by lbartoletti, 7 years ago

Replying to mmetz:

Replying to lbartoletti:

Hello,

Good news, it's works! :)

There was an error in the configuration for the package and also some grass' files need to be patched.

Could you point to or attach the patches? Maybe we can include them in GRASS.

The most changes to the sources is to replace hardcoded python to the specific version used. You can see all changes on Makefile and patches

The package is now available on FreeBSD.

To install the port: cd /usr/ports/databases/grass7/ && make install clean

To add the package: pkg install grass7

in reply to:  17 ; comment:18 by neteler, 7 years ago

Replying to lbartoletti:

The most changes to the sources is to replace hardcoded python to the specific version used.

@devs: do we want this upstream?

https://svnweb.freebsd.org/ports/head/databases/grass7/Makefile?view=markup

You can see all changes on Makefile and patches

I see specifically these patches:

# test writable check change

https://svnweb.freebsd.org/ports/head/databases/grass7/files/patch-include_Make_Install.make?view=markup

# ctypes GCC flag change:

https://svnweb.freebsd.org/ports/head/databases/grass7/files/patch-lib_python_ctypes_ctypesgencore_parser_preprocessor.py?view=markup

but I am not sure if to be updated in G7 or not - any dev having a suggestion?

in reply to:  18 comment:19 by mmetz, 7 years ago

Replying to neteler:

Replying to lbartoletti:

The most changes to the sources is to replace hardcoded python to the specific version used.

This can be avoided with pkg install python which does not install python, but creates a link to a specific python version: python -> python2

@devs: do we want this upstream?

https://svnweb.freebsd.org/ports/head/databases/grass7/Makefile?view=markup

You can see all changes on Makefile and patches

I see specifically these patches:

# test writable check change

https://svnweb.freebsd.org/ports/head/databases/grass7/files/patch-include_Make_Install.make?view=markup

This patch removes the writable check. IMHO it is a good idea to have this check.

# ctypes GCC flag change:

https://svnweb.freebsd.org/ports/head/databases/grass7/files/patch-lib_python_ctypes_ctypesgencore_parser_preprocessor.py?view=markup

Added to trunk and relbr72 in r71356,7 (applied only for FreeBSD).

comment:20 by neteler, 7 years ago

Milestone: 7.2.27.2.3

Ticket retargeted after milestone closed

comment:21 by neteler, 6 years ago

Anything left here?

in reply to:  21 comment:22 by mmetz, 6 years ago

Replying to neteler:

Anything left here?

According to Python PEP 394, we need to decide if we replace the shebang #!/usr/bin/env python with #!/usr/bin/env python2 or #!/usr/bin/env python3. This applies not only to FreeBSD, but also to Linux distros.

comment:23 by martinl, 6 years ago

Milestone: 7.2.3

Ticket retargeted after milestone closed

comment:24 by martinl, 6 years ago

Milestone: 7.2.4

comment:25 by neteler, 5 years ago

Component: DefaultPython
Milestone: 7.2.48.0.0
Version: 7.2.0svn-trunk

Bumped to 8.0.0 for python3 shebang

Note: See TracTickets for help on using tickets.