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

Installation error: "/usr/bin/solc"' is a malformed function #8

Closed
tuxayo opened this issue Apr 29, 2016 · 9 comments
Closed

Installation error: "/usr/bin/solc"' is a malformed function #8

tuxayo opened this issue Apr 29, 2016 · 9 comments

Comments

@tuxayo
Copy link

tuxayo commented Apr 29, 2016

/usr/bin/solc exists but it seems that there something wrong related that prevents the installation from finishing.

Leaving directory `/home/victor/.emacs.d/elpa/solidity-mode-20160426.31'

Compiling file /home/victor/.emacs.d/elpa/solidity-mode-20160426.31/solidity-mode-pkg.el at Fri Apr 29 13:21:06 2016
Entering directory `/home/victor/.emacs.d/elpa/solidity-mode-20160426.31/'

Compiling file /home/victor/.emacs.d/elpa/solidity-mode-20160426.31/solidity-mode.el at Fri Apr 29 13:21:06 2016
solidity-mode.el:383:1:Warning: `"/usr/bin/solc"' is a malformed function
solidity-mode.el:383:1:Warning: `(error line-start (file-name) ":" line ":"
    column ":" " Error: " (message))' is a malformed function
solidity-mode.el:386:28:Warning: reference to free variable `solidity'
solidity-mode.el:388:31:Warning: reference to free variable `source-inplace'
solidity-mode.el:391:12:Warning: reference to free variable `solidity-mode'
solidity-mode.el:393:17:Warning: reference to free variable
    `flycheck-checkers'
solidity-mode.el:393:17:Warning: assignment to free variable
    `flycheck-checkers'
solidity-mode.el:395:30:Warning: assignment to free variable
    `flycheck-solidity-executable'

In end of data:
solidity-mode.el:399:1:Warning: the function `flycheck-define-checker' is not
    known to be defined.

Compiling no file at Fri Apr 29 13:24:20 2016

emacs 24.5
Spacemacs 0.105.19
solc 0.3.2-81ae2a78

@tbrooke
Copy link

tbrooke commented Oct 7, 2016

I get the same errors in emacs 25 with spacemacs - solidity-mode does not load

@tbrooke
Copy link

tbrooke commented Oct 12, 2016

I am using Spacemacs and Emacs v 25

I was receiving this error message (see Issue 8)


Compiling file /home/victor/.emacs.d/elpa/solidity-mode-20160426.31/solidity-mode.el at Fri Apr 29 13:21:06 2016
solidity-mode.el:383:1:Warning: `"/usr/bin/solc"' is a malformed function
solidity-mode.el:383:1:Warning: `(error line-start (file-name) ":" line ":"
    column ":" " Error: " (message))' is a malformed function
solidity-mode.el:386:28:Warning: reference to free variable `solidity'
solidity-mode.el:388:31:Warning: reference to free variable `source-inplace'
solidity-mode.el:391:12:Warning: reference to free variable `solidity-mode'
solidity-mode.el:393:17:Warning: reference to free variable
    `flycheck-checkers'
solidity-mode.el:393:17:Warning: assignment to free variable
    `flycheck-checkers'
solidity-mode.el:395:30:Warning: assignment to free variable
    `flycheck-solidity-executable'

I commented out the following and it works fine, but I guess I don't have flycheck:


;;; --- interface with flycheck if existing ---
(when (require 'flycheck nil 'noerror)
  ;; add dummy source-inplace definition to avoid errors
  (defvar source-inplace)
  ;; add a solidity mode callback to set the executable of solc for flycheck
  ;; define solidity's flycheck syntax checker
  (flycheck-define-checker solidity-checker
    "A Solidity syntax checker using the solc compiler"
    :command ("/usr/bin/solc" source-inplace)
    :error-patterns
    ((error line-start (file-name) ":" line ":" column ":" " Error: " (message)))
    :modes solidity-mode
    :predicate (lambda () (eq major-mode 'solidity-mode)))
  (add-to-list 'flycheck-checkers 'solidity-checker)
  (add-hook 'solidity-mode-hook
            (lambda () (setq flycheck-solidity-executable solidity-solc-path))))

@LefterisJP
Copy link
Collaborator

Note: These are just byte-compiler warnings.
Solidity mode works fine with them, both normally from Melpa or from withing Spacemacs. I just tested it.

Will see how we can get rid of them. Since you do not have flycheck this code is never executed thanks to the

(when (require 'flycheck nil 'noerror)
...
)

But still it seems the byte compiler tries to compile them. I will try to find a way to address this but as stated before it should not stop you from using the mode.

@tbrooke
Copy link

tbrooke commented Oct 13, 2016

I thought they were just compiler warnings - I retried the melpa version and it still doesn't load - and I went back to my version with flycheck commented out and it does work: https://github.com/tbrooke/emacs-solidity and it does

Spacemacs version 0.200.1
Emacs 25.1.1

LefterisJP added a commit that referenced this issue Oct 13, 2016
- Flycheck executable should now be
  `flycheck-solidity-checker-executable` with the latest flycheck
  versions

- If flycheck is not there it's not sufficient to simply do
  `(when (require 'flycheck nil 'noerror) .. )`. You also have to wrap
  in `(eval-when-compile ... )`. This should address #8 and the errors
  the users are seeing there.
@LefterisJP
Copy link
Collaborator

I believe this latest commit must have fixed the issue. It at least no longer shows the warnings when compiling in the normal Emacs.

@tbrooke Can you check and report back and tell me if it works? Note: Spacemacs uses Melpa and as such it may take a while until the commit is included in the latest Melpa Build. Best way to make sure is to check this link and make sure that the melpa version is NOT 20161013.203

@tbrooke
Copy link

tbrooke commented Oct 13, 2016

Still 20161013.203 - I'lll try it later -- BTW I did look at spacemacs and found a lot of discussion about how they use flycheck in an unconventional way -- I didn't follow it all
syl20bnr/spacemacs#4782

@LefterisJP
Copy link
Collaborator

@tbrooke Had you have time to check if this is still an issue?

@tbrooke
Copy link

tbrooke commented Oct 26, 2016

It enters solidity mode and the syntax highlighting works but I get the following message - which it just a warning


Compiling no file at Wed Oct 26 19:51:04 2016
Warning (bytecomp): ‘"/usr/bin/solc"’ is a malformed function
Warning (bytecomp): ‘(error line-start (file-name) ":" line ":" column ":" " Error: " (message))’ is a malformed function

@juergenhoetzel
Copy link
Contributor

Compiling no file at Wed Oct 26 19:51:04 2016
Warning (bytecomp): ‘"/usr/bin/solc"’ is a malformed function
Warning (bytecomp): ‘(error line-start (file-name) ":" line ":" column ":" " Error: " (message))’ is a malformed function

Because the macro flycheck-define-checker is not defined at compile time, the the lisp reader tries to compile ("/usr/bin/solc" source-inplace) as invalid function application.

Possible workarounds:

  1. define a dummy flycheck-define-checker macro in case flycheck is not available
  2. Split the flycheck functionality in a seperate package

LefterisJP added a commit that referenced this issue Dec 31, 2017
Split flycheck code into its own source file.

Fix #8
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