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

qtmoc unable to find module in a subfolder #804

Open
ilya-fedin opened this issue Mar 21, 2019 · 12 comments
Open

qtmoc unable to find module in a subfolder #804

ilya-fedin opened this issue Mar 21, 2019 · 12 comments

Comments

@ilya-fedin
Copy link

ilya-fedin commented Mar 21, 2019

I added go.mod to the project and specified absolute import in a file, but when I trying to build application with qtdeploy - it fails with the following error

ERRO[0023] failed to run command                         _func=RunCmd cmd="go list -mod=vendor -e -f {{.ImportPath}} -tags=\"\"" dir=/home/ilya/go/hilink-tray env="GTK_USE_PORTAL=1 SSH_AUTH_SOCK=/run/user/1000/keyring/ssh SESSION_MANAGER=local/arch:@/tmp/.ICE-unix/804,unix/arch:/tmp/.ICE-unix/804 LANG=ru_RU.UTF-8 NIX_USER_PROFILE_DIR=/nix/var/nix/profiles/per-user/ilya XDG_CURRENT_DESKTOP=MATE TERM=xterm ANDROID_HOME=/home/ilya/Android/Sdk WINDOWID=39845894 XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/ilya NIX_REMOTE=daemon MATE_DESKTOP_SESSION_ID=this-is-deprecated USER=ilya DESKTOP_SESSION=mate XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0 NIX_PROFILES=/nix/var/nix/profiles/default /home/ilya/.nix-profile SYSTEMD_EDITOR=micro HOME=/home/ilya QT_SCALE_FACTOR=1 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus XDG_VTNR=7 XDG_SEAT=seat0 GTK_MODULES=canberra-gtk-module XDG_DATA_DIRS=/home/ilya/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/nix/var/nix/profiles/default/share:/var/lib/snapd/desktop VTE_VERSION=5600 XDG_SESSION_DESKTOP=mate COLORTERM=truecolor NIX_PATH=/home/ilya/.nix-defexpr/channels:nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs:/nix/var/nix/profiles/per-user/root/channels GTK_OVERLAY_SCROLLING=0 MAIL=/var/spool/mail/ilya LOGNAME=ilya XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0 PATH=/run/wrappers/bin:/home/ilya/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/opt/android-sdk/platform-tools:/opt/android-sdk/tools:/opt/android-sdk/tools/bin:/home/ilya/.local/share/flatpak/exports/bin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin:/home/ilya/Android/Sdk/tools:/home/ilya/Android/Sdk/tools/bin:/home/ilya/Android/Sdk/platform-tools:/home/ilya/Qt5.12.0/5.12.0/gcc_64/bin:/home/ilya/go/bin:/home/ilya/.local/bin CUPS_SERVER=ld305:631 XDG_RUNTIME_DIR=/run/user/1000 XDG_SESSION_ID=1 SHELL=/bin/zsh XDG_SESSION_TYPE=x11 QT_AUTO_SCREEN_SCALE_FACTOR=0 NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt EDITOR=micro QT_QPA_PLATFORMTHEME=kde SHLVL=1 XAUTHORITY=/home/ilya/.Xauthority LC_COLLATE=C FREETYPE_PROPERTIES=truetype:interpreter-version=38 XDG_SESSION_CLASS=user DISPLAY=:0 PWD=/home/ilya/go/hilink-tray GDMSESSION=mate OLDPWD=/home/ilya ZSH=/home/ilya/.oh-my-zsh PAGER=less LESS=-R LSCOLORS=Gxfxcxdxbxegedabagacad LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36: LC_CTYPE=ru_RU.UTF-8 DEFAULT_USER=ilya _=/home/ilya/go/bin/qtmoc CGO_ENABLED=0" error="exit status 1" name="get import path"
build github.com/ilya-fedin/hilink-tray: cannot load github.com/ilya-fedin/hilink-tray/pulse: no Go source files
@therecipe
Copy link
Owner

Hey

Maybe try to run go mod download first.

Also maybe take a look here #755 (comment)

@ilya-fedin
Copy link
Author

No, neither the command nor the link method works.

@therecipe
Copy link
Owner

Mh, okay maybe check where you import github.com/ilya-fedin/hilink-tray/pulse.
The error says it's not containing any go files.

@ilya-fedin
Copy link
Author

go.mod of the project contains module github.com/ilya-fedin/hilink-tray
The project contains a subfolder pulse. Relative import ./pulse works, but absoulte import don't.

