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

Project causes compilation issues when included in other projects on Windows: __imp___iob_func #1120

Closed
steowens opened this issue Dec 26, 2022 · 2 comments

Comments

@steowens
Copy link

See comments here:
golang/go#57455 (comment)

Short issue is that adding this dependency to a project that is compiled with more recent versions of Windows breaks the project possibly due to some binary dependencies or c code included in the go-sqlite3 project. The problem manifests when you take a project that compiles just fine and add this project to it as a dependency then you go to build and you get :

C:\Program Files\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1 c:/program files/winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-14.0.6-mingw-w64ucrt-10.0.0-r2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\steve\AppData\Local\Temp\go-link-2769819953\000016.o: in function _cgo_preinit_init': \\_\_\runtime\cgo/gcc_libinit_windows.c:40: undefined reference to __imp___iob_func' c:/program files/winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-14.0.6-mingw-w64ucrt-10.0.0-r2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\steve\AppData\Local\Temp\go-link-2769819953\000016.o: in function x_cgo_notify_runtime_init_done': \\_\_\runtime\cgo/gcc_libinit_windows.c:105: undefined reference to __imp___iob_func' c:/program files/winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-14.0.6-mingw-w64ucrt-10.0.0-r2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\steve\AppData\Local\Temp\go-link-2769819953\000016.o: in function _cgo_beginthread': \\_\_\runtime\cgo/gcc_libinit_windows.c:149: undefined reference to __imp___iob_func' c:/program files/winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-14.0.6-mingw-w64ucrt-10.0.0-r2/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\steve\AppData\Local\Temp\go-link-2769819953\000017.o: in function `x_cgo_thread_start': \__\runtime\cgo/gcc_util.c:18: undefined reference to ' collect2.exe: error: ld returned 1 exit status exit status 2

@rittneje
Copy link
Collaborator

@steowens As mentioned in golang/go#57455 this issue is caused by cgo itself. If you are unable to avoid transitively importing this library (or any other that relies on cgo), I would suggest forcibly setting CGO_ENABLED=0 when you compile until the compiler is fixed.

@rittneje rittneje closed this as not planned Won't fix, can't repro, duplicate, stale Dec 26, 2022
@steowens
Copy link
Author

Thanks I was able to resolve the issue to switching to github.com/glebarez/go-sqlite go native sqlite and thereby eliminating the cgo dependency.

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