# Porting Grass7



## pieside (Jun 10, 2016)

It's been while now Grass7 (https://grass.osgeo.org) is released and I would like to port it on the ports tree. Actually, only the version 6 is available: databases/grass. This port is unmaintained.

I never ported a software before and I'm not really sure how to proceed. I think the best way is to create a new port: databases/grass7. This way, the two versions can cohabit. Do you think it's the best way to work?

Moreover, and in order to avoid duplicated work, I would like to know if someone is already working on this update and if so, how can I contribute.


----------



## vejnovic (Jun 10, 2016)

pieside said:


> I never ported a software before and I'm not really sure how to proceed.



https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/book.html


----------



## NewGuy (Jun 11, 2016)

I agree with regards to creating a new port for grass7. It is nice to have two copies, one that is known to work and a new one for new/experimental features. The grass6 port will probably be a good place to start looking to learn how to put together a port.


----------



## bart (Nov 2, 2016)

As GIS user, I tried also to port Grass7 without success... I also agree to have both port grass6 and grass7.
What is your progress with it?


----------



## pieside (Nov 3, 2016)

I'm always struggling with the issue detailed here: Thread 56766. To summarize, I understand that we need to correctly set 
	
	



```
CONFIGURE_TARGET
```
 but I'm not able to figure it out. It's really great that you are also trying to port Grass. Why are you not able to do it?


----------



## acheron (Nov 5, 2016)

Here is a quick port, it survives poudriere testport but it's untested. It's mostly a copy'n'paste of databases/grass:
https://github.com/MikaelUrankar/grass7

There are a few issues (sqlite is pulled in and it shouldn't). Feel free to finish the work.


----------



## bart (Nov 6, 2016)

I will test it tomorrow. Thanks.


----------



## pieside (Nov 7, 2016)

I'm able to compile Grass7 but, when called, Grass doesn't find wxpython. On the previous version, this file lives in /usr/local/grass-6.4.3/gui. With Grass7, it seems it lives in /usr/local/grass7.2.0RC1. I tried to change the folder name to remove the RC1 part (i.e. grass7.2.0) but it doesn't work and I presume it's not the recommended way to solve this issue.


----------



## acheron (Nov 7, 2016)

There is a problem somewhere (tm), try to patch this file /usr/local/bin/grass72 with:

```
--- /usr/local/bin/grass72      2016-11-05 14:16:05.000000000 +0100 
+++ /usr/local/bin/grass72      2016-11-07 16:24:33.426890000 +0100 
@@ -102,7 +102,7 @@ if 'GISBASE' in os.environ: 
    # possibly same for GRASS_PROJSHARE and others but maybe not 
    gisbase = os.environ['GISBASE'] 
else: 
-    gisbase = "//grass-7.2.0RC1" 
+    gisbase = "/usr/local/grass-7.2.0RC1" 
cmd_name = "grass72" 
grass_version = "7.2.0RC1" 
ld_library_path_var = 'LD_LIBRARY_PATH'
```


----------



## acheron (Nov 10, 2016)

I've updated my port, it should work now.
If you have an error about Numpy put this env variable in your shell GRASS_WXVERSION 3.0.2.0


----------



## bart (Nov 11, 2016)

Tested and it works! Thank you!

Except that I still have an error about Numpy even if I did something like
`export GRASS_WXVERSION=3.0.2.0`
or
`export GRASS_WXVERSION=3.0.2`
or
`export GRASS_WXVERSION=`wxgtk2u-3.0-config --version``

Also, some modules aren't built/installed (v.buffer for example).

I can't investigate it this week.

Regards.


----------



## pieside (Dec 26, 2016)

The Numpy error seems to happen during the compilation. The module is not imported. It looks like it's linked with GCC:

```
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/gcc49/libgfortran.so.3 not found
```


----------



## acheron (Dec 27, 2016)

pieside said:


> The Numpy error seems to happen during the compilation. The module is not imported. It looks like it's linked with GCC:
> 
> ```
> File "/usr/local/lib/python2.7/site-packages/numpy/core/__init__.py", line 14, in <module>
> ...


It's just the nonsense we have with base libgcc vs ports libgcc... You can workaround it by putting the correct mapping for libgcc in /etc/libmap.conf


----------



## bart (Jul 21, 2017)

Any news?
I've tried to build the acheron's port on poudriere for 11amd64 (I've launched built for 10,11,12 amd64/i386 this night, so wait.) without success 
You can see log here

Regards!


----------



## bart (Jul 22, 2017)

Here a fork from the acheron's port: https://github.com/lbartoletti/grass7


----------



## acheron (Jul 22, 2017)

I've updated my port, some work is still needed.


----------



## bart (Jul 23, 2017)

With your help, I think I'm very close to achieving this goal.
Still a problem with gcc/fortran and other minor problems. How do you configure libmap for this?


----------



## acheron (Jul 23, 2017)

You need something like this:

```
libgcc_s.so.1   gcc49/libgcc_s.so.1
libgomp.so.1    gcc49/libgomp.so.1
libssp.so.0     gcc49/libssp.so.0
libstdc++.so.6  gcc49/libstdc++.so.6
```


----------



## bart (Jul 23, 2017)

It works!
Just some missing modules.


----------



## bart (Jul 23, 2017)

I have update my ports and doesn't build on poudriere, as you can see on the log... I stop it for today.


----------



## acheron (Jul 24, 2017)

env: python: No such file or directory. That is your problem, this is why I put (as a workaround) a dependency to lang/python


----------



## bart (Aug 3, 2017)

The package is now available!
Thanks for your help acheron!


----------