@therecipe
Copy link
Owner

therecipe commented Mar 27, 2019

Could you check if these commands work and return something:

CGO_ENABLED=0 go list -mod=vendor -e -f {{.Dir}} github.com/ilya-fedin/hilink-tray/pulse
CGO_ENABLED=0 go list -mod=vendor -e -f {{.ImportPath}} github.com/ilya-fedin/hilink-tray/pulse

if you run them inside the root dir of your project?

Also which go version do you use?

@ilya-fedin
Copy link
Author

 ~/go/hilink-tray  CGO_ENABLED=0 go list -mod=vendor -e -f {{.Dir}} github.com/ilya-fedin/hilink-tray/pulse
/home/ilya/go/hilink-tray/pulse
 ~/go/hilink-tray  CGO_ENABLED=0 go list -mod=vendor -e -f {{.ImportPath}} github.com/ilya-fedin/hilink-tray/pulse
github.com/ilya-fedin/hilink-tray/pulse
 ~/go/hilink-tray  go version
go version go1.12.1 linux/amd64

@therecipe
Copy link
Owner

Mh, what kind of files does the pulse folder contains?
Do you use build tags or build suffixes like _windows.go or something?
Or does the folder maybe only contain cgo files?

Maybe try to run the following in the hilink-tray dir

go list -mod=vendor -e -f {{.ImportPath}}

(which probably should work)

and then

CGO_ENABLED=0 go list -mod=vendor -e -f {{.ImportPath}}

(which might fail, if the pulse folder only contains cgo files)

you can also check the pulse folder for cgo files, if you run

go list -f {{.CgoFiles}}

inside it

I guess the pulse folder only contains cgo files, and that's why it's failing.

In that case you will need to create an empty Go file such as

package pulse

to work around this.

Because CGO_ENABLED=0 is needed to work around this go mod issue here golang/go#29452


Also you said relative imports work, but absolute not.
Do you mean github.com/ilya-fedin/hilink-tray/pulse or /home/ilya/go/hilink-tray/pulse imports won't work?

@ilya-fedin
Copy link
Author

Yes, this folder contains only cgo file

github.com/ilya-fedin/hilink-tray
 ~/go/hilink-tray  CGO_ENABLED=0 go list -mod=vendor -e -f {{.ImportPath}}
build github.com/ilya-fedin/hilink-tray: cannot load github.com/ilya-fedin/hilink-tray/pulse: no Go source files

Do you mean github.com/ilya-fedin/hilink-tray/pulse or /home/ilya/go/hilink-tray/pulse imports won't work?
I mean ./pulse by relative import (which works, but doesn't work with snapcraft), and github.com/ilya-fedin/hilink-tray/pulse by absolute (which doesn't works), so I'm trying to get absolute import working :(

@ilya-fedin
Copy link
Author

It's interesting, even if I remove import of pulse, I'm getting build github.com/ilya-fedin/hilink-tray: cannot load github.com/therecipe/qt/core: no Go source files

@therecipe
Copy link
Owner

and github.com/ilya-fedin/hilink-tray/pulse by absolute (which doesn't works), so I'm trying to get absolute import working :(

Ah okay, thanks yeah these should work.

It's interesting, even if I remove import of pulse, I'm getting build github.com/ilya-fedin/hilink-tray: cannot load github.com/therecipe/qt/core: no Go source files

Yeah, but that's probably only because you missed the -mod=vendor flag, so nothing to worry about.

Maybe try the following:

  • create an "pure" Go file in the pulse folder (something like package pulse should be enough)
  • add/change the import to github.com/ilya-fedin/hilink-tray/pulse

then (if you already did successfully install the binding for your project earlier) run either

  • go build -mod=vendor
    or
  • qtminimal && go build -tags=minimal -mod=vendor
    or
  • qtdeploy

(in case you removed the vendor folder, please take a look at #755 (comment) again and re-run the setup first.)

@ilya-fedin
Copy link
Author

ilya-fedin commented Apr 3, 2019

Yeah, but that's probably only because you missed the -mod=vendor flag, so nothing to worry about.

But I got it with qtdeploy

@therecipe
Copy link
Owner

Mh, did you already setup the binding using qtsetup?
Or did you remove/change the vendor dir?
And does your project still work when using the relative import?

Also does this command work?

go list -mod=vendor -f {{.Dir}} github.com/therecipe/qt/core

If not, then please try to setup the binding again first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants