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

"fork/exec C:\msys64\mingw64\bin\g++.exe: The filename or extension is too long." when linking on MSYS2/windows #657

Open
hitchfred opened this issue Jul 1, 2018 · 8 comments

Comments

@hitchfred
Copy link

@hitchfred hitchfred commented Jul 1, 2018

Hi. I am having issues building some of the examples on MSYS2.

goobe@desktop MSYS ~/go/src/github.com/therecipe/examples
$ qtdeploy test desktop ./advanced/qml_quick/goroutine
time="2018-07-01T13:54:39-04:00" level=error msg="failed to run command" cmd="go build -p 4 -v -ldflags=\"-s\" \"-w\" \"-H=windowsgui\" -o C:\\Users\\goobe\\go\\src\\github.com\\therecipe\\examples\\advanced\\qml_quick\\goroutine\\deploy\\windows\\goroutine.exe -tags=\"minimal\"" dir="C:\\Users\\goobe\\go\\src\\github.com\\therecipe\\examples\\advanced\\qml_quick\\goroutine" env="GOOS=windows GOARCH=amd64 GOPATH=C:\\Users\\goobe\\go GOROOT=C:\\Go\\ TMP=C:\\msys64\\tmp CGO_ENABLED=1 PATH=C:\\msys64\\mingw64\\bin;C:\\msys64\\usr\\bin;C:\\msys64\\usr\\bin;C:\\msys64\\mingw64\\bin;C:\\Go\\bin TEMP=C:\\msys64\\tmp CGO_CFLAGS_ALLOW=.* CGO_CXXFLAGS_ALLOW=.* CGO_LDFLAGS_ALLOW=.*" error="exit status 2" func=RunCmd name="build for windows on windows"
github.com/therecipe/qt/core
github.com/therecipe/qt/qml
github.com/therecipe/qt/gui
github.com/therecipe/qt/widgets
github.com/therecipe/qt/quick
github.com/therecipe/examples/advanced/qml_quick/goroutine
# github.com/therecipe/examples/advanced/qml_quick/goroutine
C:\Go\pkg\tool\windows_amd64\link.exe: running g++ failed: fork/exec C:\msys64\mingw64\bin\g++.exe: The filename or extension is too long.

My setup:

$ ~/go/bin/qtsetup check
time="2018-07-01T14:11:16-04:00" level=info msg="running: 'qtsetup check windows' [docker=false] [vagrant=false]"
time="2018-07-01T14:11:17-04:00" level=info msg="GOOS:                        'windows'"
time="2018-07-01T14:11:17-04:00" level=info msg="GOARCH:                      'amd64'"
time="2018-07-01T14:11:17-04:00" level=info msg="GOVERSION:                   'go1.10.3'"
time="2018-07-01T14:11:17-04:00" level=info msg="GOROOT:                   *  'C:\\Go\\'"
time="2018-07-01T14:11:17-04:00" level=info msg="GOPATH:                   *  'C:\\Users\\goobe\\go'"
time="2018-07-01T14:11:17-04:00" level=info msg="GOBIN:                       'C:\\Users\\goobe\\go\\bin'"
time="2018-07-01T14:11:17-04:00" level=info msg="QT_HASH:                     'please install git'"
time="2018-07-01T14:11:17-04:00" level=info msg="QT_VERSION:                  '5.11.1'"
time="2018-07-01T14:11:17-04:00" level=info msg="QT_VERSION_MAJOR:            '5.11.1'"
time="2018-07-01T14:11:17-04:00" level=info msg="QT_DIR:                      'C:\\Qt\\Qt5.11.1'"
time="2018-07-01T14:11:17-04:00" level=info msg="QT_STUB:                     'false'"
time="2018-07-01T14:11:17-04:00" level=info msg="QT_DEBUG:                    'false'"
time="2018-07-01T14:11:17-04:00" level=info msg="QT_QMAKE_DIR:                ''"
time="2018-07-01T14:11:17-04:00" level=info msg="QT_WEBKIT:                   'false'"
time="2018-07-01T14:11:17-04:00" level=info msg="QT_MSYS2:                 *  'true'"
time="2018-07-01T14:11:17-04:00" level=info msg="QT_MSYS2_DIR:                'C:\\msys64\\mingw64'"
time="2018-07-01T14:11:17-04:00" level=info msg="QT_MSYS2_ARCH:               'amd64'"
time="2018-07-01T14:11:17-04:00" level=info msg="QT_MSYS2_STATIC:          *  'true'

qt repo is at commit 5355937

I'm not sure how to work around this. Do I need to place the code in a path that's not as long?

@hitchfred

This comment has been minimized.

Copy link
Author

@hitchfred hitchfred commented Jul 1, 2018

After disabling static linking by setting QT_MSYS2_STATIC=false, the goroutine example builds fine. Guess that's the workaround for now.

@TheLatish

This comment has been minimized.

Copy link

@TheLatish TheLatish commented Aug 3, 2018

Same issue on my laptop. Version without qml file is working fine.

@therecipe

This comment has been minimized.

Copy link
Owner

@therecipe therecipe commented Nov 12, 2018

I raised and issue for this here: golang/go#28372

As a workaround for now you could use this patch file: https://github.com/therecipe/qt/blob/master/internal/docker/wine/rspfile.patch
which makes the go tooling use response files for gcc, g++
(it works for my needs, but it's just a dirty patch and isn't meant to be upstreamed in its current form)

However, there is another issue in gcc itself which might cause you problems in certain edge cases as well: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45749

So better use one of the shared Qt version's during development and use the static MXE versions of Qt for actual static deployments.

If someone however really needs to get this working with a static MSYS2 version, then please respond here or open another issue. There is probably some really ugly way to get certain edge cases to work if they trigger the gcc bug, but I would rather not want to work around this.

