emacs-ng / emacs-ng

A new approach to Emacs - Including TypeScript, Threading, Async I/O, and WebRender.
https://emacs-ng.github.io/emacs-ng/
GNU General Public License v3.0
1.65k stars 70 forks source link

emacs-ng has error with doom emacs install #58

Open jjpark78 opened 3 years ago

jjpark78 commented 3 years ago

after succesfully build emacs-ng

run make install

and then i've copied nextstep/Emacs.app to Application folder

and tryng to install doom emacs runs doom install

got these errors

> ~/.emacs.d/bin/doom install
Debugger entered--Lisp error: (void-variable comp-ctxt)
  (type-of comp-ctxt)
  (memq (type-of comp-ctxt) cl-struct-comp-cstr-ctxt-tags)
  (and (memq (type-of comp-ctxt) cl-struct-comp-cstr-ctxt-tags) t)
  (progn (and (memq (type-of comp-ctxt) cl-struct-comp-cstr-ctxt-tags) t))
  (or (progn (and (memq (type-of comp-ctxt) cl-struct-comp-cstr-ctxt-tags) t)) (signal 'wrong-type-argument (list 'comp-cstr-ctxt comp-ctxt)))
  (progn (or (progn (and (memq (type-of comp-ctxt) cl-struct-comp-cstr-ctxt-tags) t)) (signal 'wrong-type-argument (list 'comp-cstr-ctxt comp-ctxt))) (aref comp-ctxt 4))
  (if range (progn (or (progn (and (memq (type-of comp-ctxt) cl-struct-comp-cstr-ctxt-tags) t)) (signal 'wrong-type-argument (list 'comp-cstr-ctxt comp-ctxt))) (aref comp-ctxt 4)) (progn (or (progn (and (memq (type-of comp-ctxt) cl-struct-comp-cstr-ctxt-tags) t)) (signal 'wrong-type-argument (list 'comp-cstr-ctxt comp-ctxt))) (aref comp-ctxt 3)))
  (let ((mem-h (if range (progn (or (progn (and ... t)) (signal 'wrong-type-argument (list ... comp-ctxt))) (aref comp-ctxt 4)) (progn (or (progn (and ... t)) (signal 'wrong-type-argument (list ... comp-ctxt))) (aref comp-ctxt 3))))) (let* ((mem-res (and t (gethash srcs mem-h)))) (if mem-res (progn (progn (progn (or (progn ...) (signal ... ...)) (let* (...) (aset v 1 ...))) (progn (or (progn ...) (signal ... ...)) (let* (...) (aset v 2 ...))) (progn (or (progn ...) (signal ... ...)) (let* (...) (aset v 3 ...))) (progn (or (progn ...) (signal ... ...)) (let* (...) (aset v 4 ...)))) mem-res) (let ((res (apply #'comp-cstr-union-1-no-mem range dst srcs))) (puthash srcs (comp-cstr-copy res) mem-h) res))))
  comp-cstr-union-1(t #s(comp-cstr :typeset (t) :valset nil :range nil :neg nil) #s(comp-cstr :typeset (number) :valset nil :range nil :neg nil) #s(comp-cstr :typeset (marker) :valset nil :range nil :neg nil))
  apply(comp-cstr-union-1 t #s(comp-cstr :typeset (t) :valset nil :range nil :neg nil) (#s(comp-cstr :typeset (number) :valset nil :range nil :neg nil) #s(comp-cstr :typeset (marker) :valset nil :range nil :neg nil)))
DavidDeSimone commented 3 years ago

We had a similar issue with https://github.com/emacs-ng/emacs-ng/issues/25, which we fixed by merging in upstream. This may be due to an issue with the current commit of mainline emacs we are on. @brotzeit do you have any insight?

DavidDeSimone commented 3 years ago

I am able to reproduce this issue. I was able to work around this by adding ./configure --with-nativecomp and compiling and installing with native comp. You will need zlib and libgccjit. nativecomp should not affect emacs-ng's javascript or webrender capabilities, so for now I would recommend you run with those settings if you want to use doom emacs.

This is likey a bug with doom-emacs, or a subsequent package, making assumptions about being on the native comp branch, you are compiling with nativecomp. They are likely not testing people on the nativecomp branch that are running with --with-nativecomp=no.

DavidDeSimone commented 3 years ago

Update 2: Anything that performs (require 'comp) in the nativecomp branch that isn't compiled --with-nativecomp will result in this error. This is not specific to emacs-ng, however I vote to keep the issue open for general tracking.

We should report this to nativecomp for them to address.

jjpark78 commented 3 years ago
export GCC_DIR="/usr/local/opt/gcc"                                                                                      
export GCCJIT_DIR="/usr/local/opt/libgccjit"                                                                             
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:${PATH}"                                                              
export CFLAGS="-I${GCC_DIR}/include -O2 -march=native"                                                                   
export LDFLAGS="-L${GCC_DIR}/lib/gcc/10 -L${GCCJIT_DIR}/lib/gcc/10 -L${GCC_DIR}/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2"
export LIBRARY_PATH="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib:${GCC_DIR}/lib/gcc/10:${GCCJIT_DIR}/lib/"

cd emacs-ng                                                                                                              
git clean -xfd                                                                                                           

./autogen.sh                                                                                                             
CC=clang ./configure \                                                                                                   
--with-mailutils \                                                                                                  
--with-ns \                                                                                                         
--with-json \                                                                                                       
--with-nativecomp                                                                                                   

make 

make install 

this script will help build emacs-ng on macos with nativecomp

jjpark78 commented 3 years ago
export GCC_DIR="/usr/local/opt/gcc"                                                                                      
export GCCJIT_DIR="/usr/local/opt/libgccjit"                                                                             
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:${PATH}"                                                              
export CFLAGS="-I${GCC_DIR}/include -O2 -march=native"                                                                   
export LDFLAGS="-L${GCC_DIR}/lib/gcc/10 -L${GCCJIT_DIR}/lib/gcc/10 -L${GCC_DIR}/lib/gcc/10/gcc/x86_64-apple-darwin20/10.2"
export LIBRARY_PATH="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib:${GCC_DIR}/lib/gcc/10:${GCCJIT_DIR}/lib/"

cd emacs-ng                                                                                                              
git clean -xfd                                                                                                           

./autogen.sh                                                                                                             
CC=clang ./configure \                                                                                                   
--with-mailutils \                                                                                                  
--with-ns \                                                                                                         
--with-json \                                                                                                       
--with-nativecomp                                                                                                   

make 

make install 

this script will help build emacs-ng on macos with nativecomp

with this script i can confirm doom emacs runs OK! in macos. but it runs little bit slower than emacs-macport version. (with my doom emacs config, emacs-macport startup time : under 3 seconds, with emacs-ng about 5-6 seconds)

but this project is really great and i'll see what i can do for some contribute.

thanks guys.

brotzeit commented 3 years ago

in macos. but it runs little bit slower than emacs-macport version.

Hmmm would be interesting to know the reason. Is it only about the startup time ?

DavidDeSimone commented 3 years ago

I'm curious to see if we grafted JavaScript.rs and required dependencies onto that branch if we still see the performance decrease. Correct me if I'm wrong, but I thought that version of emacs had special optimizations tailored for OS X compared to mainline.

brotzeit commented 3 years ago

I'm no mac user, but maybe we can also apply those optimizations ?

DavidDeSimone commented 3 years ago

I'd have to do testing myself, and I don't have easy access to a mac at the moment. I'm making this assumption that it may be differences in the versions over our code simply because everything in deno is lazily initialized. Virtually no work is done by the code we have added on startup.

https://bitbucket.org/mituharu/emacs-mac/src/master/README-mac is an interesting read. I'm certainly open to integrating OSX specific improvements that may have not made it into mainline emacs for whatever reason.

brotzeit commented 3 years ago

The reason is always the same, RMS =)

petr-tik commented 3 years ago

I got this error when starting my doom config with emacs-ng

Warning (initialization): An error occurred while loading ‘/home/petr_tik/.emacs.d/init.el’:

Error in a Doom module: modules/editor/evil/config.el, (void-variable comp-installed-trampolines-h)

./src/emacs -Q works fine and all tests pass when I run cd test/ && ../src/emacs --batch -l js/bootstrap.el. Awesome project! Would be good to add some getting started material how to write simple JS/TS functions and interop with existing lisp.

DavidDeSimone commented 3 years ago

Interesting, and that was with ./configure --with-nativecomp? Doom had an upstream issue https://github.com/hlissner/doom-emacs/issues/3983 with a similar message, but marked it as resolved.

And good suggestion on better "Getting Started" guide, I'll make another issue for that.

brotzeit commented 3 years ago

I'm just working on another upstream merge, maybe that fixes it.

petr-tik commented 3 years ago

Interesting, and that was with ./configure --with-nativecomp?

I was daft. I didn't configure emacs-ng with-nativecomp and my doom-friendly config was built for native-comp.

And good suggestion on better "Getting Started" guide, I'll make another issue for that.

Friends, Romans, Countrymen, I just ran a truly async function in emacs. I dispatched a M-x fuzzy-search and continued moving around in my original buffer until fuzzy search results opened up in a new buffer.

What is this magic?!?

This might be a huge game changer for emacs. Combined with native-comp of lisp code. I am speechless. Thank you so much.