Monday | 15 APR 2024
[ previous ]
[ next ]

Building Netsurf - Unsuccessfully

Date: 2022-08-02

How to build netsurf for Windows on WSL2

This didn't work but it'd be good to have this when I inevitably try again.

This is a hodgepodge of notes.

Helpfull commands to know

$ apt-cache search mingw
$ ls /usr/bin/x86_64-w64-mingw32-* | grep gcc

First Step

$ sudo apt-get update
$ sudo apt-get install texinfo
$ sudo apt-get install gcc-mingw-w64 binutils-mingw-w64 win-iconv-mingw-w64-dev 

I installed these but not sure if it was required

$ sudo apt-get install mingw-w64-tools mingw-w64

Install expat - an xml parser library for netsurf

$ git clone
$ cd libexpat/expat
$ ./
$ ./configure --host=x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32/
$ make
$ sudo make install
$ wget
$ unset HOST
$ export HOST=x86_64-w64-mingw32
$ source
$ ns-package-install

// Sourcing of the is adding in netsurf specific commands

$ ns-clone
$ ns-pull-install
$ rm
$ cd ~/dev-netsurf/workspace
$ export HOST=x86_64-w64-mingw32
$ source
$ cd netsurf
$ cat Makefile.defaults

// Disable things you don't want

$ export MINGW_PREFIX=x86_64-w64-mingw32-
$ export MINGW_INSTALL_ENV=/usr/x86_64-w64-mingw32/
# inside Makefile, don't use pkg_config_find_and_add, copy the mint curl option
$  make TARGET=windows PREFIX=/usr/x86_64-w64-mingw32/

copied the makefile from the toolchains folder and trying that, I overwrote the original makefile which could be a problem.... - crap toolchain seems to be building everything itself. Was i wasting my time?


$ wget
$ tar xvf c-ares-1.18.1.tar.gz
$ cd c-ares-1.18.1
$ export HOST=x86_64-w64-mingw32
$ ./configure --prefix=/usr/x86_64-w64-mingw32/ --host=x86_64-w64-mingw32

Might be needed
$ ln -s /usr/x86_64-w64-mingw32/lib/libmsvcrt.a  /usr/x86_64-w64-mingw32/lib/libc.a

$ make
$ sudo make install


$ cd ~/bp
$ wget
$ LDFLAGS=-mwindows ./configure --prefix=/usr/x86_64-w64-mingw32/ --host=x86_64-w64-mingw32 --disable-shared --disable-ldap --without-random --with-openssl
$ make
$ sudo make install


$ vim /etc/apt/sources.list
// Add deb-src 
deb-src focal main restricted

$ cd ~/bp
$ apt-get source zlib
$ cd zlib-1.2.11.dfsg/
$ CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-gcc-ar RANLIB=x86_64-w64-mingw32-gcc-ranlib CFLAGS="-DNO_FSEEKO" ./configure --prefix=/usr/x86_64-w64-mingw32/
#update Make file -lc to -lmsvcrt.a
$ make
$sudo make install


$ cd ~/bp
$ wget
$ tar xvf libiconv-1.17.tar.gz
$ ./configure --prefix=/usr/x86_64-w64-mingw32/ --host=x86_64-w64-mingw32 --disable-shared
$ make
$ sudo make install


$ sudo ln -s /usr/bin/x86_64-w64-mingw32-windres /usr/bin/windres 

$ cd ~/bp
$ wget wget
$ tar xvf openssl-1.0.0a.tar.gz
$ cd openssl-1.0.0a

This might be optional - I originally tried to use the latest version of opensll and installed wine to get headers
$ sudo apt-get install libwine-dev
# update /home/nivethan/bp/openssl-1.1.1q/apps/openssl.rc
# change the include to the path through wine
#include "/usr/include/wine/wine/windows/winver.h"

#update winver.h to use absolute path
#include "/usr/include/wine/wine/windows/verrsrc.h"

# had to update the Configure script to remove -mno-cygwin

$ PATH=/usr/x86_64-w64-mingw32/bin/:$PATH ./Configure no-shared disable-capieng --prefix=/usr/x86_64-w64-mingw32/ mingw64
$ PATH=/usr/x86_64-w64-mingw32/bin/:$PATH make CC=x86_64-w64-mingw32-gcc RANLIB=x86_64-w64-mingw32-gcc-ranlib
$ sudo make install_sw # install without man pages


$ tar xvf mingw-libgnurx-2.5.1-src.tar.gz
$ cd mingw-libgnurx-2.5.1/
$ ./configure --prefix=/usr/x86_64-w64-mingw32/ --host=x86_64-w64-mingw32
$ make
$ sudo make install


$ wget
$ tar xvf jpegsrc.v8d.tar.gz
$ cd jpeg-8d/
$ ./configure --prefix=/usr/x86_64-w64-mingw32/ --host=x86_64-w64-mingw32 --disable-shared
$ make
$ sudo make install


$ tar xvf libpng-1.4.12.tar.gz
$ ./configure --prefix=/usr/x86_64-w64-mingw32/ --host=x86_64-w64-mingw32
$ make
$ sudo make install


$ sudo apt-get install build-essential autoconf automake autogen flex bison
$ sudo apt-get install libtool texinfo help2man subversion cvs git
$ sudo apt-get install lhasa unzip autoconf2.64 automake1.11
$ sudo apt-get install automake-1.15

$ git clone git://
$ cd toolchains
$ make -C x86_64-w64-mingw32
$ GCCSDK_INSTALL_CROSSBIN=/opt/netsurf/i686-w64-mingw32/cross/bin GCCSDK_INSTALL_ENV=/opt/netsurf/i686-w64-mingw32/env make -C sdk