Ord function is asking for two arguments

Reporter: 9Morello  |  Status: open  |  Last Modified: October 12, 2017, 04:49:01 PM

Title says it all. I'm getting the following error when trying to compile on Linux:

Line 13, position 31 (absolute 318): Too few arguments to functionord': provided 1, required 2.`

The wiki doesn't mention such extra argument. The project compiles fine in GM: Studio.

RobertBColton  
Hey! We got a fix for this one already: #1055 (comment)

It's the one Josh links, ignore the rest of that issue because it should fix your problem. If it doesn't work for you let me know and I'll reopen this. Closing for now as a duplicate since #1055 is still open on this.

9Morello  

@RobertBColton Thanks, that got me past that error.

Unfortunately, I'm getting another error further in the compiling now, and this one crashes LGM.

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007feacbd55430, pid=11956, tid=0x00007fea432f3700
#
# JRE version: OpenJDK Runtime Environment (8.0_131-b11) (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)
# Java VM: OpenJDK 64-Bit Server VM (25.131-b11 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libstdc++.so.6+0x121430]  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const+0x10
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# enigma-dev/hs_err_pid11956.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.

I can share the hs_err_pid11956.log file if it helps.

RobertBColton  

@9Morello Please try applying the patch 7b76749

Did you pull our latest changes from Git? If not, then you don't have that fix.

9Morello  

Yes, I compiled it one hour ago, so I think that commit is included.
RobertBColton  

Well, hrm, double check the files anyway and see if it's in fact there. I'll ask @JoshDreamland

@9Morello Did you do a fresh clone though? Because of the way that commit works you have to completely restart ENIGMA. Also I would try deleting the file compileEGMf.dll before you open ENIGMA back up.

9Morello  

@RobertBColton yes, it was a fresh clone in a fresh Ubuntu install.

Just to be sure, I deleted libcompileEGMf.so, ran git pull and tried to compile from scratch again. Same error.

RobertBColton  

Strange indeed, you got the same as SuperRiderTH in that other issue: #1055 (comment)

But @faissaloo claims that it works for him after that second patch. Basically it's a bug in our compiler with reading C++11 headers, so you could try modifying enigma-dev/Compilers/Linux/gcc.ey to remove the C++11 flags, then delete libcompileEGMf.so again and restart. You could also double check that the gcc.ey file has those other flags from Josh's commit just to make sure something weird didn't happen in the pull.

Further, it would help if you could tell me what gcc -v says because this issue is occurring only for people with newer GCC's. We just can't seem to reliably reproduce it because I don't have it with GCC 7.2 on Windows and neither does our AppVeyor build. You could try downgrading to GCC 4.8.2 (which Travis CI passes with on Ubuntu) or upgrading to GCC 7.2.

9Morello  

Output of gcc -v:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.5' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.5) 
  1. I checked the flags match the commit;
  2. I tried removing the C++ flags by letting the cxxflags: field empty in gcc.ey. Was that correct?

Sorry for the delay, I wrote this 8 hours ago and just realized I hadn't submitted the comment. lol

RobertBColton  

That's ok, and still strange. So when you applied this fix:
http://enigma-dev.org/forums/index.php?topic=2669.msg25839#msg25839

You put the code at the very top of ENIGMASystem/SHELL/SHELLmain.cpp above all the includes?

RobertBColton  

@9Morello you can also try the PR @JoshDreamland just sent. #1106

It contains a new more-permanent fix that hasn't been shared before.

9Morello  

@RobertBColton Yes, I put it at the very top.
I tried using the new fix, got the same error.
faissaloo  

@9Morello Are you sure you cloned the right branch? It fixed it for me
9Morello  

@faissaloo Actually I manually added the extra line to gcc_backend.cpp and created the ENIGMAsystem/SHELL/Mock_JDI_Headers/string file. Then I deleted libcompileEGMf.so and ran ENIGMA again. Anything else I should do?
faissaloo  

@9Morello Delete your enigma folder, replace this line in the install script: git clone git clone https://github.com/enigma-dev/enigma-dev with git clone -b Mock_JDI_Headers "https://github.com/enigma-dev/enigma-dev" then run the install script again
RobertBColton  

I would try exactly as @faissaloo recommended just to be sure and I would also delete %HOME%/.enigma/ too. This is really strange, because we haven't encountered a case yet that this doesn't fix your specific error.
JoshDreamland  

How does ord appear in your function list, now (under the build menu)?
9Morello  

@faissaloo @RobertBColton Just tried doing as you said. I deleted the enigma-dev and ./enigma folders, edited the script to clone the Mock_JDI_Headers branch and compiled everything from scratch. ENIGMA crashed with the exact same error when building:

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f9e0c02b430, pid=22953, tid=0x00007f9d83fff700
#
# JRE version: OpenJDK Runtime Environment (8.0_131-b11) (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)
# Java VM: OpenJDK 64-Bit Server VM (25.131-b11 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libstdc++.so.6+0x121430]  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const+0x10
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# enigma-dev/hs_err_pid22953.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
enigma-dev/start.sh: line 3: 22953 Aborted                 (core dumped) java -Djna.nosys=true -jar lateralgm.jar "$1"

@JoshDreamland for some reason, the function list doesn't show up in the code editor. Though I'm not getting errors related to the ord function anymore.

RobertBColton  

@9Morello He was alluding to the Build->Keyword List->Functions menu option. What is crashing here is the part of ENIGMA called JDI, which scans all of the C++ headers (*.h files) where ord and other functions are listed and collects them and sends them up to the IDE, LateralGM, for it to use them in syntax highlighting. Now the reason ENIGMA is crashing is because JDI has a problem with parsing modern C++ and it fails to parse the standard <string> header, which is completely unrelated to ord(...).

Ideally what we are trying to do is remove all of these includes, because they actually slow down the build, in addition to being difficult to parse, and instead make a forward-declaration "mock" of the string include, hence the filenames etc.

RobertBColton  

For reference, the file that defines ord(...) is not directly including <string>

It includes it indirectly through var4.h

JoshDreamland  

@9Morello That sounds as though ENIGMA crashed, which is different from what you were describing before. But if ENIGMA crashed, you shouldn't see a Build menu at all... in fact, ENIGMA crashing usually takes down LGM, so I'm sort of confused. Is the crash actually while running the game?
9Morello  

@JoshDreamland sorry for not making myself clear. This crash happens when attempting to compile the game. It does take down LGM with it. I ran it from the terminal and that was the error I got.

I believe this error has nothing do to with the first one, which didn't crash LGM/ENIGMA at all.

JoshDreamland  

If I had to guess, this error is occurring when JDI cleans up definitions from its previous runs. Something must be getting double-freed. I'll see if I can reproduce that tonight; otherwise, I'll need you to get me a valgrind dump, which will be tricky to do with the JVM hanging around.
Please sign in to post comments, or you can view this issue on GitHub.