mode doesn't load: Symbol's value as variable is void: mzn2fzn
Closed this issue · 13 comments
I have minizinc-mode installed and it is autoloaded in my .emacs
using this:
(autoload 'minizinc-mode "minizicn-mode" "Major mode for editing minizinc files")
(add-to-list 'auto-mode-alist '("\\.mzn$" . minizinc-mode))
(add-to-list 'auto-mode-alist '("\\.dzn$" . minizinc-mode))
When I open a valid *.mzn
file I get this error:
Symbol's value as variable is void: mzn2fzn
How can/should I define mzn2fzn
Thanks for any help!
Andi
mzn2fzn is an executable program of the minizinc compiler. For example, on my machine it is located under:
➜ ~ ll /usr/local/Cellar/minizinc/2.1.7/bin/
total 18016
-r-xr-xr-x 1 yuswang admin 1.9M Jan 10 04:54 mzn-fzn
-r-xr-xr-x 1 yuswang admin 1.6M Jan 10 04:54 mzn2doc
-r-xr-xr-x 1 yuswang admin 1.9M Jan 10 04:54 mzn2fzn
-r-xr-xr-x 1 yuswang admin 1.7M Jan 10 04:54 mzn2fzn_test
-r-xr-xr-x 1 yuswang admin 1.7M Jan 10 04:54 solns2out
I think you need to add this path to your $PATH variable on your system so that the minizinc-mode can find the program. On my machine, I do not report the error when I open an valid mzn file.
For a Unix like system(Linux & Mac OS), to add the path to path, put the following line in your shell init file(.bashrc in linux).
export PATH=$PATH:/path/to/minizinc/bin
On a windows, you need to append the minizinc-bin path to the path variable system setting as the following link
https://superuser.com/questions/949560/how-do-i-set-system-environment-variables-in-windows-10
If you still have problem when add the path to $PATH, please let me know.
Hi @m00nlight
Thanks very much for your answer! Actually, I'm on linux (ubuntu 16.04). I have two similar machines and on one (my private one) minizinc-mode
works fine. On the other machine I get this strange error.
On both machines mzn2fzn
is in the PATH
, so I guess it's rather some strange .emacs
configuration (done by me)...
@andibachmann Could you please give me your .emacs file so I can debug the problem?
my emacs version is
GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
and the minizinc-mode version is "20180201.650" and here is my
.emacs` config file:
https://gist.github.com/andibachmann/62066fa730c80e4c38888efea830d55e#file-emas-elisp
Thanks so much!
I do a fresh install on Ubuntu 16.04 with emacs 24.5.1. Also install the same minizinc-mode version, use your emacs config file(just delete the setting for ffvm, istall fly-check).
I first got some warning to ask me to update to a more recent minizinc version, so I use the following ppa to update minizin to version 2.0.14
https://launchpad.net/~jonathonf/+archive/ubuntu/minizinc
Sadly I still could not reproduce your problem. Could you please pate the Message to use emacs to open some minizinc file with --debug-init, Something like the following
emacs --debug-init ~/Documents/test.mzn
@m00nlight here's what I get:
Debugger entered--Lisp error: (void-variable mzn2fzn)
byte-code("\306\211\306\211\306\211\306\211\307\310\306\311#\203U\312\313\314\315\316 \"\317\320\321!\322 \323\"\324\325\326 #!\327\210\330$\235\203J$\210\202P\330$B$\331\332\333\"\210\334\335!\207" [minizinc-keywords minizinc-keywords-regex minizinc-builtins minizinc-builtins-regex minizinc-types minizinc-types-regex nil require flycheck :noerror flycheck-define-checker "A MiniZinc syntax checker using the MiniZinc compiler.\n\n See URL `http://www.minizinc.org/'." :command "mzn2fzn" "--model-check-only" :error-patterns (error line-start (file-name) ":" line ":\n" (* any) "\n" (* any) "\n" "Error: " (message) line-end) error file-name ":" ":\n" "MiniZinc:" message :modes mzn2fzn add-hook minizinc-mode-hook #[0 "\300 \207" [flycheck-mode] 1 "\n\n(fn)"] provide minizinc-mode minizinc-operators minizinc-operators-regex source line-start line line-end flycheck-checkers] 17)
require(minizinc-mode)
eval-buffer(#<buffer *load*> nil "/home/bachmann/.emacs" nil t) ; Reading at buffer position 750
load-with-code-conversion("/home/bachmann/.emacs" "/home/bachmann/.emacs" t t)
load("~/.emacs" t t)
#[0 \205\262 \306=\203\30\310Q\202; \311=\204\30\312Q\202;\313\307\314\315#\203*\316\202;\313\307\314\317#\203:\320\nB\321\202;\316\322\323\322\211#\210
\322=\203a\324\325\326\30\327Q!\"\323\322\211#\210
\322=\203`\210
\203\243\330
!\331\232\203\243\332
!\211\333P\334!\203}\211\202\210\334!\203\207\202\210\314\262\203\241\335
\"\203\237\336\337
#\210\340\341!\210\266\f?\205\260\314\323\342\322\211#)\262\207" [init-file-user system-type delayed-warnings-list user-init-file inhibit-default-init inhibit-startup-screen ms-dos "~" "/_emacs" windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs" "^_emacs\\(\\.elc?\\)?$" (initialization "`_emacs' init file is deprecated, please use `.emacs'") "~/_emacs" t load expand-file-name "init" file-name-as-directory "/.emacs.d" file-name-extension "elc" file-name-sans-extension ".el" file-exists-p file-newer-than-file-p message "Warning: %s is newer than %s" sit-for 1 "default"] 7 "\n\n(fn)"]()
command-line()
normal-top-level()
one more thing: after starting the emacs some_model.mzn
when I do a load-file
of minizinc-mode.el
and then set again the minizinc-mode
(using M-x minizinc-mode
) everything works find...
Then how about add the following line to the beginning of your minizin-mode conifg?
(add-to-list 'load-path "~/.emacs.d/elpa/minizin-mode-20180201.650")
(require 'minizinc-mode)
(autoload 'minizinc-mode "minizinc-mode" "Major mode for editing minizinc files")
@m00nlight
it's working! I uninstalled the package (actually using \rm -rf .emacs.d/elpa/minizinc-mode-20180201.650/
) and reinstalled it again.
I feel a bit bad for bothering you... ;-(
I wish to thank you for your patience!
andi
@andibachmann
👍
No problem. You're welcome.
Hello, I am having the same error described before after opening a valid minizinc file, and I have added the suggested lines into the config file:
Error in private config: config.el, (void-variable mzn2fzn)
Minizinc is already on my $PATH.
Any suggestions on how to work around this?
@Juanito970 If possible, could you please share the content of your config.el
?