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

Build from source code for Linux Desktop #3

Closed
mani-zaeim opened this Issue Nov 30, 2017 · 9 comments

Comments

Projects
None yet
3 participants
@mani-zaeim
Copy link

mani-zaeim commented Nov 30, 2017

Would be appreciated if you can document how can build it for Linux desktop by using tar.gz source code.

@laurent22

This comment has been minimized.

Copy link
Owner

laurent22 commented Nov 30, 2017

Hello, the build instructions are in the travis file. Basically you would run these commands:

First make sure that yarn is installed:

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install -y yarn

Then run these commands:

cd ElectronClient/app
rsync -a ../../ReactNativeClient/lib/ lib/
npm install
yarn dist

For testing you can also run the application without installing it using these commands:

cd ElectronClient
./run.sh

@laurent22 laurent22 added the question label Nov 30, 2017

@shinenelson

This comment has been minimized.

Copy link

shinenelson commented Dec 6, 2017

I tried to build the client(s) off the HEAD of the master branch at commit cf97bf9. Here are my observations :

Trying to build ElectronClient :

  • cd ElectronClient/app > yarn
    (from the postinstall script in package.json)
$ node compile-jsx.js && node compile-package-info.js
Compiling /home/shine/dev/git/node.js/joplin/ElectronClient/app/gui/ConfigScreen.jsx...

Error: ENOENT: no such file or directory, open '/home/shine/dev/git/node/js/joplin/ElectronClient/app/gui/ConfigScreen.min.js'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.writeFileSync (fs.js:1291:33)
    at output (/home/shine/dev/git/node.js/joplin/ElectronClient/app/node_modules/babel-cli/lib/babel/file.js:90:10)
    at walk (/home/shine/dev/git/node.js/joplin/ElectronClient/app/node_modules/babel-cli/lib/babel/file.js:150:5)
    at files (/home/shine/dev/git/node.js/joplin/ElectronClient/app/node_modules/babel-cli/lib/babel/file.js:156:7)
    at module.exports (/home/shine/dev/git/node.js/joplin/ElectronClient/app/node_modules/babel-cli/lib/babel/file.js:184:5)
    at Object.<anonymous> (/home/shine/dev/git/node.js/joplin/ElectronClient/app/node_modules/babel-cli/lib/babel/index.js:129:1)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)

error Command failed with exit code 1.

Trying to build CliClient :

  • cd CliClient/app && yarn 👍
  • cd ../ && bash run.sh
Error: Cannot find module '../locales/index.js'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at supportedLocales (/home/shine/dev/git/node.js/joplin/CliClient/build/lib/locale.js:190:46)
    at closestSupportedLocale (/home/shine/dev/git/node.js/joplin/CliClient/build/lib/locale.js:211:18)
    at localeStrings (/home/shine/dev/git/node.js/joplin/CliClient/build/lib/locale.js:274:17)
    at _ (/home/shine/dev/git/node.js/joplin/CliClient/build/lib/locale.js:293:16)
    at Function.label (/home/shine/dev/git/node.js/joplin/CliClient/build/lib/SyncTargetFilesystem.js:19:10)
    at Function.addClass (/home/shine/dev/git/node.js/joplin/CliClient/build/lib/SyncTargetRegistry.js:13:27)

Either I'm doing terribly wrong, or there are some files missing from the source repository. I can't figure how I can debug these issues.

My assumption for the issue with the CliClient is that I need to build the locales myself (? 🤔 ).
But I can't seem to figure why the minified file is missing from version control. Should I minify some file myself? I thought that was what the compile step was all about - compiling the JSX files.

@laurent22

This comment has been minimized.

Copy link
Owner

laurent22 commented Dec 6, 2017

I haven't tested with yarn (it's only used to build the final Electron package) so please try with npm install instead as described in the doc: https://github.com/laurent22/joplin/blob/master/BUILD.md

I have also added a step to copy the translations to the right directory: rsync -aP ../ReactNativeClient/locales/ build/locales/

@shinenelson

This comment has been minimized.

Copy link

shinenelson commented Dec 8, 2017

I haven't tested with yarn (it's only used to build the final Electron package) so please try with npm install instead as described in the doc: https://github.com/laurent22/joplin/blob/master/BUILD.md

