Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FreeBSD compilation support #130

Open
wants to merge 89 commits into
base: develop
Choose a base branch
from
Open

Conversation

Teetoow
Copy link

@Teetoow Teetoow commented Aug 25, 2020

Update these scripts (and add specific FreeBSD automate.py file) in order to get DocumentServer compiling under FreeBSD.
Please note that :

I added the ability to put patch files into "patches//" directory which will be applied on the fetched git repositories before compilation. If this directory does not exist it does nothing. This can be a good solution in order to test compilation on patched git repositories ;
"core_and_multimedia" has been disabled for FreeBSD since Chromium compilation needs a custom compilation process under FreeBSD ;
I restricted compilation to "server" only since I didn't worked on compilation of the other modules.
Last but not least, CC and CXX environment variables must be set respectively to clang and clang++ before executing automate.py since the pkg node's binary needs it. I tried to use base.set_env before calling pkg but for some reasons these environment variables are not passed to pkg.

Teetoow and others added 30 commits August 25, 2020 13:21
not written for FreeBSD. In order to get chromium compiling under
FreeBSD a specific set of compilation tool has to be used (see
https://wiki.freebsd.org/Chromium)
repositories. This is particulary useful when compiling code on an
unsupported platform. Patches are stored in patches/<platform/
directory.

Moreover skip the 3rd party compilation under FreeBSD since OnlyOffice
depends on v8 which needs specific compilation tools under FreeBSD
(native v8 compilation tools are not written for FreeBSD. Thus under
FreeBSD we use node10 available in the FreeBSD port compiled with the
"shared" option.  In that way libnode.so is used in order to get the v8
code).
Since v8 library is got from FreeBSD ports, we also want to use the
native ICU library, boost library, openssl library etc.
Moreover it lets the sysadmin getting the latest security patches for
these libraries and avoid security holes (without recompiling
onlyoffice).
/usr/bin. When npm-pkg is installed it is installed in /usr/local/bin.
In that way by specifying the full path under FreeBSD it lets the python
script accessing npm pkg rather that the FreeBSD package manager.
Before calling this script:
  - be sure that "git" (or "git-lite"), "sudo" and # "python27" are installed:
    # pkg install git-lite sudo python27
  - /usr/bin/python is a symlink to /usr/local/bin/python2.7:
    # ln -s /usr/local/bin/python2.7 /usr/bin/python
  - CC and CXX environment variables are respectively set to clang and clang++
    # export CC=clang
    # export CXX=clang++

Last but not least only "server" module has been checked to compile
under FreeBSD. That's why only this module is currently accepted.
Fix pull request message
Fix clean error (clean CURRENT build setup, not previous)
* Added Dockerfile, Readme,  .js script
* Added develop folder to check.yml
* Add issue template

* Fix more

* Add article
Add sendto plugin to macos version
Upgrading npm to v7 cause `npm install` error in `server` repo
on Spellchecker compilation
We didn't found exact reason why this happens and
if this a bug in npm or just some major changes in npm from v6
to v7

This error can be repoduced with this simple Dockerfile
```
FROM node:10

RUN npm install -g npm
RUN npm -v
RUN git clone --depth 1 https://github.com/ONLYOFFICE/server.git
RUN cd server/SpellChecker && \
    npm install
```
In this Dockerfile - npm v7.5.4 installed and causing:
```
Step 5/5 : RUN cd server/SpellChecker &&     npm install
 ---> Running in 158d202d2c11
npm notice
npm notice New patch version of npm available! 7.5.4 -> 7.5.6
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.5.6>
npm notice Run `npm install -g npm@7.5.6` to update!
npm notice
npm ERR! code 1
npm ERR! path /server/SpellChecker/node_modules/nodehun
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! make: Entering directory '/server/SpellChecker/node_modules/nodehun/build'
npm ERR! make: Leaving directory '/server/SpellChecker/node_modules/nodehun/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@10.23.3 | linux | x64
npm ERR! gyp info find Python using Python version 3.5.3 found at "/usr/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v10.23.3/node-v10.23.3-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v10.23.3/node-v10.23.3-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v10.23.3/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v10.23.3/SHASUMS256.txt
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [ '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/server/SpellChecker/node_modules/nodehun/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/root/.cache/node-gyp/10.23.3/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/10.23.3',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/10.23.3/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/server/SpellChecker/node_modules/nodehun',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.' ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! make: *** No rule to make target 'Release/obj.target/hunspell/src/hunspell/src/hunspell/affentry.o', needed by 'Release/obj.target/src/hunspell.a'.  Stop.
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
npm ERR! gyp ERR! System Linux 5.4.0-65-generic
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /server/SpellChecker/node_modules/nodehun
npm ERR! gyp ERR! node -v v10.23.3
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-02-23T13_33_15_384Z-debug.log
```

But if we force npm v6:
```
FROM node:10

RUN npm install -g npm@6
RUN npm -v
RUN git clone --depth 1 https://github.com/ONLYOFFICE/server.git
RUN cd server/SpellChecker && \
    npm install
```

Forcing install of npm v6.14.11 and server Spellchecker
compilation is fine
Change message
Use gh instead of the hub
Add check gh install and auth
K0R0L and others added 30 commits May 12, 2021 11:12
Remove .pdb files from qt plugins in deploy forder
* Copy changes html for appcast

* Fix version

* Replace urls in onlyoffice.xml

* File deletion refactoring
* Fix version detection

* Fix urls

* Newlines

* Rename variable
* Fix macOS build

* Fix variable app_version
Fix running-document-server task
Fix forgotten `-y` flag for installation confirmation
`build_tools` are not require python2, but it use
Google Build tools to build v8 and those tools are still require
python2

This changes allow correctly build our product on all systems starting
from Ubuntu 14.04 and until Ubuntu 20.04 including Debian 10
Fix rake build task if there is no archive old previous version present
Turn off gc.js module. it works inside server.js
apply it. Currently it only supports linux patch but it is easy to add
the windows solution too. It does nothing if the patches/ or the
patches/<os> directories don't exist. It could be useful to easily apply
patches before compiling them.
Since some patches are applied (at least in build_server.py) it could also be
interested in creating a function with an argument "prefix" in order to
apply patches before compiling and after compiling in a such way.
Since it changes nothing if directories are not present it would be very
intested in adding this code.
In that way it would be easier to add FreeBSD (and other OSes) support.
library updates which removes very old functions declared as obsolete
since many years (Node10 is very old..).
There is no more problems with node12.
Please note that node12 is now obsolete and no more maintained. It could
then bring security issues especially for servers...). Since the code is
not working under node14 or node16 it would be interested in working on
the code to use them.
In that case we are sure that we are using the latest version with
latest security patches applied. Moreover these libraries will be
updated with the system updates. Then we will be sure we will get the
latest security fixes!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants