esa / opengeode

OpenGEODE - a free SDL editor
https://opengeode.net
GNU Lesser General Public License v3.0
69 stars 20 forks source link

ASN.1 compiler not found #56

Closed SerenaC94 closed 4 years ago

SerenaC94 commented 4 years ago

Hi, I successfully installed OpenGeode as standalone tool following the instructions. If I run

mono /opt/asn1scc/asn1.exe

I get

ERROR: missing parameter '<files>...'.
USAGE: Asn1f4.exe [--help] [--c-lang] [--ada-lang] [--uper-enc] [--xer-enc]
                  [--acn-enc] [--auto-test-cases] [--out <dir>] [--equal-func]
                  [--xml-ast <xmlFilename>] [--type-prefix <prefix>]
                  [--rename-policy <int>] [--field-prefix <prefix>]
                  [--generate-test-grammar]
                  [--custom-stg <custom stg colon outfilename>]
                  [--custom-stg-ast-version <astver>]
                  [--icduper <uper icd output file>]
                  [--customicduper <custom stg colon out filename>]
                  [--icdacn <acn icd output file>]
                  [--customicdacn <custom stg colon out filename>] [--adauses]
                  [--acnd] [--word-size <wordSize>]
                  [--fp-word-size <fpWordSize>] [--version]
                  [--debug-asn1 [<string>]]
                  [--mapping-functions-module <string>] [--debug]
                  [--streaming-mode] <files>...

with all the rest of the manual following. So I assumed that the ASN.1 compiler was also successfully installed (not in /opt though, I have it in another directory). I added the directory to my PATH, which can be proved by

$ echo $PATH
---lots of other directories here---:/--path to my software folder---/asn1scc

However, if I try to run one of the tests I get the following error(s):

opengeode/tests/testsuite/test4$ make edit
opengeode orchestrator.pr system_structure.pr
[INFO] Model backup enabled - auto-saving every 2 minutes
Qt WebEngine seems to be initialized from a plugin. Please set Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute before constructing QGuiApplication.
[ERROR] ASN.1 compiler failed - ASN.1 Compiler not found in path
[ERROR] Type MyInteger not found in ASN.1 model
[ERROR] Type MyInteger not found in ASN.1 model
[ERROR] Type MyInteger not found in ASN.1 model(line 15)
[ERROR] Type MyInteger not found in ASN.1 model(line 16)
[ERROR] Type MyInteger not found in ASN.1 model - "a, a2 MyInteger"

and many other similar messages. Did I miss something?

P.S. I know it is probably easier to download the TASTE VM, but I only need OpenGeode and it feels like a big overhead to run a virtual machine just for that.

maxime-esa commented 4 years ago

The piece of code that raises this error is this :

path_to_asn1scc = spawn.find_executable('asn1.exe')
if not path_to_asn1scc:
        raise TypeError('ASN.1 Compiler not found in path')

I suggest to check the following, from the same shell session that you execute opengeode 1) make sure that the command which asn1.exe does return something 2) if it returns something, open python3 in the console and type:

>>> import distutils.spawn as spawn
>>> spawn.find_executable('asn1.exe')

Does it display something?

SerenaC94 commented 4 years ago
1. make sure that the command `which asn1.exe` does return something

It doesn't. That's weird, because I am sure that the PATH variable is set correctly. (I also tried moving the folder to /opt to make sure that it was not due to the non standard location.)

It doesn't help that "which" makes a very poor google keyword...

maxime-esa commented 4 years ago

which locates command by scanning the PATH (type man which to get the help - this works for all unix commands)

If it does not return anything, it means that the file is not in the PATH : either you have a typo in your PATH setting, or you have not updated it properly: make sure you have run: export PATH=$PATH:/path/to/asn1scc If this is in your .bashrc (or similar), make sure you sourced it (or open a new bash session)

SerenaC94 commented 4 years ago

I think in the end it was a typo, but I am not sure because I cut and pasted again the same lines and now it works. Maybe there was a blank space at the end of the .bashrc file (which was sourced because I could see the modifications doing echo $PATH).

So, thanks again for your patience. I am still seeing errors when I open the tests, but I will consider the TASTE virtual machine since there are other people in my team that need to use OpenGeode and maybe it will save us some time.

maxime-esa commented 4 years ago

What errors do you have now? I think it's better to fix them once for all, that will make the life of future users who want to make a native install easier.

SerenaC94 commented 4 years ago
opengeode/tests/testsuite/test4$ make edit
opengeode orchestrator.pr system_structure.pr
[INFO] Model backup enabled - auto-saving every 2 minutes
Qt WebEngine seems to be initialized from a plugin. Please set Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute before constructing QGuiApplication.
[ERROR] ASN.1 compiler failed - 'PySide2.QtCore.QFile.open' called with wrong argument types:
  PySide2.QtCore.QFile.open(int)
Supported signatures:
  PySide2.QtCore.QFile.open(int, PySide2.QtCore.QIODevice.OpenMode, PySide2.QtCore.QFileDevice.FileHandleFlags=PySide2.QtCore.QFileDevice.FileHandleFlag.DontCloseHandle)
  PySide2.QtCore.QFile.open(PySide2.QtCore.QIODevice.OpenMode)
maxime-esa commented 4 years ago

This seems to be due to a change in Pyside2 API. I committed a fix that works here and hopefully will work with your version too. Please do the following:

  $ cd ~/path/to/opengeode
  $ git pull
  $ pip3 install --user --upgrade .

And then try to open the project again

SerenaC94 commented 4 years ago

Looks definitely better now, I just get these two warnings:

[WARNING] This expression may result in a negative (signed) number while type of operand is unsigned - "a - 1"
[WARNING] This expression may result in a negative (signed) number while type of operand is unsigned - "a - 1"
maxime-esa commented 4 years ago

Excellent! Let me know if you have any other issue.