Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.8 not running on Mac M2 #3326

Closed
stukennedy opened this issue Mar 19, 2024 · 19 comments · Fixed by #3328
Closed

v2.8 not running on Mac M2 #3326

stukennedy opened this issue Mar 19, 2024 · 19 comments · Fixed by #3328
Labels
Bug Something isn't working cannot reproduce The issue cannot be reproduced by the project maintainers

Comments

@stukennedy
Copy link

Description

a clean install of Wails v2.8 and a new project init will not run on my Mac, I get an error
" ERROR option -r not recognized" when running wails dev or wails build

If I downgrade Wails I can run it fine.

To Reproduce

  1. upgrade wails to v2.8
  2. wails init -n my-app
  3. cd my-app
  4. wails dev

Expected behaviour

Should run without error

Screenshots

Screenshot 2024-03-19 at 13 31 07

Attempted Fixes

No response

System Details

# Wails
Version | v2.8.0

# System
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
| OS           | MacOS                                                                                                                       |
| Version      | 14.2.1                                                                                                                      |
| ID           | 23C71                                                                                                                       |
| Go Version   | go1.21.6                                                                                                                    |
| Platform     | darwin                                                                                                                      |
| Architecture | arm64                                                                                                                       |
| CPU          | Apple M2 Pro                                                                                                                |
| GPU          | Chipset Model: Apple M2 Pro Type: GPU Bus: Built-In Total Number of Cores: 19 Vendor: Apple (0x106b) Metal Support: Metal 3 |
| Memory       | 16GB                                                                                                                        |
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌───────────────────────────────────────────────────────────────────────┐
| Dependency                | Package Name | Status    | Version        |
| Xcode command line tools  | N/A          | Installed | 2405           |
| Nodejs                    | N/A          | Installed | 21.0.0         |
| npm                       | N/A          | Installed | 10.2.0         |
| *Xcode                    | N/A          | Installed | 15.2 (15C500b) |
| *upx                      | N/A          | Available |                |
| *nsis                     | N/A          | Installed | v3.09          |
└─────────────────────── * - Optional Dependency ───────────────────────┘

# Diagnosis
Optional package(s) installation details:
  - upx : Available at https://upx.github.io/

Additional context

No response

@stukennedy stukennedy added the Bug Something isn't working label Mar 19, 2024
@leaanthony
Copy link
Member

Thanks for opening this. Looks like Apple has changed xattr. Can confirm later today.

@leaanthony leaanthony added the cannot reproduce The issue cannot be reproduced by the project maintainers label Mar 19, 2024
@leaanthony
Copy link
Member

Cannot reproduce here.

# System
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
| OS           | MacOS                                                                                                                       |
| Version      | 14.3.1                                                                                                                      |
| ID           | 23D60                                                                                                                       |
| Go Version   | go1.22.0                                                                                                                    |
| Platform     | darwin                                                                                                                      |
| Architecture | arm64                                                                                                                       |
| CPU          | Apple M2 Pro                                                                                                                |
| GPU          | Chipset Model: Apple M2 Pro Type: GPU Bus: Built-In Total Number of Cores: 16 Vendor: Apple (0x106b) Metal Support: Metal 3 |
| Memory       | 16GB                                                                                                                        |
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Did you install 3rd party user land tools which might include xattr?

@stukennedy
Copy link
Author

No idea ... I'm pretty new to Go.

@mccolljr
Copy link

I came here looking for this issue - in my case, I had an xattr executable in my path before the mac-native xattr executable. Removing it fixed the wails build, but I'm wondering if there is a way to work around this... Another tool I use relied on that other xattr. Its a bummer that I can't have both installed.

@mccolljr
Copy link

@stukennedy I saw the exact same error text as you, which makes me think maybe we have the same problem. I use asdf to manage versions of the different tools on my machine, and one of my python installs had added an xattr executable to my path.

@leaanthony
Copy link
Member

I'll see if there's a native way to do this. What is the equivalent of xattr -rc <filename> in your other xattr command?

@leaanthony
Copy link
Member

Please review the code in this PR: #3328. Please test in a sandbox!

@stukennedy
Copy link
Author

I'll see if there's a native way to do this. What is the equivalent of xattr -rc <filename> in your other xattr command?

this is the guide for using xattr in my terminal

usage: xattr [-slz] file [file ...]
       xattr -p [-slz] attr_name file [file ...]
       xattr -w [-sz] attr_name attr_value file [file ...]
       xattr -d [-s] attr_name file [file ...]
       xattr -c [-s] file [file ...]

The first form lists the names of all xattrs on the given file(s).
The second form (-p) prints the value of the xattr attr_name.
The third form (-w) sets the value of the xattr attr_name to attr_value.
The fourth form (-d) deletes the xattr attr_name.
The fifth form (-c) deletes (clears) all xattrs.

