Trouble with generating Unity API: bad slashes running make in WSL

Hi folks,

I’m still trying to get Unity codegen working.

I’ve got the latest codegen EXE and template pack in my project. I’m trying to run the make command in WSL as specified, but it’s failing in the generate_package step.

Here’s my file layout:

PS C:\dev\project\codegen> tree
Folder PATH listing for volume Fast
Volume serial number is 6062-834E
C:.
├───accelbyte-unity-sdk-template-pack
│   ├───res
│   │   └───com.AccelByte.SDK.Custom
│   │       ├───Editor
│   │       │   └───Resources
│   │       └───Runtime
│   │           └───Core
│   └───templates
│       ├───common
│       ├───package
│       └───sdk_customization
└───com.AccelByte.SDK.Custom
    ├───Editor
    │   └───Resources
    ├───Runtime
    │   └───Core
    └───spec
        └───Client

Here’s the contents of that directory:

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         13-Mar-24     17:27                accelbyte-unity-sdk-template-pack
d-----         06-Mar-24     21:33                com.AccelByte.SDK.Custom
-a----         13-Mar-24     17:26       10356924 accelbyte-codegen-windows_amd64.exe
-a----         06-Mar-24     20:52            307 fstab

Here’s what I get when I run the failing make command directly in a WSL terminal in VS Code:

clambert@DESKTOP-63FMGAI:/mnt/c/dev/project/codegen/accelbyte-unity-sdk-template-pack$ make generate_package CODEGEN_PATH=../accelbyte-codegen-windows_amd64.exe PROJECT_PATH=../../../../../UnityProject/project/Packages SPEC_PATH=../../../../../UnityProject/project/Packages/Spec
Traceback (most recent call last):
  File "accelbyte-codegen.py", line 115, in <module>
  File "accelbyte_codegen\cli\__main__.py", line 42, in main
  File "click\core.py", line 1157, in __call__
  File "click\core.py", line 1078, in main
  File "click\core.py", line 1688, in invoke
  File "click\core.py", line 1434, in invoke
  File "click\core.py", line 783, in invoke
  File "click\decorators.py", line 33, in new_func
  File "accelbyte_codegen\cli\render\command.py", line 278, in render_command
  File "accelbyte_codegen\cli\render\command.py", line 89, in render
  File "accelbyte_codegen\cli\render\processor.py", line 203, in __call__
  File "accelbyte_codegen\cli\render\processor.py", line 130, in __call__
  File "accelbyte_codegen\cli\render\processor.py", line 115, in __call__
AssertionError: '\mnt\c\dev\project\codegen\accelbyte-unity-sdk-template-pack\templates\package\package-json.j2' path does not exist
[21788] Failed to execute script 'accelbyte-codegen' due to unhandled exception!
make: *** [Makefile:100: generate_package] Error 1

It looks like the AB codegen binary is taking a path that entirely uses forward slashes and converting it to backslashes, which fails in WSL. Running from a Cygwin bash terminal fares even worse.

Thanks, Chris

Hello there, it’s me again from the Extend team

We’ve noticed that you’ve been using the Windows binary (accelbyte-codegen-windows_amd64.exe) in WSL. Whenever you’re operating within WSL, make sure to grab and use the Linux binary (accelbyte-codegen-linux_amd64) instead.

However, if you prefer using the Windows binary with cygwin, you’ll need to use cygpath with the -m option to convert those slashes.

make all \
    CODEGEN_PATH=$(cygpath -m ../accelbyte-codegen-windows_amd64.exe) \
    PROJECT_PATH=$(cygpath -m ../MyAwesomeGame) \
    SPEC_PATH=$(cygpath -m ../spec)

Hope this information proves helpful!

That was it, thank you!

1 Like