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

cmd/cgo: strdup(0): not defined #7555

gopherbot opened this issue Mar 15, 2014 · 7 comments


Copy link

commented Mar 15, 2014

by runner.mei:

1. What is a short input program that triggers the error?
see attach.

2. What is the full compiler output?
F:\developing\src\abc>go test -v
# testmain
strdup(0): not defined
FAIL    abc [build failed]

3. What version of the compiler are you using?  (Run it with the -V flag.)
F:\developing\src\abc>go version
go version go1.2 windows/amd64

F:\developing\abc>gcc -v
Using built-in specs.
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-4.8.2/configure --host=x86_64-w64-mingw32
--build=x86_64-w64-mingw32 --target=x86_64-w
64-mingw32 --prefix=/mingw64 --with-sysroot=/tmp/x86_64-482-win32-seh-rt_v3-r0/mingw64
--enable-shared --enable-static -
-disable-multilib --enable-languages=ada,c,c++,fortran,objc,obj-c++,lto
--enable-libstdcxx-time=yes --enable-threads=win
32 --enable-libgomp --enable-lto --enable-graphite --enable-checking=release
--enable-fully-dynamic-string --enable-vers
ion-specific-runtime-libs --disable-isl-version-check --disable-cloog-version-check
--disable-libstdcxx-pch --disable-li
bstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls
--disable-werror --disable-symve
rs --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv
--with-system-zlib --with-gmp=/tmp/p
--with-mpfr=/tmp/prerequisites/x86_64-w64-mingw32-static --with-mpc=/tmp/prerequi
sites/x86_64-w64-mingw32-static --with-isl=/tmp/prerequisites/x86_64-w64-mingw32-static
x86_64-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='rev0, Built by
MinGW-W64 project' --with-bugurl= CFLAGS='-O2 -pipe
-I/tmp/x86_64-482-win32-seh-rt_v3-r0/mingw64/opt/include -I/
-I/tmp/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe
 -I/tmp/x86_64-482-win32-seh-rt_v3-r0/mingw64/opt/include -I/tmp/prerequisites/x86_64-zlib-static/include -I/tmp/prerequ
isites/x86_64-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe
-L/tmp/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: win32
gcc version 4.8.2 (rev0, Built by MinGW-W64 project)


  1. a.h (61 bytes)
  2. a.c (80 bytes)
  3. abc.go (75 bytes)
  4. abc_test.go (83 bytes)

This comment has been minimized.

Copy link

commented Mar 15, 2014

Comment 1 by runner.mei:

fileno(0): not defined


  1. a.c (145 bytes)

This comment has been minimized.

Copy link

commented May 9, 2014

Comment 2:

I can't recreate this on GNU/Linux.  Would be nice if somebody else could confirm that
they see this too.

Labels changed: added repo-main, release-none, os-windows.


This comment has been minimized.

Copy link

commented May 11, 2014

Comment 3:

I can see this
C:\go\path\mine\src\issue7555>go test -v
# testmain
issue7555(.text): undefined: strdup
issue7555(.text): undefined: fileno
FAIL    issue7555 [build failed]
C:\go\path\mine\src\issue7555>gcc -v
Using built-in specs.
Target: x86_64-w64-mingw32
Configured with: ../../../build/gcc/src/configure --target=x86_64-w64-mingw32
--enable-languages=all,obj-c++ --enable-fully-dynamic-string --disable-multilib
Thread model: win32
gcc version 4.7.0 20111212 (experimental) (GCC)
C:\go\path\mine\src\issue7555>hg -R %GOROOT% id
299229ac4300+ tip

This comment has been minimized.

Copy link

commented May 12, 2014

Comment 4:

Status changed to Accepted.


This comment has been minimized.

Copy link

commented Aug 30, 2014

Comment 5:

Others running into the same issue at:
- go-gl/glfw#82 (comment)
wanted to give a heads up.

This comment has been minimized.

Copy link

commented Sep 28, 2014

Comment 6 by CundraMihail:

I'm seeing the same basic error when trying to use the gomdb package (or run its test)
under Windows with mingw64.
It builds fine by itself.
The error is: undefined: strdup undefined: strdup
This is with go version go1.3.1 windows/amd64

This comment has been minimized.

Copy link

commented Apr 2, 2015

I believe this is fixed now by latest @minux cmd/ld pe changes (#4069).


@golang golang locked and limited conversation to collaborators Jun 25, 2016

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