(crosspost) Has anyone else tried native compiling WriteFreely in Windows? I have and I'm stuck

ED: crossposted from github here: (Has anyone else tried native compiling WriteFreely in Windows? I have and I'm stuck · writefreely/writefreely · Discussion #664 · GitHub) after I re-read contribute.md saw that there is ALSO a discussion forum here for development.

Having read that the windows build done through the xgo container cross compiler is still bork I thought I’d try and compile natively in Windows.

So - following: Development Setup — WriteFreely Documentation

  • git clone - OK (actually I checked out v0.13.2 which is the version I have running in linux so I could do apples 2 apples.
  • go-bindata: all the go-bindata forks either mentioned or specified (jteeuwen, shuLman etc.) were incompatible. go get -u github.com/go-bindata/go-bindata/... works.
  • go-bindata -pkg writefreely -ignore=\\.gitignore schema.sql sqlite.sql - OK: 15314 bindata.go
  • go build -v -tags='sqlite' ./cmd/writefreely/

So, including sqlite support I get this compile error:

PS D:\writefreely> go build -v -tags='sqlite' ./cmd/writefreely/
github.com/writefreely/writefreely
# github.com/writefreely/writefreely
.\database-sqlite.go:39:30: undefined: sqlite3.Error
.\database-sqlite.go:40:31: undefined: sqlite3.ErrConstraint

Leaving OUT the sqlite3 support with just go build -v ./cmd/writefreely/ works fine and I get a binary:

PS D:\writefreely> go build -v ./cmd/writefreely/
PS D:\writefreely> dir *.exe


    Directory: D:\writefreely


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        2023-03-25   2:52 PM       40258048 writefreely.exe

BUT, fire up MySQL, create the schema with CREATE DATABASE writefreely CHARACTER SET latin1 COLLATE latin1_swedish_ci;, we get this when we try and writefreely db init:

PS D:\writefreely> ./writefreely.exe db init
2023/03/25 14:54:17 Loading config.ini configuration...
2023/03/25 14:54:17 Connecting to mysql database...
2023/03/25 14:54:17 Creating table accesstokens...
ERROR: 2023/03/25 14:54:17 app.go:903: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE IF NOT EXISTS `appcontent` (
  `id` varchar(36) NOT NULL,
  `cont' at line 28
2023/03/25 14:54:17 Initializing appmigrations table...
2023/03/25 14:54:17 Closing database connection...
ERROR: 2023/03/25 14:54:17 main.go:120: Unable to set initial migrations: Error 1146: Table 'writefreely.appmigrations' doesn't exist

Now, I can create the schema manually by importing the schema.sql directly and THAT works, though I get a bunch of 1681 integer display width is deprecated and will be removed in a future release warnings.

So firing up writefreely, it starts and listens but:

PS D:\writefreely> ./writefreely.exe
2023/03/25 14:58:18 Starting WriteFreely 0.13.2...
2023/03/25 14:58:18 Loading config.ini configuration...
2023/03/25 14:58:18 Loading templates...
2023/03/25 14:58:18 Loading pages...
2023/03/25 14:58:18 Loading user pages...
2023/03/25 14:58:18 Loading encryption keys...
2023/03/25 14:58:18 Connecting to mysql database...
2023/03/25 14:58:18 Adding {domain} routes (single user)...
ERROR: 2023/03/25 14:58:18 database.go:808: Failed selecting from collections: Error 1054: Unknown column 'post_signature' in 'field list'
2023/03/25 14:58:18 Going to serve...
2023/03/25 14:58:18 Serving on http://localhost:80
2023/03/25 14:58:18 ---
ERROR: 2023/03/25 14:58:28 database.go:808: Failed selecting from collections: Error 1054: Unknown column 'post_signature' in 'field list'
ERROR: 2023/03/25 14:58:28 handle.go:533: [Web handler] 500: Error 1054: Unknown column 'post_signature' in 'field list'
2023/03/25 14:58:28 Web internal error render
2023/03/25 14:58:28 "GET /" 500 4.7388ms "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"
2023/03/25 14:58:28 http: superfluous response.WriteHeader call from github.com/writeas/impart.writeBody (response.go:31)

Any ideas? I’m slowly unrusting some very ancient developer skills here and my Go is nonexistent, Ill keep plugging away at it, but I feel either of these problems are something more familiar with the package cough @matt cough would take a look at and know what is wrong immediately or give me a hint. Really would prefer to get this package building in Windows, its just a more convenient development envirofor me.

1 Like