options:
  -h: print this help
  -s: act on symbolic links themselves rather than their targets
  -l: print long format (attr_name: attr_value)
  -z: compress or decompress (if compressed) attribute value in zip format

@mccolljr
Copy link

@leaanthony thanks for the super fast turnaround. I will give this new implementation a shot after work today and report back.

@mccolljr
Copy link

mccolljr commented Mar 21, 2024

@leaanthony I tested the code from your PR, but it looks like it fails on my mac:

System Info image
  • xcode-select --version: xcode-select version 2405
  • xcode-select --print: /Library/Developer/CommandLineTools

the test:

# create an alias to run wails from your PR commit
alias wails_xattr="go run github.com/wailsapp/wails/v2/cmd/wails@880a4e0b409fa552d16e7d6b1cef6fd9e9e86c0a"

# create a new project
wails_xattr init -d wails_xattr_test -n wails_xattr_test -t vanilla-ts

# test the project build
cd wails_xattr_test
wails_xattr build -v 2

output from init:

$> wails_xattr init -d wails_xattr_test -n wails_xattr_test -t vanilla-ts
Wails CLI v2.8.0


# Initialising Project 'wails_xattr_test'
Project Name      | wails_xattr_test                                  
Project Directory | /Users/jmccollum/dev/go/src/local/wails_xattr_test
Template          | Vanilla + Vite (Typescript)                       
Template Source   | https://wails.io                                  

Initialised project 'wails_xattr_test' in 44ms.

 ♥   If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony

output from build:

$> wails_xattr build -v 2
Wails CLI v2.8.0


# Build Options

Platform(s)        | darwin/arm64                                               
Compiler           | /Users/jmccollum/.asdf/installs/golang/1.22.1/go/bin/go    
Skip Bindings      | false                                                      
Build Mode         | production                                                 
Devtools           | false                                                      
Frontend Directory | /Users/jmccollum/dev/go/src/local/wails_xattr_test/frontend
Obfuscated         | false                                                      
Skip Frontend      | false                                                      
Compress           | false                                                      
Package            | true                                                       
Clean Bin Dir      | false                                                      
LDFlags            |                                                            
Tags               | []                                                         
Race Detector      | false                                                      

# Building target: darwin/arm64

  • Generating bindings:  INFO  
Done.
  • Installing frontend dependencies: 
 INFO  Install command: 'npm install'
    
    added 16 packages, and audited 17 packages in 2s
    
    6 packages are looking for funding
      run `npm fund` for details
    
    found 0 vulnerabilities
    
    
Done.
  • Compiling frontend: 
 INFO  Build command: 'npm run build'
    
    > [email protected] build
    > tsc && vite build
    
    vite v3.2.8 building for production...
    transforming...
    ✓ 7 modules transformed.
    rendering chunks...
    dist/assets/logo-universal.157a874a.png               136.42 KiB
    dist/assets/nunito-v16-latin-regular.06f3af3f.woff2   18.53 KiB
    dist/index.html                                       0.36 KiB
    dist/assets/index.0ba11610.js                         1.40 KiB / gzip: 0.72 KiB
    dist/assets/index.5a710b5e.css                        1.13 KiB / gzip: 0.57 KiB
    
    
