x86_64-w64-ming32-g++ file not recognized by objdump

Thomas D. Dean tomdean@speakeasy.org
Sun Aug 21 04:19:00 GMT 2011


On Sun, 2011-08-21 at 12:09 +1000, Sisyphus wrote:

Sorry for the Top post, with a related question.

Maybe the correct question I should ask, is how to create a 64-bit
executable with cygwin gcc 4.5.3?

I think I am missing some environment variable that points to the
correct dll to load?????

> ----- Original Message ----- 
> From: "Thomas D. Dean"
> 
> > #include <vector>
> > #include <string>
> > using namespace std;
> > int main() {
> >  vector<string> vs;
> >  vs.push_back("asdf");
> > }
> >
> >
> > If I compile with x86_64-w64-ming32-g++ -m64 t.cc -o t
> 
> I presume the 'ming32' is a typo.
> Is the '-m64' necessary ?

I have cgywin installed.  Along with it, came the 64-bit compiler

The executable I attempted to use was /usr/bin/x86_64-w64-ming32-g++

the version is (GCC) 4.5.3

I discovered the 64 bit version of objdump - that produces something
like what I expected for output.

The problem I have seems to be in locating libstdc++, I think.

If I compile a hello, world application,

#include <stdio.h>
int main() {
printf("Hello, world.\n");
return 0;
}

with x86_64-w64-ming32-g++ hello.c -o hello, it produces a 64-bit
executable that runs Ok.  cygcheck produces only the filename output for
a 64-bit executable.

> file ./hello.exe
./hello.exe: PE32+ executable (console) x86-64, for MS Windows

If I compile the t.cc application needing libstdc++, the executable
fails and the .exe produced is broken.  Like, libstdc++ is not linked
in.
> x86_64-w64-ming32-g++ t.cc -o t
> file ./t.exe
t.exe: PE32+ executable (console) x86-64, for MS Windows
> ./t.exe
t.exe: error while loading shared libraries: ?: cannot open shared
object file: No such file or directory

Building with verbose:

> x86_64-w64-ming32-g++ -v t.cc -o t
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured
with: /home/user/June142011/gcc64/mingw64-x86_64-gcc-4.5.3-1/src/gcc-4.5.3/configure --srcdir=/home/user/June142011/gcc64/mingw64-x86_64-gcc-4.5.3-1/src/gcc-4.5.3 --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --datarootdir=/usr/share --docdir=/usr/share/doc/mingw64-x86_64-gcc -C --build=i686-pc-cygwin --host=i686-pc-cygwin --target=x86_64-w64-mingw32 --with-sysroot=/usr/x86_64-w64-mingw32/sys-root --with-build-sysroot=/usr/x86_64-w64-mingw32/sys-root --disable-multilib --disable-win32-registry --enable-languages=c,ada,c++,fortran,objc,obj-c++ --enable-fully-dynamic-strings --enable-libgomp --enable-sjlj-exceptions --enable-version-specific-runtime-libs --with-dwarf2 --enable-decimal-float=bid --enable-lto
Thread model: win32
gcc version 4.5.3 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-o' 't.exe' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
 /usr/lib/gcc/x86_64-w64-mingw32/4.5.3/cc1plus.exe -quiet -v t.cc -quiet
-dumpbase t.cc -mtune=generic -march=x86-64 -auxbase t -version
-o /tmp/cc36xmDw.s
GNU C++ (GCC) version 4.5.3 (x86_64-w64-mingw32)
	compiled by GNU C version 4.5.0, GMP version 4.3.1, MPFR version
2.4.1-p5, MPC version 0.8
warning: GMP header version 4.3.1 differs from library version 4.3.2.
GGC heuristics: --param ggc-min-expand=100 --param
ggc-min-heapsize=131072
ignoring nonexistent directory
"/usr/x86_64-w64-mingw32/sys-root/usr/local/include"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-w64-mingw32/4.5.3/include/c++
 /usr/lib/gcc/x86_64-w64-mingw32/4.5.3/include/c++/x86_64-w64-mingw32
 /usr/lib/gcc/x86_64-w64-mingw32/4.5.3/include/c++/backward
 /usr/lib/gcc/x86_64-w64-mingw32/4.5.3/include
 /usr/lib/gcc/x86_64-w64-mingw32/4.5.3/include-fixed
 /usr/x86_64-w64-mingw32/sys-root/mingw/include
End of search list.
GNU C++ (GCC) version 4.5.3 (x86_64-w64-mingw32)
	compiled by GNU C version 4.5.0, GMP version 4.3.1, MPFR version
2.4.1-p5, MPC version 0.8
warning: GMP header version 4.3.1 differs from library version 4.3.2.
GGC heuristics: --param ggc-min-expand=100 --param
ggc-min-heapsize=131072
Compiler executable checksum: b57d0d403a1834b1b129f166da9e071e
COLLECT_GCC_OPTIONS='-v' '-o' 't.exe' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
 /usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/bin/as.exe -v -o /tmp/ccUf85Zh.o /tmp/cc36xmDw.s
GNU assembler version 2.21.51 (x86_64-w64-mingw32) using BFD version
(GNU Binutils) 2.21.51.20110605
COMPILER_PATH=/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/:/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/:/usr/lib/gcc/x86_64-w64-mingw32/:/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/:/usr/lib/gcc/x86_64-w64-mingw32/:/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/bin/
LIBRARY_PATH=/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/:/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/lib/../lib64/:/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/lib/:/usr/x86_64-w64-mingw32/sys-root/mingw/lib/
COLLECT_GCC_OPTIONS='-v' '-o' 't.exe' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
 /usr/lib/gcc/x86_64-w64-mingw32/4.5.3/collect2.exe
--sysroot=/usr/x86_64-w64-mingw32/sys-root -m i386pep -Bdynamic -o
t.exe /usr/x86_64-w64-mingw32/sys-root/mingw/lib/crt2.o /usr/x86_64-w64-mingw32/sys-root/mingw/lib/crtbegin.o -L/usr/lib/gcc/x86_64-w64-mingw32/4.5.3 -L/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/lib/../lib64 -L/usr/lib/gcc/x86_64-w64-mingw32/4.5.3/../../../../x86_64-w64-mingw32/lib -L/usr/x86_64-w64-mingw32/sys-root/mingw/lib /tmp/ccUf85Zh.o -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt /usr/x86_64-w64-mingw32/sys-root/mingw/lib/crtend.o



How do I link in libstdc++?

tomdean


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list