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

More clarity of the build process #7

Closed
srustamo opened this issue Sep 20, 2017 · 13 comments
Closed

More clarity of the build process #7

srustamo opened this issue Sep 20, 2017 · 13 comments

Comments

@srustamo
Copy link

The Readme is not clear about the build process. There's a bit more clarity added in this issue.

So, do we need to build emacs from source to add emacs-libvterm? The above issue seems to indicate that not.

How do I go about building this package?

@rakanalh
Copy link

rakanalh commented Sep 20, 2017

Not necessarily... but you definitely need emacs-module.h at the very least, which as far as i remember is generated by the build script when building emacs from source.
Update: So basically, checkout Emacs source code and execute

make EMACS-SRC=/path/to/emacs-src

@srustamo
Copy link
Author

Thanks.

@srustamo
Copy link
Author

srustamo commented Sep 22, 2017

I tried make EMACS-SRC=/path/to/emacs-src with /path/to/emacs-src/ pointing to cloned working tree of this repo git://git.savannah.gnu.org/emacs.git.

It gave me the error reported in the previous issue:

❮ make EMACS-SRC=~/sources/Emacs/emacs
gcc -ggdb3 -Wall -I~/sources/Emacs/emacs/src -I/ -fPIC -c vterm-module.c
In file included from vterm-module.c:1:
./vterm-module.h:1:10: fatal error: 'emacs-module.h' file not found
#include <emacs-module.h>
         ^
1 error generated.
make: *** [vterm-module.o] Error 1

Then I tried to compile Emacs from source, which went fine. Run make EMACS-SRC=/path/to/emacs-src still get the above error.

@srustamo srustamo reopened this Sep 22, 2017
@rakanalh
Copy link

It has to be /path/to/emacs-src/src i think and you have to run ./configure && make inside emacs-src so that the file is generated, i am not sure which one of them actually generates but you can do both.

@akermu
Copy link
Owner

akermu commented Sep 24, 2017

The build should work, if you run make with the full path to the emacs source (without the tilde), like make EMACS-SRC=/home/srustamo/sources/Emacs/emacs. You only have to specify the root of the git repository. When I will have a little more time on my hands, I will try to simplify the build process (maybe by using CMake).

@srustamo
Copy link
Author

Thanks. The package successfully compiles without the ~, although with warnings (see at the end).

However, after adding (add-to-list 'load-path "/Users/srustamo/GitHub/emacs-libvterm") to my init file, I don't have vterm-create function.

I then tried to evaluate vterm.el from within Emacs, which gives me ad-Advice-require: Cannot open load file: Not a directory, vterm-module error.

gcc -ggdb3 -Wall -I/Users/srustamo/sources/Emacs/emacs/src -I/ -fPIC -c vterm-module.c
vterm-module.c:427:45: warning: passing 'unsigned char [len]' to parameter of type 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
    env->copy_string_contents(env, args[1], key, &len);
                                            ^~~
vterm-module.c:117:13: warning: unused function 'message' [-Wunused-function]
static void message(emacs_env *env, char *message) {
            ^
vterm-module.c:123:13: warning: unused function 'message_value' [-Wunused-function]
static void message_value(emacs_env *env, emacs_value value) {
            ^
3 warnings generated.
gcc -shared  -lvterm -lutil -o vterm-module.so vterm-module.o
rm vterm-module.o

@akermu
Copy link
Owner

akermu commented Sep 29, 2017

Is your emacs compiled with module support? Does the value of system-configuration-options contain --with-modules?

@srustamo
Copy link
Author

Thanks. I'm using emacs-mac. The value of system-configuration-options is

"--enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs-mac/emacs-25.3-mac-6.7/share/info/emacs --prefix=/usr/local/Cellar/emacs-mac/emacs-25.3-mac-6.7 --with-mac --enable-mac-app=/usr/local/Cellar/emacs-mac/emacs-25.3-mac-6.7"

No module support, it seems.

@knazarov
Copy link
Contributor

@srustamo you can add module support with brew install --with-modules emacs-mac

@srustamo
Copy link
Author

@racktear thanks. I raised this issue in emacs-mac repo.

@knazarov
Copy link
Contributor

@srustamo yes, you are correct. The command you mention there should do the trick.

@knazarov
Copy link
Contributor

@srustamo I've actually tried to do it myself, and failed, as emacs-mac misses the emacs-module.h, despite being built with module support.

I've sent a pull request to the homebrew formula that fixes it:

railwaycat/homebrew-emacsmacport#112

You can edit your local brew formula with brew edit emacs-mac and add those lines if you don't want to wait for the upstream merge.

@srustamo
Copy link
Author

Thanks. Your PR is not merged yet. Adding PR code manually with brew edit emacs-mac as suggested fails to build:

❮ brew install --with-modules emacs-mac
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
apibuilder-cli

==> Installing emacs-mac from railwaycat/emacsmacport
==> Downloading https://bitbucket.org/mituharu/emacs-mac/get/emacs-25.3-mac-6.8.tar.bz2
Already downloaded: /Users/srmba3/Library/Caches/Homebrew/emacs-mac-emacs-25.3-mac-6.8.tar.bz2
==> ./autogen.sh
==> ./configure --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs-mac/emacs-25.3-mac-6.8/share/info/emacs --prefix=/usr/local/Cellar/emacs-mac/emacs-25.3-mac-6.8 --with-mac --enable-mac-app=/usr/local/Cellar/emacs-mac/emacs-25.3-mac
==> make
==> make install
Error: undefined method `install' for "/usr/local/Cellar/emacs-mac/emacs-25.3-mac-6.8/src":String
/usr/local/Homebrew/Library/Taps/railwaycat/homebrew-emacsmacport/Formula/emacs-mac.rb:122:in `install'
/usr/local/Homebrew/Library/Homebrew/build.rb:143:in `block (2 levels) in install'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1093:in `block in brew'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1911:in `block in stage'
/usr/local/Homebrew/Library/Homebrew/resource.rb:97:in `block in unpack'
/usr/local/Homebrew/Library/Homebrew/extend/fileutils.rb:14:in `block in mktemp'
/usr/local/Homebrew/Library/Homebrew/extend/fileutils.rb:74:in `block in run'
/usr/local/Homebrew/Library/Homebrew/extend/fileutils.rb:74:in `chdir'
/usr/local/Homebrew/Library/Homebrew/extend/fileutils.rb:74:in `run'
/usr/local/Homebrew/Library/Homebrew/extend/fileutils.rb:13:in `mktemp'
/usr/local/Homebrew/Library/Homebrew/resource.rb:93:in `unpack'
/usr/local/Homebrew/Library/Homebrew/resource.rb:85:in `stage'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1888:in `stage'
/usr/local/Homebrew/Library/Homebrew/formula.rb:1088:in `brew'
/usr/local/Homebrew/Library/Homebrew/build.rb:114:in `block in install'
/usr/local/Homebrew/Library/Homebrew/utils.rb:554:in `with_env'
/usr/local/Homebrew/Library/Homebrew/build.rb:111:in `install'
/usr/local/Homebrew/Library/Homebrew/build.rb:192:in `<main>'

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

No branches or pull requests

4 participants