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

Build app still require gcc #442

Closed
kpvt001 opened this issue Jul 24, 2017 · 20 comments
Closed

Build app still require gcc #442

kpvt001 opened this issue Jul 24, 2017 · 20 comments

Comments

@kpvt001
Copy link

kpvt001 commented Jul 24, 2017

I found that

However, if you install go-sqlite3 with go install github.com/mattn/go-sqlite3, you don't need gcc to build your app anymore.

in Readme.md

But, after installed go-sqlite3 and go-sqlite3.a existed, it still require gcc when I building the app.

os: windows 10 x64 pro

@mattn
Copy link
Owner

mattn commented Jul 24, 2017

Could you please show me go build -x?

@kpvt001
Copy link
Author

kpvt001 commented Jul 24, 2017

F:\gopath\src\github.com\mattn\go-sqlite3>go build -x
WORK=C:\Users\User\AppData\Local\Temp\go-build633774530

@kpvt001
Copy link
Author

kpvt001 commented Jul 24, 2017

go build and go install show nothing, I think they run successfully.

@mattn
Copy link
Owner

mattn commented Jul 24, 2017

I don't still what you mean. What do you mean it still require gcc when I building the app?

@kpvt001
Copy link
Author

kpvt001 commented Jul 24, 2017

When I build the app, it shows

F:\gopath\src\project>go build
# project
C:\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exec: "gcc": executable file not found in %PATH%

But i successfully installed go-sqlite3 by go install, and go-sqlite3.a also created in pkg.

After installed, I uninstalled TDM-GCC.

@mattn
Copy link
Owner

mattn commented Jul 24, 2017

Then, please show me go build -x and go env

@kpvt001
Copy link
Author

kpvt001 commented Jul 24, 2017

F:\gopath\src\project>go build -x
WORK=C:\Users\User\AppData\Local\Temp\go-build150739418
mkdir -p $WORK\project\api\controller\_obj\
mkdir -p $WORK\project\api\
mkdir -p $WORK\project\db\_obj\
cd F:\gopath\src\project\api\controller
"C:\\Go\\pkg\\tool\\windows_amd64\\compile.exe" -o "C:\\Users\\User\\AppData\\Local\\Temp\\go-build150739418\\project\\api\\controller.a" -trimpath "C:\\Users\\User\\AppData\\Local\\Temp\\go-build150739418" -p project/api/controller -complete -buildid 54104734998a74eb54f9eba8a42a87b590837110 -D _/F_/gopath/src/project/api/controller -I "C:\\Users\\User\\AppData\\Local\\Temp\\go-build150739418" -I "F:\\gopath\\pkg\\windows_amd64" -pack "F:\\gopath\\src\\project\\api\\controller\\getInfos.go" "F:\\gopath\\src\\project\\api\\controller\\Index.go" "F:\\gopath\\src\\project\\api\\controller\\getR.go" "F:\\gopath\\src\\project\\api\\controller\\getText.go" "F:\\gopath\\src\\project\\api\\controller\\getVer.go" "F:\\gopath\\src\\project\\api\\controller\\vesselsinfo.go"
mkdir -p $WORK\project\
cd F:\gopath\src\project\db
"C:\\Go\\pkg\\tool\\windows_amd64\\compile.exe" -o "C:\\Users\\User\\AppData\\Local\\Temp\\go-build150739418\\project\\db.a" -trimpath "C:\\Users\\User\\AppData\\Local\\Temp\\go-build150739418" -p project/db -complete -buildid 3662c8d87ff0917861861152aa263510e404b82d -D _/F_/gopath/src/project/db -I "C:\\Users\\User\\AppData\\Local\\Temp\\go-build150739418" -I "F:\\gopath\\pkg\\windows_amd64" -pack "F:\\gopath\\src\\project\\db\\infos.go" "F:\\gopath\\src\\project\\db\\test.go"
mkdir -p $WORK\project\_obj\
mkdir -p $WORK\project\_obj\exe\
cd F:\gopath\src\project
"C:\\Go\\pkg\\tool\\windows_amd64\\compile.exe" -o "C:\\Users\\User\\AppData\\Local\\Temp\\go-build150739418\\project.a" -trimpath "C:\\Users\\User\\AppData\\Local\\Temp\\go-build150739418" -p main -complete -buildid 69e48c665c1a39750e1b2358ee2f5903f13b3175 -D _/F_/gopath/src/project -I "C:\\Users\\User\\AppData\\Local\\Temp\\go-build150739418" -I "F:\\gopath\\pkg\\windows_amd64" -pack "F:\\gopath\\src\\project\\main.go"
cd .
"C:\\Go\\pkg\\tool\\windows_amd64\\link.exe" -o "C:\\Users\\User\\AppData\\Local\\Temp\\go-build150739418\\project\\_obj\\exe\\a.out.exe" -L "C:\\Users\\User\\AppData\\Local\\Temp\\go-build150739418" -L "F:\\gopath\\pkg\\windows_amd64" -extld=gcc -buildmode=exe -buildid=69e48c665c1a39750e1b2358ee2f5903f13b3175 "C:\\Users\\User\\AppData\\Local\\Temp\\go-build150739418\\project.a"
# project
C:\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exec: "gcc": executable file not found in %PATH%

@mattn
Copy link
Owner

mattn commented Jul 24, 2017

please try to install go-sqlite3 with go install -buildmode=c-archive

@kpvt001
Copy link
Author

kpvt001 commented Jul 24, 2017

failed

F:\gopath\src\github.com\mattn\go-sqlite3>go install -buildmode=c-archive
-buildmode=c-archive requires exactly one main package

@kpvt001
Copy link
Author

kpvt001 commented Jul 24, 2017

In my another vm installing TDM-GCC, can build app successfully, in this one cannot,

Btw, in this vm, I just copied TDM-GCC files instead of installing, run mingwvars.bat to set vars before building go-sqlite3. The go-sqlite3.a built in 2 vms are the same.

@mattn
Copy link
Owner

mattn commented Jul 24, 2017

What do you get with go build -ldflags="-linkmode=internal -extld=none" -x ?

@kpvt001
Copy link
Author

kpvt001 commented Jul 24, 2017

app or go-sqlite3?

@mattn
Copy link
Owner

mattn commented Jul 24, 2017

please try on app

@kpvt001
Copy link
Author

kpvt001 commented Jul 24, 2017

Built successfully, get the exe.

Whether the situation is common or not?

@mattn
Copy link
Owner

mattn commented Jul 24, 2017

There are some conditions why the build fail with this error.

@kpvt001
Copy link
Author

kpvt001 commented Jul 24, 2017

What can I offer?

@mattn
Copy link
Owner

mattn commented Jul 24, 2017

Sorry, I don't still clearly understand how to fix this issue with common way.

@kpvt001
Copy link
Author

kpvt001 commented Jul 24, 2017

I mean what can i do for you about the issue

@mattn
Copy link
Owner

mattn commented Jul 24, 2017

This is enoguh since I got one of the resolved results. So if you solved issue, please close this.

@kpvt001
Copy link
Author

kpvt001 commented Jul 24, 2017

I think 'go build -ldflags="-linkmode=internal -extld=none" -x' could be added into the readme :)

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