# lang/python33 fails to compile.



## srobert (May 17, 2013)

If you have both lang/python27 and lang/python33 installed, you may get an error in compilation from recent updates to the ports. To work around it, try the following as root.

Prior to building lang/python33:

```
#cd /usr/local/bin
#ls -l python
```

If this shows that /usr/local/bin/python is a link: 

```
#lrwxr-xr-x  1 root  wheel  7 May 17 09:37 python -> python2
```
then remove the link before compiling 

```
#rm python
#cd /usr/ports/lang/python33
#make clean
#make config
```
After selecting your preferences in the configuration:

```
#make build
#make install clean
```
Then restore the link:

```
#cd /usr/local/bin
#ln -s python2 python
```


----------



## Grell (May 18, 2013)

Don't know, I tried what the OP laid out. I am still getting compilation errors.


----------



## srobert (May 19, 2013)

Grell said:
			
		

> Don't know, I tried what the OP laid out. I am still getting compilation errors.



They updated the port again last night, so I'm not sure if it's still necessary to take the steps from my previous post or not, but it doesn't hurt. 
I was able to get the (newly updated) port to compile (again) by taking some additional steps. 

You might try this:

```
#cd /usr/ports/lang/python33
#make clean
#make extract
#cd work/Python-3.3.2
#./configure
#make
#cd Grammar
#chmod 755 Grammar
#cd ../../..
#make install clean
```
I hope that helps. The reason I did the `chmod` is because the error messages from the compilation seemed to indicate that the Grammar file needed to be executable. 
I haven't notified the maintainer yet that I had these troubles.


----------



## wmoreno3 (May 21, 2013)

This is my procedure:

```
uname -a
FreeBSD mydomain 9.1-RELEASE-p3 FreeBSD 9.1-RELEASE-p3 #0: Mon Apr 29 18:27:25 UTC 2013     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

portsclean -C -D -DD
portsnap fetch update
portmaster -a

pkg info | grep py
py27-gdbm-2.7.5_2              Python bindings to the GNU dbm library
py27-libxml2-2.8.0             Python interface for XML parser library for GNOME
py27-sqlite3-2.7.5_3           Standard Python binding to the SQLite3 library
py27-tkinter-2.7.5_4           Python bindings to the Tk widget set
python27-2.7.5                 Interpreted object-oriented programming language

cd /usr/ports/lang/python33
make clean
make config
make
```
First `make` seems at my report to python team
	
	



```
http://bugs.python.org/issue18008#msg189524
```
Second `make` displays:

```
make
...
Parser/pgen
`Parser/pgen' is up to date.
Parser/pgen ./../Grammar/Grammar Include/graminit.h Python/graminit.c
Parser/pgen: Permission denied
*** [Include/graminit.h] Error code 126
1 error
*** [Python/importlib.h] Error code 2
Parser/pgen ./../Grammar/Grammar Include/graminit.h Python/graminit.c
1 error
*** [do-build] Error code 1

Stop in /usr/ports/lang/python33.
*** [build] Error code 1

Stop in /usr/ports/lang/python33.
```
Third `make` and then install, display as:

```
make
...
Python build finished, but the necessary bits to build these modules were not found:
spwd
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

Failed to build these modules:
_dbm

make install clean

===>   Registering installation for python33-3.3.2
pkg: lstat(/usr/local/lib/python3.3/lib-dynload/_dbm.so): No such file or directory
Installing python33-3.3.2... done
```
I hope this help others to fix this issue.
I think that is a regresion bug about "Do not run pgen during the build if files are up to date"


----------



## wmoreno3 (May 21, 2013)

wmoreno3 said:
			
		

> This is my procedure:
> 
> ```
> uname -a
> ...



This issue was [SOLVED on FreeBSD 9.1] see: http://www.freshports.org/lang/python33/ for details.


----------