I tried with npm install too before reporting. npm is always my fallback mode if yarn fails at times. (I don't report stuff without doing proper homework / research 😉)

I don't think that is the issue here though, if you look at the log that I pasted above, it is an ENOENT: no such file or directory error - which is /home/shine/dev/git/node/js/joplin/ElectronClient/app/gui/ConfigScreen.min.js. That file probably missed it's version control check-in (? 🤔 )

I have also added a step to copy the translations to the right directory: rsync -aP ../ReactNativeClient/locales/ build/locales/

Ah, this was what was throwing that error.
However, wouldn't it be better if we integrated that step after line 7 in build.sh? (I could open a pull request for that, if you'd prefer).

Even after the locales are built fine, and run.sh runs, it is hardly usable. It opens up something on the terminal, but there is no response to anything once the script is running. I have to force quit the terminal to close it. I don't know if it is my terminal or something else. I haven't really tested this well enough; it could maybe be something with my terminal, I'll check on other terminals and get back on this.

@laurent22

This comment has been minimized.

Copy link
Owner

laurent22 commented Dec 8, 2017

The min.js file are not in the repository because normally they are generated when building (the .jsx is the source). Are they not being created when running npm install? If not maybe also try node compile-jsx.js && node compile-package-info.js from ElectronClient/app.

However, wouldn't it be better if we integrated that step after line 7 in build.sh?

Yes the whole thing is a bit messy because it used to rely on Babel. I need to re-arrange the directory so that it doesn't need the extra build folder.

Even after the locales are built fine, and run.sh runs, it is hardly usable. It opens up something on the terminal, but there is no response to anything once the script is running.

What does it show, just an empty screen? Does it quit if you press Ctrl+D?

@shinenelson

This comment has been minimized.

Copy link

shinenelson commented Dec 8, 2017

Are they not being created when running npm install? If not maybe also try node compile-jsx.js && node compile-package-info.js from ElectronClient/app.

No, they aren't. That is the problem. npm install breaks at the postinstall script which is node compile-jsx.js && node compile-package-info.js with this error. 😕

What does it show, just an empty screen?

No, the interface kind of comes up. The dashed lines for the different sections is there, but there's no text whatsoever on them.

Does it quit if you press Ctrl+D?

Ha, it does. I don't know why I didn't think of this earlier. Thanks. 👍

@laurent22

This comment has been minimized.

Copy link
Owner

laurent22 commented Dec 8, 2017

Ha, it does. I don't know why I didn't think of this earlier. Thanks. 👍

So it actually works but you've highlighted a problem, which is by default it looks broken :-) Try to press "mb" to create a notebook and "mn" to create a note. Also ":" to go in command line mode.

I'll add to my todo list to display some help message or something the first time the app is ran.

Error: ENOENT: no such file or directory, open '/home/shine/dev/git/node/js/joplin/ElectronClient/app/gui/ConfigScreen.min.js'

This error message is strange. Is /home/shine/dev/git/node/js/joplin/ElectronClient/app/gui/ a valid directory on your computer?

@shinenelson

This comment has been minimized.

Copy link

shinenelson commented Dec 8, 2017

So it actually works but you've highlighted a problem, which is by default it looks broken :-) Try to press "mb" to create a notebook and "mn" to create a note. Also ":" to go in command line mode.

You were right. I should've thought of command line mode when I knew the the client used terminal-kit. 😉

I'll add to my todo list to display some help message or something the first time the app is ran.

A nice, beautiful welcome message with some command introduction would be great!

Is /home/shine/dev/git/node/js/joplin/ElectronClient/app/gui/ a valid directory on your computer?

Aha, now that you raised that question, I just noticed - the path was supposed to be /home/shine/dev/git/node.js/joplin/ElectronClient/app/gui/, did the babel-cli compilation interpret the dot (.) to a slash (/)? It would make sense in the JS world, but in the linux file-system, that'd be a mess!

I'm going to try this out with a path that doesn't have a dot (.) in it [/tmp/ 😁].

@shinenelson

This comment has been minimized.

Copy link

shinenelson commented Dec 8, 2017

Yes, that was definitely the issue. I was successfully able to compile and run the application with no issues into /tmp/. We should look into whether this is babel-cli's issue or something wrong with the configuration of our build scripts that caused this issue. (I could create a separate issue to track this further; rather than pollute this issue).

@laurent22 laurent22 closed this in a59bf55 Dec 11, 2017

laurent22 pushed a commit that referenced this issue Mar 15, 2018

Merge pull request #3 from laurent22/master
Update fork from original repository
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment