public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* x86_64-w64-ming32-g++ file not recognized by objdump
@ 2011-08-21  1:01 Thomas D. Dean
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas D. Dean @ 2011-08-21  1:01 UTC (permalink / raw)
  To: cygwin

I am missing something, I think. 
I have a simple application, taken from the web, t.cc 

#include <vector> 
#include <string> 
using namespace std; 
int main() { 
  vector<string> vs; 
  vs.push_back("asdf"); 
} 

If I compile with g++, I get an executable that works, i.e. runs without
error.  This file is recognized by objdump and cygcheck. 

If I compile with x86_64-w64-ming32-g++ -m64 t.cc -o t 
the resulting executable produces an error message 
> ./t.exe 
t.exe: error while loading shared libraries: ?: cannot open shared
object file: no such file or directory. 
> objdump -p ./t.exe 
objdump: ./t.exe: File format not recognized 
> cygcheck ./t.exe 
...\t.exe 
But, no list of dll's as produced from the g++ version. 

What am I doing wrong? 

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: x86_64-w64-ming32-g++ file not recognized by objdump
  2011-08-21  3:33   ` JonY
  2011-08-21  4:28     ` Thomas D. Dean
@ 2011-08-21  4:30     ` Thomas D. Dean
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas D. Dean @ 2011-08-21  4:30 UTC (permalink / raw)
  To: cygwin

On Sun, 2011-08-21 at 11:32 +0800, JonY wrote:

> you are probably missing the runtime DLLs from path. They should be
> found in "/usr/x86_64-w64-mingw32/sys-root/mingw/bin".
> 
> 

You are correct.

export PATH="$PATH:/usr/x86_64-w64-mingw32/sys-root/mingw/bin" fixed the
problem.

Thanks

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: x86_64-w64-ming32-g++ file not recognized by objdump
  2011-08-21  3:33   ` JonY
@ 2011-08-21  4:28     ` Thomas D. Dean
  2011-08-21  4:30     ` Thomas D. Dean
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas D. Dean @ 2011-08-21  4:28 UTC (permalink / raw)
  To: JonY; +Cc: cygwin

On Sun, 2011-08-21 at 11:32 +0800, JonY wrote:

> Hi Thomas,
> 
> you are probably missing the runtime DLLs from path. They should be
> found in "/usr/x86_64-w64-mingw32/sys-root/mingw/bin".
> 
> 

I have:
libgcc_s_sjlj-1.dll
libgfortran-3.dll
libgomp-1.dll
libobjc-2.dll
libssp-0.dll
libstdc++-6.dll
pthreadGC2.dll

Should some environment variable point there?

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: x86_64-w64-ming32-g++ file not recognized by objdump
  2011-08-21  2:11 ` Sisyphus
  2011-08-21  3:33   ` JonY
@ 2011-08-21  4:19   ` Thomas D. Dean
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas D. Dean @ 2011-08-21  4:19 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: x86_64-w64-ming32-g++ file not recognized by objdump
  2011-08-21  2:11 ` Sisyphus
@ 2011-08-21  3:33   ` JonY
  2011-08-21  4:28     ` Thomas D. Dean
  2011-08-21  4:30     ` Thomas D. Dean
  2011-08-21  4:19   ` Thomas D. Dean
  1 sibling, 2 replies; 7+ messages in thread
From: JonY @ 2011-08-21  3:33 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1335 bytes --]

On 8/21/2011 10:09, Sisyphus wrote:
> 
> ----- 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 g++, I get an executable that works, i.e. runs without
>> error.  This file is recognized by objdump and cygcheck.
>>
>> 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 ?
> What happens if you remove it from the command ?
> 
> I can't reproduce the error you get (either with or without '-m64'),
> though I'm just running mingw in the cmd.exe shell - not under Cygwin.
> 
>> the resulting executable produces an error message
>>> ./t.exe
>> t.exe: error while loading shared libraries: ?: cannot open shared
>> object file: no such file or directory.
>>> objdump -p ./t.exe
>> objdump: ./t.exe: File format not recognized
> 
> I think that's to be expected - objdump expects to look at a 32-bit
> executable.
> I get the same error when I run objdump on a 64-bit executable.
> Try:
> x86_64-w64-mingw32-objdump -p ./t.exe
> 

Hi Thomas,

you are probably missing the runtime DLLs from path. They should be
found in "/usr/x86_64-w64-mingw32/sys-root/mingw/bin".



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 196 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: x86_64-w64-ming32-g++ file not recognized by objdump
  2011-08-20 21:29 Thomas D. Dean
@ 2011-08-21  2:11 ` Sisyphus
  2011-08-21  3:33   ` JonY
  2011-08-21  4:19   ` Thomas D. Dean
  0 siblings, 2 replies; 7+ messages in thread
From: Sisyphus @ 2011-08-21  2:11 UTC (permalink / raw)
  To: tomdean, cygwin


----- 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 g++, I get an executable that works, i.e. runs without
> error.  This file is recognized by objdump and cygcheck.
>
> 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 ?
What happens if you remove it from the command ?

I can't reproduce the error you get (either with or without '-m64'), though 
I'm just running mingw in the cmd.exe shell - not under Cygwin.

> the resulting executable produces an error message
>> ./t.exe
> t.exe: error while loading shared libraries: ?: cannot open shared
> object file: no such file or directory.
>> objdump -p ./t.exe
> objdump: ./t.exe: File format not recognized

I think that's to be expected - objdump expects to look at a 32-bit 
executable.
I get the same error when I run objdump on a 64-bit executable.
Try:
x86_64-w64-mingw32-objdump -p ./t.exe

Cheers,
Rob 


--
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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* x86_64-w64-ming32-g++ file not recognized by objdump
@ 2011-08-20 21:29 Thomas D. Dean
  2011-08-21  2:11 ` Sisyphus
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas D. Dean @ 2011-08-20 21:29 UTC (permalink / raw)
  To: cygwin

I am missing something, I think. 
I have a simple application, taken from the web, t.cc 

#include <vector> 
#include <string> 
using namespace std; 
int main() { 
  vector<string> vs; 
  vs.push_back("asdf"); 
} 

If I compile with g++, I get an executable that works, i.e. runs without
error.  This file is recognized by objdump and cygcheck. 

If I compile with x86_64-w64-ming32-g++ -m64 t.cc -o t 
the resulting executable produces an error message 
> ./t.exe 
t.exe: error while loading shared libraries: ?: cannot open shared
object file: no such file or directory. 
> objdump -p ./t.exe 
objdump: ./t.exe: File format not recognized 
> cygcheck ./t.exe 
...\t.exe 
But, no list of dll's as produced from the g++ version. 

What am I doing wrong? 

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-08-21  4:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-21  1:01 x86_64-w64-ming32-g++ file not recognized by objdump Thomas D. Dean
  -- strict thread matches above, loose matches on Subject: below --
2011-08-20 21:29 Thomas D. Dean
2011-08-21  2:11 ` Sisyphus
2011-08-21  3:33   ` JonY
2011-08-21  4:28     ` Thomas D. Dean
2011-08-21  4:30     ` Thomas D. Dean
2011-08-21  4:19   ` Thomas D. Dean

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).