compiling from the command line

Upto now I worked with Visual Studio Code but I'm trying now to compile on the command line.

I run

monkeyc -d fenix5plus -f monkey.jungle -o deluxe.prg -y key

and get the following error:

ERROR: monkey.jungle:2: mismatched input '=' expecting {'.', '-', ID, DIGIT, 'manifest', 'sourcePath', 'excludeAnnotations', 'resourcePath', 'lang', 'barrelPath', 'annotations'}

I have the following monkey.jungle:

project.manifest = manifest.xml

project.typecheck = 0

The monkey.jungle and manifest.xml are all in the same directory from where I run the monkeyc - command.

In Visual Studio Code it worked fine. What do I do wrong on the command line?

  • Your command line looks fine to me. I just tried something similar without problems.

    What platform are you using: Windows, Linux, or macOS? Which version of the CIQ SDK?

    Does your monkey.jungle file have LF or CR/LF line terminators? (VS Code will tell you in the status bar, and if you're using WSL, Linux or macOS you can use the "file" command. The advantage of the "file" command is that it will also tell you if there's a mix of line terminators)

    Is it possible you have weird invisible characters in monkey.jungle? Try installing the Gremlins tracker VS Code extension - it will highlight any possible harmful characters in your file.

    What happens if you create a new monkey.jungle from scratch (no copy-pasting)?

  • Without the second line it works: but I get then all of the typecheck errors which I do not want.

    Using macOS.

    It seems that he does not like "project.typecheck = 0" in the monkey.jungle. Maybe this does not work with monkeyc from the command line? 

  • Which SDK are you using?  Not all of them support project.typecheck in monkey.jumgle..

    Use 4.1.7 or 4.2.0 beta2

  • I use 4.1.7.

    The full error message is:

    ERROR: monkey2.jungle:2: extraneous input '0' expecting {'.', '[', '/', '\', '~', '$', NEWLINE, ID, 'manifest', 'sourcePath', 'excludeAnnotations', 'resourcePath', 'lang', 'barrelPath', 'annotations', STRING, STRINGPATTERN}

    ERROR: unknown:0: A valid 'project.manifest' property was not defined within a jungle file.

    ERROR: monkey2.jungle:3: extraneous input '<EOF>' expecting {'.', '[', '/', '\', '~', '$', NEWLINE, ID, 'manifest', 'sourcePath', 'excludeAnnotations', 'resourcePath', 'lang', 'barrelPath', 'annotations', STRING, STRINGPATTERN}

    ERROR: monkey2.jungle:2: mismatched input '=' expecting {'.', '-', ID, DIGIT, 'manifest', 'sourcePath', 'excludeAnnotations', 'resourcePath', 'lang', 'barrelPath', 'annotations'}

    If I comment out the line "project.typecheck = 0" from the monkey2.jungle these errors do not come, but then I get all of the typecheck errors which I do not want.

    I looked what Visual Studio Code does, but that does not use monkeyc but a java command, totally different.

    It seems that the monkeyc compiler does not know the "project.typecheck = 0" statement in the jungle file?

  • can't you pass -l 0 to monkeyc?

  • monkeyc -d fenix5plus -f monkey2.jungle -o deluxe.prg -y key -I 0

    ERROR: Unrecognized option: -I

  • lower case L and the number 0?

  • Upper case letter I (India) and number 0.

    Tried lower case L and number 0: does not recognize either.

    If I do "monkeyc" without options, it informs me as follows:

    arjen$ monkeyc

    ERROR: Please use -o to set an output file

    com.garmin.monkeybrains.ParameterException: Please use -o to set an output file

    at com.garmin.monkeybrains.Monkeybrains.run(Monkeybrains.java:2080)

    at com.garmin.monkeybrains.Monkeybrains.simpleMain(Monkeybrains.java:254)

    at com.garmin.monkeybrains.Monkeybrains.simpleMain(Monkeybrains.java:236)

    at com.garmin.monkeybrains.Monkeybrains.main(Monkeybrains.java:283)

    usage: monkeyc [-a <arg>] [-d <arg>] [-e] [--Eno-invalid-symbol] [-f <arg>] [-g]

           [-h] [-i <arg>] [-m <arg>] [-o <arg>] [-p <arg>] [-r] [-s <arg>] [-t] [-u

           <arg>] [-v] [-w] [-x <arg>] [-y <arg>] [-z <arg>]

    -a,--apidb <arg>       API import file

    -d,--device <arg>      Target device

    -e,--package-app       Create an application package.

       --Eno-invalid-symbolDo not error when a symbol is found to be invalid

    -f,--jungles <arg>     Jungle files

    -g,--debug             Print debug output

    -h,--help              Prints help information

    -i,--import-dbg <arg>  Import api.debug.xml

    -m,--manifest <arg>    Manifest file

    -o,--output <arg>      Output file to create

    -p,--project-info <arg>projectInfo.xml file to use when compiling

    -r,--release           Strip debug information

    -s,--sdk-version <arg> SDK version to target

    -t,--unit-test         Enables compilation of unit tests

    -u,--devices <arg>     devices.xml file to use when compiling

    -v,--version           Prints the compiler version

    -w,--warn              Show compiler warnings

    -x,--excludes <arg>    Add annotations to the exclude list

    -y,--private-key <arg> Private key to sign builds with

    -z,--rez <arg>         Resource file

    So no I-option offered.  

    The   --Eno-invalid-symbol  option did not help either.

  • Are you running the mokeyc file in the bin folder of the 4.1.7 SDK?  It looks like you are running an older SDK.  When I run the 4.1.7 version of monkeyc, I see this (cut down to a few lines)

    -k,--profile Enable profiling support
    -l,--typecheck <arg> Type check [0=off, 1=gradual, 2=informative,
    3=strict]
    -m,--manifest <arg> Manifest file (deprecated)

    It appears you are not seeing the info for -k either

  • Oh ok, I wish you had mentioned exactly which line was line 2 in monkey.jungle, although I should've picked up on that haha.

    Looks like you have the wrong SDK folder in your shell path, meaning that when you type "monkeyc" on the command line, you're not using the same SDK that's used by VS Code (which should be the SDK that's selected in the SDK manager). You can verify the SDK version that's being used in the command line as follows:

    monkeyc -v

    Example output:

    Connect IQ compiler version 4.2.0.beta1

    In your case I would expect the version to be something other than "4.1.7"; it would definitely be an older version which doesn't support type checking.

    Use the instructions here to ensure that the currently selected SDK (via SDK manager) is always in the shell path:

    https://developer.garmin.com/connect-iq/reference-guides/monkey-c-command-line-setup/

    That way you will be sure to always use the same SDK version in VS Code and the command line.

    If it still doesn't work, as a sanity check, make sure that current-sdk.cfg (referenced in the link above) contains the full path to the current SDK. And make sure there are no other hardcoded references to any SDKs elsewhere in your shell path.