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

Closed
gopherbot opened this issue Mar 15, 2014 · 7 comments
Closed

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

gopherbot opened this issue Mar 15, 2014 · 7 comments

Comments

@gopherbot
Copy link

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.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=f:/tools/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.8.2/lto-wrapper.exe
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
rerequisites/x86_64-w64-mingw32-static
--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
--with-cloog=/tmp/prerequisites/
x86_64-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='rev0, Built by
MinGW-W64 project' --with-bugurl=
http://sourceforge.net/projects/mingw-w64 CFLAGS='-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/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/x86_64-482-win32-seh-rt_v3-r0/mingw64/opt/lib
-L/tmp/prerequisites/x86_64-zlib-static/lib
-L/tmp/prerequisites/x86_64-w64-mingw32-static/lib '
Thread model: win32
gcc version 4.8.2 (rev0, Built by MinGW-W64 project)

Attachments:

  1. a.h (61 bytes)
  2. a.c (80 bytes)
  3. abc.go (75 bytes)
  4. abc_test.go (83 bytes)
@gopherbot
Copy link
Author

Comment 1 by runner.mei:

fileno(0): not defined

Attachments:

  1. a.c (145 bytes)

@ianlancetaylor
Copy link
Contributor

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.

@alexbrainman
Copy link
Member

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.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/go/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.7.0/lt
o-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../build/gcc/src/configure --target=x86_64-w64-mingw32
--prefix=/c/bb/vista64-mingw32/mingw-x86-x86_64/build/build/root
--with-sysroot=/c/bb/vista64-mingw32/mingw-x86-x86_64/build/build/root
--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
Alex

@ianlancetaylor
Copy link
Contributor

Comment 4:

Status changed to Accepted.

@slimsag
Copy link

slimsag commented Aug 30, 2014

Comment 5:

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

@gopherbot
Copy link
Author

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:
github.com/szferi/gomdb(.text): undefined: strdup
github.com/szferi/gomdb(text_env): undefined: strdup
This is with go version go1.3.1 windows/amd64

@alexbrainman
Copy link
Member

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

Alex

@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.
Projects
None yet
Development

No branches or pull requests

4 participants