Closed seanfarley closed 3 years ago
Related issue - #187 (just for reference).
This built and worked for me. It looks like this is intermittent.
WOW! I am very happy that it works for you! Did you do anything special to make it working?
Almost certainly this is a Big Sur issue (see my comment in that other thread) with gcc. Going to build gcc from source and see how that works (but will take a long time, I guess).
Recompiling gcc from source didn't help.
$ cat jittest.c
#include <libgccjit.h>
#include <stdlib.h>
#include <stdio.h>
int
main (int argc, char **argv)
{
gcc_jit_context *ctxt;
gcc_jit_result *result;
ctxt = gcc_jit_context_acquire ();
if (!ctxt)
exit (1);
gcc_jit_type *int_type =
gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_INT);
gcc_jit_function *func =
gcc_jit_context_new_function (ctxt, NULL,
GCC_JIT_FUNCTION_EXPORTED,
int_type, "foo", 0, NULL, 0);
gcc_jit_block *block = gcc_jit_function_new_block (func, "foo");
gcc_jit_block_end_with_return (
block,
NULL,
gcc_jit_context_new_rvalue_from_int (ctxt, int_type, 1));
result = gcc_jit_context_compile (ctxt);
if (!result)
exit (1);
typedef int (*fn_type) (void);
fn_type foo =
(fn_type)gcc_jit_result_get_code (result, "foo");
if (!foo)
exit (1);
if (foo () != 1)
exit (1);
gcc_jit_context_release (ctxt);
gcc_jit_result_release (result);
return 0;
}
Compile jittest.c
$ gcc -o jittest -I/usr/local/include -L/usr/local/lib/gcc/10 jittest.c -lgccji
Run:
$ ./jittest
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
libgccjit.so: error: error invoking gcc driver
Since this test doesn't involve any emacs or doom code, I think it's safe to safe gcc jit is somehow misconfigured on Big Sur. Perhaps it's Apple changing the system search path or perhaps gcc is assuming something incorrectly; I don't know.
Aha! I made some progress by recompiling libgccjit!
$ brew reinstall gcc --build-from-source --force
$ brew reinstall libgccjit --build-from-source --force
I will try to recompile emacs now and see how far I get.
Had the same issue as you @seanfarley , I also did gcc and libgccjit reinstall, reinstall of @28 , and it actually fixed it for me 👍 thank you!
WOW! I am very happy that it works for you! Did you do anything special to make it working?
I wasn't sure it would work, so I did a local build. Otherwise it just worked out of the box. I'm using doom, and after running doom sync
it works fine, both from the command line and from finder.
Yes, so the solution was to reinstall gcc
. Happy that it works.
Closing this ticket in favour of #187 :)
Yep, I just tested and it works now :-). FYI, you also need to rebuild libgccjit
from source on Big Sur.
I'm experiencing similar issues and rebuilding gcc and ... doesn't help. doom sync produces:
Native compiler error: (lambda (arg15 &rest arg16) (let ((f #'message)) (apply f arg15 arg16))), "Compiling /Users/ashkanaleali/.emacs.d/.local/cache/eln/28.0.50-8728ed69/subr--trampoline-6d657373616765_message_0.eln...
FATAL:/nix/store/izl3id7c8iknp9yjsrh7i4hx2khq278p-cctools-port-949.0.1/libexec/as/x86_64/as: I don't understand 'm' flag!
libgccjit.so: error: error invoking gcc driver
Debugger entered--Lisp error: (native-ice \"failed to compile\" \"/Users/ashkanaleali/.emacs.d/.local/cache/eln/28.0...\" \"error invoking gcc driver\")
comp--compile-ctxt-to-file(\"/Users/ashkanaleali/.emacs.d/.local/cache/eln/28.0...\")
comp-compile-ctxt-to-file(\"/Users/ashkanaleali/.emacs.d/.local/cache/eln/28.0...\")
comp-final1()
load-with-code-conversion(\"/var/folders/sv/6lspm2p55lz1bs_xflqjrw2h0000gn/T/e...\" \"/var/folders/sv/6lspm2p55lz1bs_xflqjrw2h0000gn/T/e...\" nil t)
command-line-1((\"-l\" \"/var/folders/sv/6lspm2p55lz1bs_xflqjrw2h0000gn/T/e...\"))
command-line()
When I try to rebuild gccand libgccjit I get:
if test "" != "yes" ; then \
rm -f /nix/store/80kgw8spyllzacqbwmr20r9mw7y8xq53-libgccjit-10.2.0/bin/g++; \
/nix/store/5y6lcfjghk5kbv4782vi7w79vz60gsyn-bash-4.4-p23/bin/bash ../../gcc-10.2.0/gcc/../install-sh -c -s xg++ /nix/store/80kgw8spyllzacqbwmr20r9mw7y8xq53-libgccjit-10.2.0/bin/g++; \
chmod a+x /nix/store/80kgw8spyllzacqbwmr20r9mw7y8xq53-libgccjit-10.2.0/bin/g++; \
rm -f /nix/store/80kgw8spyllzacqbwmr20r9mw7y8xq53-libgccjit-10.2.0/bin/c++; \
( cd /nix/store/80kgw8spyllzacqbwmr20r9mw7y8xq53-libgccjit-10.2.0/bin && \
ln g++ c++ ); \
if [ -f cc1plus ] ; then \
if [ ! -f g++-cross ] ; then \
rm -f /nix/store/80kgw8spyllzacqbwmr20r9mw7y8xq53-libgccjit-10.2.0/bin/x86_64-apple-darwin-g++; \
( cd /nix/store/80kgw8spyllzacqbwmr20r9mw7y8xq53-libgccjit-10.2.0/bin && \
ln g++ x86_64-apple-darwin-g++ ); \
rm -f /nix/store/80kgw8spyllzacqbwmr20r9mw7y8xq53-libgccjit-10.2.0/bin/x86_64-apple-darwin-c++; \
( cd /nix/store/80kgw8spyllzacqbwmr20r9mw7y8xq53-libgccjit-10.2.0/bin && \
ln c++ x86_64-apple-darwin-c++ ); \
fi ; \
fi; \
fi
/nix/store/5y6lcfjghk5kbv4782vi7w79vz60gsyn-bash-4.4-p23/bin/bash ../../gcc-10.2.0/gcc/../install-sh -c -s libgccjit.so.0.0.1 \
//nix/store/80kgw8spyllzacqbwmr20r9mw7y8xq53-libgccjit-10.2.0/lib/libgccjit.so.0.0.1
strip: error: symbols referenced by indirect symbol table entries that can't be stripped in: /nix/store/80kgw8spyllzacqbwmr20r9mw7y8xq53-libgccjit-10.2.0/lib/_inst.46441_
Any help is appreciated
Since you're using nix, you might want to open a new issue with your OS and emacs versions. No idea otherwise :-/
@ashkan-leo I am not sure what's happening there and I am not sure that what you are doing with nix
is relevant to emacs-plus
, which is brew
formula. emacs-plus
depends on gcc
and libgccjit
and expects them to be installed via brew
:
Could you please share the command you used to install emacs-plus
?
And regarding rebuilding libgccjit
mentioned in this thread by @seanfarley , it actually means to rebuild it via brew
:)
$ brew uninstall gcc libgccjit
$ brew install gcc libgccjit
Haha, I got confused to which repo I was replying to (I thought this was doom)!
Please make sure to follow these steps (and mark the checkboxes):
brew update
and try to reproduce the issue againbrew doctor
, fix all issues and try to reproduce your issue againbrew config
andbrew doctor
and include their outputWhat you were trying to do
Kicking the tires on the newly merged
--with-native-comp
option, I randoom sync
to compile eln modules and it errors at the compilation step. I'm reporting it here because if I use thenative-comp
branch and compile by hand, eln works and compiles.What happened (include command output)
Command output
Output of
brew config
Output of
brew doctor
Output of
doom sync