Opened 4 years ago

Last modified 5 months 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 4 years ago.
Error log

Download all attachments as: .zip

Change History (26)

Changed 4 years ago by pieside

Attachment: error.log added

Error log

comment:1 Changed 4 years ago by neteler

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 Changed 4 years ago by 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'
/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?

comment:3 in reply to:  2 ; Changed 4 years ago by 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.

comment:4 in reply to:  3 Changed 3 years ago by mmetz

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 Changed 3 years ago by martinl

Milestone: 7.0.47.0.5

comment:6 Changed 3 years ago by pieside

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 Changed 3 years ago by neteler

Milestone: 7.0.57.0.6

comment:8 Changed 2 years ago by 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 :)

Thanks!

comment:9 Changed 2 years ago by lbartoletti

Cc: lbartoletti added
Milestone: 7.0.67.2.2
Version: 7.0.37.2.0

comment:10 in reply to:  8 Changed 2 years ago by neteler

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 Changed 2 years ago by lbartoletti

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

comment:12 in reply to:  11 Changed 2 years ago by neteler

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.

comment:13 in reply to:  11 Changed 2 years ago by mmetz

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

comment:14 in reply to:  3 Changed 2 years ago by mmetz

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 Changed 2 years ago by lbartoletti

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.

comment:16 in reply to:  15 ; Changed 2 years ago by 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.

comment:17 in reply to:  16 ; Changed 2 years ago by lbartoletti

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

comment:18 in reply to:  17 ; Changed 2 years ago by neteler

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?

comment:19 in reply to:  18 Changed 2 years ago by mmetz

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 Changed 2 years ago by neteler

Milestone: 7.2.27.2.3

Ticket retargeted after milestone closed

comment:21 Changed 19 months ago by neteler

Anything left here?

comment:22 in reply to:  21 Changed 19 months ago by mmetz

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 Changed 18 months ago by martinl

Milestone: 7.2.3

Ticket retargeted after milestone closed

comment:24 Changed 18 months ago by martinl

Milestone: 7.2.4

comment:25 Changed 5 months ago by neteler

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.