@0xAnarz

This comment has been minimized.

Copy link

@0xAnarz 0xAnarz commented Apr 8, 2019

I raised and issue for this here: golang/go#28372

As a workaround for now you could use this patch file: https://github.com/therecipe/qt/blob/master/internal/docker/wine/rspfile.patch
which makes the go tooling use response files for gcc, g++
(it works for my needs, but it's just a dirty patch and isn't meant to be upstreamed in its current form)

However, there is another issue in gcc itself which might cause you problems in certain edge cases as well: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45749

So better use one of the shared Qt version's during development and use the static MXE versions of Qt for actual static deployments.

If someone however really needs to get this working with a static MSYS2 version, then please respond here or open another issue. There is probably some really ugly way to get certain edge cases to work if they trigger the gcc bug, but I would rather not want to work around this.

Just opened similar issue (i guess) :
#826

@tapir

This comment has been minimized.

Copy link

@tapir tapir commented Apr 30, 2019

Initially I wasn't using a static build and everything built fine with my project but then I wanted to try QT_MSYS2_STATIC=true and got this problem so I reverted everything back and deleted the mingw-w64-x86_64-qt5-static package. However the problem persists. Do I have to re-do the qtsetup? Anyway to take everything back?

@therecipe

This comment has been minimized.

Copy link
Owner

@therecipe therecipe commented Apr 30, 2019

@tapir yeah, you will need to partially re-run the setup will qtsetup generate && qtsetup install

@liugangnhm

This comment has been minimized.

Copy link

@liugangnhm liugangnhm commented Aug 3, 2019

same issue on mingw64 env on windows 10:

github.com/therecipe/qt/internal/examples/showcases/wallet/files/dialog/controller
github.com/therecipe/qt/internal/examples/showcases/wallet/wallet/dialog/controller
github.com/therecipe/qt/internal/examples/showcases/wallet/view
github.com/therecipe/qt/internal/examples/showcases/wallet/view/left/controller
github.com/therecipe/qt/internal/examples/showcases/wallet/wallet/controller
github.com/therecipe/qt/internal/examples/showcases/wallet/wallet/dialog
github.com/therecipe/qt/internal/examples/showcases/wallet/files/controller
github.com/therecipe/qt/internal/examples/showcases/wallet/view/left
github.com/therecipe/qt/internal/examples/showcases/wallet/wallet
github.com/therecipe/qt/internal/examples/showcases/wallet/files
github.com/therecipe/qt/internal/examples/showcases/wallet/view/top/controller
github.com/therecipe/qt/internal/examples/showcases/wallet/view/top
github.com/therecipe/qt/internal/examples/showcases/wallet
# github.com/therecipe/qt/internal/examples/showcases/wallet
E:\Go\pkg\tool\windows_amd64\link.exe: running g++ failed: fork/exec H:\GOPATH\src\github.com\therecipe\env_windows_amd64_513\Tools\mingw730_64\bin\g++.exe: The filename or extension is too long.

and QT_MSYS2_STATIC=false also not work for me

the qtsetup check result:

time="2019-08-03T09:12:36+08:00" level=warning msg="failed to create qtenv.bat symlink in your PATH (E:\\Go\\bin\\qtenv.bat); please use H:\\GOPATH\\src\\github.com\\therecipe\\env_windows_amd64_513\\5.13.0\\mingw73_64\\bin\\qtenv2.bat instead"
time="2019-08-03T09:12:36+08:00" level=info msg="running: 'qtsetup check windows' [docker=false] [vagrant=false]"
time="2019-08-03T09:12:37+08:00" level=info msg="GOOS:                        'windows'"
time="2019-08-03T09:12:37+08:00" level=info msg="GOARCH:                      'amd64'"
time="2019-08-03T09:12:37+08:00" level=info msg="GOVERSION:                   'go1.12.7'"
time="2019-08-03T09:12:37+08:00" level=info msg="GOROOT:                      'E:\\Go'"
time="2019-08-03T09:12:37+08:00" level=info msg="GOPATH:                   *  'H:\\GOPATH'"
time="2019-08-03T09:12:37+08:00" level=info msg="GOBIN:                       'H:\\GOPATH\\bin'"
time="2019-08-03T09:12:37+08:00" level=info msg="GOMOD:                       ''"
time="2019-08-03T09:12:37+08:00" level=info msg="QT_HASH:                     'a9acd1ab63c1365681bac0d31ce994989a9dd433'"
time="2019-08-03T09:12:37+08:00" level=info msg="QT_API:                      ''"
time="2019-08-03T09:12:37+08:00" level=info msg="QT_VERSION:                  '5.13.0'"
time="2019-08-03T09:12:37+08:00" level=info msg="QT_DIR:                   *  'H:\\GOPATH\\src\\github.com\\therecipe\\env_windows_amd64_513'"
time="2019-08-03T09:12:37+08:00" level=info msg="QT_STUB:                     'false'"
time="2019-08-03T09:12:37+08:00" level=info msg="QT_DEBUG:                    'false'"
time="2019-08-03T09:12:37+08:00" level=info msg="QT_QMAKE_DIR:                ''"
time="2019-08-03T09:12:37+08:00" level=info msg="QT_WEBKIT:                   'false'"
time="2019-08-03T09:12:37+08:00" level=info msg="QT_DEBUG_CONSOLE:            'false'"
time="2019-08-03T09:12:37+08:00" level=info msg="QT_MSYS2:                    'false'"
@liugangnhm

This comment has been minimized.

Copy link

@liugangnhm liugangnhm commented Aug 3, 2019

set QT_DIR=H:\Qt\Qt5.13.0 work for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.