# Running into build errors when trying to build chromium with pulseaudio support



## rockzombie2 (Oct 27, 2021)

Hello! So I've gotten part way through building chromium via `doas make MAKE_JOBS_UNSAFE=yes install clean`. Now I'm encountering this error and I'm not sure what is the root cause of it.

Any suggestions on how to debug?

```
Traceback (most recent call last):
  File "/usr/ports/www/chromium/work/chromium-92.0.4515.159/buildtools/freebsd/clang-format", line 37, in <module>
    sys.stdout.write(stdout)
TypeError: write() argument must be str, not bytes
Traceback (most recent call last):
  File "/usr/ports/www/chromium/work/chromium-92.0.4515.159/buildtools/freebsd/clang-format", line 37, in <module>
    sys.stdout.write(stdout)
TypeError: write() argument must be str, not bytes
Traceback (most recent call last):
  File "/usr/ports/www/chromium/work/chromium-92.0.4515.159/buildtools/freebsd/clang-format", line 37, in <module>
    sys.stdout.write(stdout)
TypeError: write() argument must be str, not bytes
Traceback (most recent call last):
  File "/usr/ports/www/chromium/work/chromium-92.0.4515.159/buildtools/freebsd/clang-format", line 37, in <module>
    sys.stdout.write(stdout)
TypeError: write() argument must be str, not bytes
Traceback (most recent call last):
  File "/usr/ports/www/chromium/work/chromium-92.0.4515.159/buildtools/freebsd/clang-format", line 37, in <module>
    sys.stdout.write(stdout)
TypeError: write() argument must be str, not bytes
ninja: build stopped: subcommand failed.

Stop.
make[1]: stopped in /usr/ports/www/chromium
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/www/chromium
*** Error code 1
```


----------



## eternal_noob (Oct 27, 2021)

Googling this error suggests that this is the fault of your Python installation. Maybe try to update Python?


----------



## rockzombie2 (Oct 27, 2021)

That was my impression from Googling as well, however I 1. don't know how exactly to update python and 2. don't know which version of python it's using. I'm assuming 3.8:


```
chris@nzxt /u/h/chris> pkg info | grep python
py37-dnspython-1.16.0          DNS toolkit for Python
py38-dnspython-1.16.0          DNS toolkit for Python
python-3.8_3,2                 "meta-port" for the default version of Python interpreter
python27-2.7.18_1              Interpreted object-oriented programming language
python3-3_3                    Meta-port for the Python interpreter 3.x
python37-3.7.12                Interpreted object-oriented programming language
python38-3.8.12                Interpreted object-oriented programming language
chris@nzxt /u/h/chris> python --version
Python 3.8.12
```


----------



## SirDice (Oct 27, 2021)

The default Python version is 3.8 at the moment. It switched from 3.7 some time ago. Looks like you haven't cleaned up and removed the old Python yet. 

Always read /usr/ports/UPDATING:

```
20210425:
  AFFECTS: users of python
  AUTHOR: kai@FreeBSD.org

  The default version of python3 and python was switched to 3.8.

  For ports users wanting to keep version 3.7 as default,
  add DEFAULT_VERSIONS+= python=3.7 python3=3.7 to make.conf

  Following procedures may ease the upgrade:

  For users of pre-build packages:
  # sh
  # for i in $(pkg query -g %n 'py37-*'); do pkg set -yn ${i}:py38-${i#py37-}; done
  # pkg upgrade

  For portmaster users:
  # sh
  # portmaster -o lang/python38 python37
  # REINSTALL="$(pkg info -o "*py37*" | awk '{printf "%s ", $2}')"
  # pkg delete -f "*py37*"
  # portmaster $REINSTALL
  # REBUILD=$(pkg query -g "%n:%dn" '*' | grep py3 | grep -v py38 | cut -d : -f 1 | sort -u)
  # portmaster $REBUILD
  # REBUILD2=$(pkg list | grep python-37 | xargs pkg which | awk '{print $6}' | sort -u)
  # portmaster $REBUILD2
```


----------



## rockzombie2 (Oct 28, 2021)

So I tried running the command mentioned in that UPDATING guide, but I ended up just removing python37 altogether:



> chris@nzxt /u/p/w/chromium [1]> pkg info | grep python
> py38-dnspython-1.16.0          DNS toolkit for Python
> python-3.8_3,2                 "meta-port" for the default version of Python interpreter
> python27-2.7.18_1              Interpreted object-oriented programming language
> ...



I don't think that fixed anything because I'm running into the same issue building chromium.


----------



## eternal_noob (Oct 28, 2021)

Maybe just remove python27-2.7.18_1 too?


----------



## rockzombie2 (Oct 28, 2021)

Ah yeah, I guess that's a good idea. I removed it and then got this instead:

`FileNotFoundError: [Errno 2] No such file or directory: 'python2.7'`

So I guess it was dependent on 2.7. I cleaned and am remaking it again now, which takes a while. I'll update once it succeeds or errors out.


----------



## rockzombie2 (Oct 28, 2021)

Same error: `TypeError: write() argument must be str, not bytes`


----------



## grahamperrin@ (Oct 30, 2021)

rockzombie2 said:


> … I guess it was dependent on 2.7. …



True. <https://www.freshports.org/www/chromium/#requiredbuild>



rockzombie2 said:


> … not sure what is the root cause …



Which version of FreeBSD?

`freebsd-version -kru`

`uname -aKU`



rockzombie2 said:


> `… chromium-92.0.4515.159 …`



When did you last update your ports tree?

<https://www.freshports.org/www/chromium/#history> we're at `94.0.4606.81_1`.


----------



## rockzombie2 (Oct 30, 2021)

freebsd-version -kru:


> 13.0-RELEASE-p4
> 13.0-RELEASE-p4
> 13.0-RELEASE-p4


uname -aKU:


> FreeBSD nzxt 13.0-RELEASE-p4 FreeBSD 13.0-RELEASE-p4 #0: Tue Aug 24 07:33:27 UTC 2021     root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64 1300139 1300139





grahamperrin said:


> When did you last update your ports tree?



Huh, I thought I updated it recently with `portsnap fetch` but mine is showing an older version. This is in my Makefile:


> PORTNAME=    chromium
> PORTVERSION=    92.0.4515.159



Let me try to update it. Is there a way of updating it minus a specific package? I don't want to wipe out my dwm changes again.


----------

