qt.go
qt.go copied to clipboard
pkg-config: exit status 3221225781
1.I'm trying qt.go in alternative to the therecipe but have this type log:
C:\>go run %GOPATH%src\github.com\kitech\qt.go\examples\button.go
# pkg-config --cflags -- libffi
pkg-config: exit status 3221225781
Regarding to the https://github.com/kitech/qt.go/issues/5#issuecomment-371226756
TDMx64 in default install not have the pkg-config.exe
and added this manualy as pkg-config_0.28-1_win64.zip
Don't know how to force env on gopath\go\src\github.com\qtchina\qtenv_win64
I have in TDM lib:
├─── gcc │ libbfd.a │ libdl.a │ libdl.dll.a │ libffi.a │ libffi.dll.a │ libopcodes.a │ libpsapi.a │ ├───libffi-3.2.1 │ └───include │ ffi.h │ ffitarget.h │ └───pkgconfig dlfcn.pc
- Don't know what is difference when runing go build from
gopath\go\src\github.com\qtchina\qtenv_win64>go build -o button.exe \gopath\go\src\github.com\kitech\qt.go\examples\button.go
but the log is diffrent
# pkg-config --cflags -- libffi
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
pkg-config: exit status 1
a) What is libffi.pc
?
b) Is this related with dlfcn.pc
?
c) When I copied b) and renamed for a) then many errors like this:
AppData\Local\Temp\go-build910741502\b034\_x010.o:ffi_invoke.c:(.rdata$.refptr.ffi_type_float[.refptr.ffi_type_float]+0x0): undefined reference to `ffi_type_float' collect2.exe: error: ld returned 1 exit status
That lib/include are qt.go need indeed.
But you only need install TDM (with pkg-config.exe) only, not the libffi package. Because there is one in a repo: https://github.com/qtchina/qt512_qtenv_win64.
So, after you installed TDM, then clone this repo:
git clone https://github.com/qtchina/qt512_qtenv_win64 d:/qtenv
and note this repo not need put under %gopath% like last post gopath\go\src\github.com\qtchina\qtenv_win64
, just put a short directory is fine.
Another, did you set the CGO_CFLAGS
and CGO_LDFLAGS
environment variables, just like https://github.com/kitech/qt.go/blob/master/install.md#windows-static-qt
a) What is libffi.pc ? b) Is this related with dlfcn.pc?
These is used by pkg-config to find proper lib/include, it's a standard mostly in unix/linux world.
It's cannot help if only copy a .pc
file.
I think you lib/include directory structure is fine, try set proper environment variables should be helpful.
Try set an extra PKG_CONFIG_PATH
,
set PKG_CONFIG_PATH=tdmdir\lib\pkgconfig
3.Strange
C:\>ECHO %CGO_CFLAGS%
D:\qtenv_win64\lib\libffi-3.2.1\include
C:\>echo %CGO_LDFLAGS%
D:\qtenv_win64\lib\libffi-3.2.1
C:\>
C:\>go build -o button.exe %GOPATH%\src\github.com\kitech\qt.go\examples\button.go
# runtime/cgo
E:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find D:\qtenv_win64\lib\libffi-3.2.1: Permission denied
collect2.exe: error: ld returned 1 exit status
# runtime/cgo
gcc: warning: D:\qtenv_win64\lib\libffi-3.2.1\include: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv_win64\lib\libffi-3.2.1\include: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv_win64\lib\libffi-3.2.1\include: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv_win64\lib\libffi-3.2.1\include: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv_win64\lib\libffi-3.2.1\include: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv_win64\lib\libffi-3.2.1\include: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv_win64\lib\libffi-3.2.1\include: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv_win64\lib\libffi-3.2.1\include: linker input file unused because linking not done
C:\>
And after rebot and change qtenv_win64
to qtenv
that solved Permission denied
in sys var
C:\>go build -o button.exe %GOPATH%\src\github.com\kitech\qt.go\examples\button.go
# runtime/cgo
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include: linker input file unused because linking not done
# github.com/kitech/dl
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include: linker input file unused because linking not done
# github.com/kitech/dl
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include: linker input file unused because linking not done
# github.com/kitech/dl
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include: linker input file unused because linking not done
# github.com/kitech/dl
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include: linker input file unused because linking not done
# pkg-config --cflags -- libffi
pkg-config: exit status 3221225781
- I repeated clone repo and.. log is diffrent. I totaly not controling the env
E:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ldl collect2.exe: error: ld returned 1 exit status
# runtime/cgo
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include\: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include\: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include\: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include\: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include\: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include\: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include\: linker input file unused because linking not done
# runtime/cgo
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include\: linker input file unused because linking not done
# github.com/kitech/dl
E:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ldl
E:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ldl
collect2.exe: error: ld returned
collect2.exe: error: ld returned 1 exit status
# github.com/kitech/dl
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include\: linker input file unused because linking not done
# github.com/kitech/dl
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include\: linker input file unused because linking not done
# github.com/kitech/dl
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include\: linker input file unused because linking not done
# github.com/kitech/dl
gcc: warning: D:\qtenv\lib\libffi-3.2.1\include\: linker input file unused because linking not done
Most often GO need TDM, why in https://github.com/kitech/qt.go/blob/master/install.md#windows-static-qt is install from mingw-64 i686-win32-sjlj-7.2.0
?
D:\qtenv>gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=E:/TDM-GCC-64/bin/../libexec/gcc/x86_64-w64-mingw32/5.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-5.1.0/configure --build=x86_64-w64-mingw32 --enable-targets=all --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-libgomp --enable-lto --enable-graphite --enable-cxx-flags=-DWINPTHREAD_STATIC --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-libstdcxx-debug --enable-threads=posix --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libstdcxx-threads --enable-libstdcxx-time --with-gnu-ld --disable-werror --disable-nls --disable-win32-registry --prefix=/mingw64tdm --with-local-prefix=/mingw64tdm --with-pkgversion=tdm64-1 --with-bugurl=http://tdm-gcc.tdragon.net/bugs
Thread model: posix
gcc version 5.1.0 (tdm64-1)
I'm not sure about the sys vars (should be as here https://github.com/kitech/qt.go/issues/43#issuecomment-522253177) and sets CGO_CFLAGS & CGO_LDFLAGS (or do this by set in cmd?).
C:\>set CGO_CFLAGS=-ID:/qtenv/include -ID:/qtenv/lib/libffi-3.2.1/include/
C:\>set CGO_LDFLAGS=-LD:/qtenv/lib
C:\>go build -o button.exe %GOPATH%\src\github.com\kitech\qt.go\examples\button.go
# pkg-config --cflags -- libffi
pkg-config: exit status 3221225781
Hvr.. I'm still in this same point. There is space in args -- libffi
This same situation with https://github.com/qtchina/qt512_qtenv_win32
try go build -v -x
for verbose log
No special changes by this comand
C:\>go build -v -x E:\gopath\go\src\github.com\kitech\qt.go\examples\button.go
WORK=C:\Users\xxx\AppData\Local\Temp\go-build612429062
github.com/kitech/qt.go/qtrt
mkdir -p $WORK\b034\
cd E:\Go\src\github.com\kitech\qt.go\qtrt
pkg-config --cflags -- libffi
# pkg-config --cflags -- libffi
pkg-config: exit status 3221225781
I put to D:\qtenv_win64\lib\pkgconfig
https://raw.githubusercontent.com/libffi/libffi/master/libffi.pc.in as libffi.pc
but no changes
@kitech I think that in qtrt
are problems with the .h files eg. #include "ffi.h"
and other related to .c files
Can you compare own repo with the git or are you use just git?
@kitech I think that I found the problem https://github.com/kitech/qt.go/blob/master/qtrt/c.go Your file
package qtrt
/*
#cgo pkg-config: libffi
*/
import "C"
My sugestion:
package qtrt
// #cgo pkg-config: libffi
// #cgo CFLAGS: -ID:\qtenv_win64\include\ -ID:\qtenv_win64\lib\libffi-3.2.1\include\ -DPNG_DEBUG=1
// #cgo LDFLAGS: -LD:\qtenv_win64\lib\
import "C"
Looks that global comment /* not working in GO compilator and must be single line like // And static include can prevent to case of "premission denied" in sys vars that in some case are not visible like here https://github.com/kitech/qt.go/issues/43#issuecomment-522253177
Now I have error like:
Go\src\github.com\kitech\qt.go\qtrt\ffi_invoke.go:10:17: fatal error: ffi.h: No such file or directory
compilation terminated.
If adding: https://github.com/libffi/libffi/blob/master/include/ffi.h.in
Go\src\github.com\kitech\qt.go\qtrt\ffi_invoke.go:10:0:
./ffi.h:52:9: error: macro names must be identifiers
#ifndef @TARGET@
^
./ffi.h:58:23: fatal error: ffitarget.h: No such file or directory
compilation terminated.
If adding: https://raw.githubusercontent.com/libffi/libffi/master/src/x86/ffitarget.h
# github.com/kitech/qt.go/qtrt
In file included from C:\Go\src\github.com\kitech\qt.go\qtrt\ffi_invoke.go:10:0:
./ffi.h:52:9: error: macro names must be identifiers
#ifndef @TARGET@
^
In file included from C:\Go\src\github.com\kitech\qt.go\qtrt\ffi_invoke.go:10:0:
./ffi.h:200:5: error: token "@" is not valid in preprocessor expressions
#if @HAVE_LONG_DOUBLE@
^
./ffi.h:209:5: error: token "@" is not valid in preprocessor expressions
#if @HAVE_LONG_DOUBLE@
^
./ffi.h:309:5: error: token "@" is not valid in preprocessor expressions
#if @FFI_EXEC_TRAMPOLINE_TABLE@
^
./ffi.h:356:5: error: token "@" is not valid in preprocessor expressions
#if @FFI_EXEC_TRAMPOLINE_TABLE@
^
./ffi.h:381:5: error: token "@" is not valid in preprocessor expressions
#if @FFI_EXEC_TRAMPOLINE_TABLE@
^
./ffi.h:491:5: error: token "@" is not valid in preprocessor expressions
#if @HAVE_LONG_DOUBLE@
And there is comment part of code again with #include "ffi.h" but I can't recognize this all logic of stuff. https://travis-ci.org/kitech/qt.go/jobs/573476139
// #cgo LDFLAGS: -LD:\qtenv_win64\lib\
Hard code path is not portable between OSes.
import "C"
must just below comment, no empty line.
Regarding the question https://github.com/kitech/qt.go/pull/45#issuecomment-523003224 yeah.. You are right, the path on windows na lnx are diffrent. But this can be wroted on help/instalation md as information
Soo.. I still don't know what is problem. I was sure that problem was here https://github.com/kitech/qt.go/issues/43#issuecomment-522338339 I changed code (no empty line)
package qtrt
// #cgo pkg-config: libffi
// #cgo CFLAGS: -ID:\qtenv_win64\include\ -ID:\qtenv_win64\lib\libffi-3.2.1\include\ -DPNG_DEBUG=1
// #cgo LDFLAGS: -LD:\qtenv_win64\lib\
import "C"
After changes another log, but no sucess.
C:\>go build -v -x E:\gopath\go\\src\github.com\kitech\qt.go\examples\button.go
WORK=C:\Users\xxx\AppData\Local\Temp\go-build058043586
E:\Go\src\github.com\kitech\qt.go\qtcore\abstractcomparatorfunction.go:28:8: E:\Go\src\github.com\kitech\qt.go\qtrt\c.go: invalid #cgo line: #cgo LDFLAGS: -LD:\qtenv_win64\lib\
I remember this should work. Maybe need use '/' for path seperate.
Yes, find a working way and document it is fine.
I remember this should work. Maybe need use '/' for path seperate.
You mind // #cgo LDFLAGS: -LD:/qtenv_win64/lib/
? Thats not helping I'm on WinOS, and double \ not helping.
@kitech What about the .h files and ffi_invoke.go
as in post https://github.com/kitech/qt.go/issues/43#issuecomment-522338868 ?
the .h must use the one here: git clone https://github.com/qtchina/qt512_qtenv_win32.git D:/qtenv
, like documented https://github.com/kitech/qt.go/blob/master/install.md#libffi--dlfcn--qt5inlinedll
@kitech but is the errors related are unexpected or related with GO or OS like win?
Esspecialy the #ifndef @TARGET@
errors.
Do you plan repair something here? Or not coz eg. not time? Don't know that I should fighting more here with GO in all or leave GO in case that so many problems with evn, libs, etc.. and no support. Soo, the feedback about situation will be usefull.
Esspecialy the #ifndef @TARGET@ errors.
This is unpreprocessed header syntax, little complicate. Use qtenv_winxx repo, step by step as INSTALL.md mentioned please. Don't install ffi.h/dlfcnt.h yourself, the bootstrap repo contains these header files.
x86_64-w64-mingw32/bin/ld.exe: cannot find -ldl
collect2.exe: error: ld returned 1 exit status
There is many calls for dl eg. dl.go // #cgo LDFLAGS: -ldl` dl_windows.go // #cgo LDFLAGS: -ldl -lpsapi
Which place can have problem here and why? Probably first coz no -lpsapi, but not sure (delete this not helping to discover).
I think it's some path problem. These code is fine.
x86_64-w64-mingw32/bin/ld.exe: cannot find -ldl collect2.exe: error: ld returned 1 exit status
There is many calls for dl eg. dl.go // #cgo LDFLAGS: -ldl` dl_windows.go // #cgo LDFLAGS: -ldl -lpsapi
Which place can have problem here and why? Probably first coz no -lpsapi, but not sure (delete this not helping to discover).