knadh / listmonk

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.
https://listmonk.app
GNU Affero General Public License v3.0
14.78k stars 1.35k forks source link

building from source on FreeBSD? #191

Closed Oclair closed 3 years ago

Oclair commented 4 years ago

Hi there, I attempted to build this from source on FreeBSD 12.1, I am not sure anyone has attempted this yet so I figured I would simply contribute my attempt. If support for FreeBSD is possible I would definitely be glad to give it a spin, I'm not a developer but a long time sysadmin, so I can do some hacking when needed but so far have no experience maintaining a "port". Happy to help with testing tough! Hope to hear back from you, as your project is highly regarded from some freebsd sysadmins!

OC

# pkg info python37
python37-3.7.9
Name           : python37
Version        : 3.7.9
Installed on   : Sat Aug 29 00:34:15 2020 CEST
Origin         : lang/python37
Architecture   : FreeBSD:12:amd64
Prefix         : /usr/local
Categories     : python lang
Licenses       : PSFL
Maintainer     : python@FreeBSD.org
WWW            : https://www.python.org/
Comment        : Interpreted object-oriented programming language
Options        :
        DEBUG          : off
        FNV            : off
        IPV6           : on
        NLS            : off
        PYMALLOC       : on
        SIPHASH        : off
Shared Libs required:
        libbz2.so.1
        libreadline.so.8
        libffi.so.7
Shared Libs provided:
        libpython3.7m.so.1.0
Annotations    :
        FreeBSD_version: 1201000
        cpe            : cpe:2.3:a:python:python:3.7.9:::::freebsd12:x64
Flat size      : 111MiB
Description    :
Python is an interpreted object-oriented programming language, and is
often compared to Tcl, Perl or Scheme.

WWW: https://www.python.org/
#pkg install yarn
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        node: 14.4.0
        yarn: 1.22.4_1

Number of packages to be installed: 2

The process will require 40 MiB more space.
7 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/2] Fetching yarn-1.22.4_1.txz: 100%  870 KiB 891.0kB/s    00:01
[2/2] Fetching node-14.4.0.txz: 100%    6 MiB   6.7MB/s    00:01
Checking integrity... done (0 conflicting)
[1/2] Installing node-14.4.0...
[1/2] Extracting node-14.4.0: 100%
[2/2] Installing yarn-1.22.4_1...
[2/2] Extracting yarn-1.22.4_1: 100%
=====
Message from node-14.4.0:

--
Note: If you need npm (Node Package Manager), please install www/npm.
# make
make: Unknown modifier '%'
make: Unknown modifier '%'
go get -u github.com/knadh/stuffbin/...
cd frontend && yarn install
yarn install v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.1.3: The platform "freebsd" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "freebsd" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > sass-loader@8.0.2" has unmet peer dependency "webpack@^4.36.0 || ^5.0.0".
warning " > vue-c3@1.2.11" has incorrect peer dependency "c3@^0.5.4".
warning "@vue/eslint-config-airbnb > eslint-import-resolver-webpack@0.11.1" has unmet peer dependency "webpack@>=1.11.0".
[4/4] Building fresh packages...
[-/4] ⠐ waiting...
[2/4] ⠐ node-sass
[-/4] ⠐ waiting...
error /frontend/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: /frontend/node_modules/node-sass
Output:
Building: /usr/local/bin/node /frontend/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   '/usr/local/bin/node',
gyp verb cli   '/frontend/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@14.4.0 | freebsd | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/frontend/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/frontend/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/frontend/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /frontend/node_modules/which/which.js:89:16
gyp verb `which` failed     at /frontend/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /frontend/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:175:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/frontend/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/frontend/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/frontend/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /frontend/node_modules/which/which.js:89:16
gyp verb `which` failed     at /frontend/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /frontend/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:175:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` failed Error: not found: python
gyp verb `which` failed     at getNotFoundError (/frontend/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/frontend/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/frontend/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /frontend/node_modules/which/which.js:89:16
gyp verb `which` failed     at /frontend/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /frontend/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:175:21)
gyp verb `which` failed  python Error: not found: python
gyp verb `which` failed     at getNotFoundError (/frontend/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/frontend/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/frontend/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /frontend/node_modules/which/which.js:89:16
gyp verb `which` failed     at /frontend/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /frontend/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (fs.js:175:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/frontend/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/frontend/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack     at F (/frontend/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/frontend/node_modules/which/which.js:80:29)
gyp ERR! stack     at /frontend/node_modules/which/which.js:89:16
gyp ERR! stack     at /frontend/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /frontend/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqCallback.oncomplete (fs.js:175:21)
gyp ERR! System FreeBSD 12.1-RELEASE-p9
gyp ERR! command "/usr/local/bin/node" "/frontend/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /frontend/node_modules/node-sass
gyp ERR! node -v v14.4.0
gyp ERR! node-gyp -v v3.8.0

*** Error code 1

Stop.
make: stopped in....
knadh commented 4 years ago

Thanks @Oclair. The build is failing at Node deps installation, before even getting to the actual JS frontend.

There's also this:

gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2

@mr-karan maybe you could take a look at this on your FreeBSD instance?

Off the topic, will start cross-compiling and making a FreeBSD release available on GitHub starting with the next version.

mr-karan commented 4 years ago

@Oclair I think you need to perform these steps in order to configure Python dependency for node-gyp.

Oclair commented 4 years ago

@Oclair I think you need to perform these steps in order to configure Python dependency for node-gyp.

Well I tried it, the suggested commands did not work. Seriously, I'd prefer things aren't forced to work in an environment, otherwise I'll need to force updates as well, document how to get it working elsewhere etc...

knadh commented 3 years ago

The releases will now include pre-compiled (Free/Open/Net)BSD binaries. https://github.com/knadh/listmonk/commit/aee1bfd92eee5d7c4e034b630f3eb4a35d877492

knadh commented 3 years ago

v0.8.0-beta comes pre-compiled for BSD flavours.

vixie commented 1 year ago

thanks very much for the freebsd-amd64 binary, it runs. can you also post the construction steps? i'd like to be able to reproduce your binary here.

knadh commented 1 year ago

listmonk uses goreleaser to build the bins for various platforms. make release-dry will run all the compilation steps and also produce a bin for freebsd-amd64.

To only compile for freebsd, you can edit the build target in the Makefile https://github.com/knadh/listmonk/blob/master/Makefile#L41, add GOOS=freebsd GOARCH=amd64 and then run make dist.