Done.
  • Compiling application: 
 INFO  Build command: go build -tags desktop,wv2runtime.download,production -ldflags "-w -s" -o /Users/jmccollum/dev/go/src/local/wails_xattr_test/build/bin/wails_xattr_test
  • Environment:%!(EXTRA string=PATH=/Users/jmccollum/.asdf/installs/golang/1.22.1/go/bin:/Users/jmccollum/.asdf/installs/golang/1.22.1/packages/bin:/opt/homebrew/opt/llvm@16/bin:/Users/jmccollum/.asdf/shims:/Users/jmccollum/.asdf/bin:/opt/homebrew/opt/coreutils/libexec/gnubin:/Users/jmccollum/.cargo/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:~/.dotnet/tools:/Users/jmccollum/dev/go/bin:/Users/jmccollum/.cargo/bin:./bin SHELL=/opt/homebrew/opt/bash/bin/bash XPC_FLAGS=0x0 TERM_PROGRAM_VERSION=452 JDK_HOME=/Users/jmccollum/.asdf/installs/java/openjdk-21 DOTNET_HOME=/Users/jmccollum/.asdf/installs/dotnet/6.0.415 JAVA_HOME=/Users/jmccollum/.asdf/installs/java/openjdk-21 __CFBundleIdentifier=com.apple.Terminal SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.vLPXXjoRdk/Listeners TERM_SESSION_ID=91BC5529-2C18-4388-9EFB-B156B97BB0E5 HOMEBREW_PREFIX=/opt/homebrew PWD=/Users/jmccollum/dev/go/src/local/wails_xattr_test LOGNAME=jmccollum MANPATH=/opt/homebrew/share/man: DEVPATH=/Users/jmccollum/dev HOME=/Users/jmccollum LANG=en_US.UTF-8 TMPDIR=/var/folders/nh/z0j0fsds7dnds8t0v_qjs6g00000gn/T/ GOROOT=/Users/jmccollum/.asdf/installs/golang/1.22.1/go MYGOPATH=/Users/jmccollum/dev/go/src/github.com/mccolljr;/Users/jmccollum/dev/go/src/local INFOPATH=/opt/homebrew/share/info: TERM=xterm-256color ASDF_DIR=/Users/jmccollum/.asdf USER=jmccollum HOMEBREW_CELLAR=/opt/homebrew/Cellar SHLVL=1 HOMEBREW_REPOSITORY=/opt/homebrew XPC_SERVICE_NAME=0 BASH_COMPLETIONS_DIR=/usr/local/etc/bash_completion.d OLDPWD=/Users/jmccollum/dev/go/src/local GOPATH=/Users/jmccollum/dev/go TERM_PROGRAM=Apple_Terminal GIT_TERMINAL_PROMPT=0 GIT_SSH_COMMAND=ssh -o ControlMaster=no -o BatchMode=yes GCM_INTERACTIVE=never CGO_CFLAGS=-mmacosx-version-min=10.13 CGO_CXXFLAGS=-I/Users/jmccollum/dev/go/src/local/wails_xattr_test/build CGO_ENABLED=1 CGO_LDFLAGS=-framework UniformTypeIdentifiers -mmacosx-version-min=10.13 GOOS=darwin GOARCH=arm64)  ERROR   exit status 64 - 

  ERROR   exit status 64 - 
 ♥   If Wails is useful to you or your company, please consider sponsoring the project:
https://github.com/sponsors/leaanthony
exit status 1

output from the mentioned build command (run manually):

$> go build -tags desktop,wv2runtime.download,production -ldflags "-w -s" -o /Users/jmccollum/dev/go/src/local/wails_xattr_test/build/bin/wails_xattr_test
# changeme
/Users/jmccollum/.asdf/installs/golang/1.22.1/go/pkg/tool/darwin_arm64/link: running clang failed: exit status 1
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_UTType", referenced from:
       in 000026.o
ld: symbol(s) not found for architecture arm64
clang-15: error: linker command failed with exit code 1 (use -v to see invocation)

@mccolljr
Copy link

Also, FWIW:

I can't say with certainty that the changes from your PR caused the issue, but I can confirm that running the above test using the @latest tag works (as long as I have the correct xattr in path):

# create an alias to run wails from your PR commit
alias wails_xattr="go run github.com/wailsapp/wails/v2/cmd/wails@latest"

# create a new project
wails_xattr init -d wails_xattr_test -n wails_xattr_test -t vanilla-ts

# test the project build
cd wails_xattr_test
wails_xattr build -v 2

@leaanthony
Copy link
Member

Thanks for testing. Having the correct xattr should always have worked. I'm just thinking that perhaps we could drop the r flag but I'm not sure it would strip all the extended attributes

@mccolljr
Copy link

mccolljr commented Mar 21, 2024

Thanks for testing. Having the correct xattr should always have worked. I'm just thinking that perhaps we could drop the r flag but I'm not sure it would strip all the extended attributes

The default xattr command is (in theory) always going to be in a standard location on darwin systems, right? What if you used the absolute path where the system xattr is expected to be installed (/usr/bin/xattr)?

Alternatively, maybe you could accept some kind of escape hatch for the user to provide a path for xattr in situations where the xattr from the PATH isn't the right one. I'm not sure how it would be best to expose such an option... maybe a command line flag?

@YuShigurey
Copy link

I also encountered this problem. mccolljr's comment reminds me to check about python stuff. In my case, after deactivate conda base environment (conda deactivate), wails works. Could be a temporary workaround.

@mccolljr
Copy link

In my case, now that I know the problem as the presence of a funky xattr executable in my PATH, I think I would be totally fine with it if you were to say "I'm not fixing this, fix your PATH". All I'd really like to see is maybe a warning printed to the terminal that says something like "Hey, which xattr has a weird value on your machine. Your build may fail, now you know why"

@leaanthony
Copy link
Member

Try the PR now... uses fixed path calls. Appears to work locally.

@mccolljr
Copy link

Thanks for the update - Will try again after work

@mccolljr
Copy link

I can confirm that the absolute path fix from #3328 works on my machine even when I have a different xattr installed in my PATH 👍

@leaanthony
Copy link
Member

Merged. Thanks for the quick feedback 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working cannot reproduce The issue cannot be reproduced by the project maintainers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants