g++: error trying to exec 'cc1plus'

2010-04-16
2013-06-06
1 2 > >> (Page 1 of 2)
  • Steven Zalek

    Steven Zalek - 2010-04-16

    I successfully built a mingw cross compiler using this script:
    http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64/experimental/buildsystem/makebuildroot.mk?view=log

    I installed the whole cross compiler to /usr/local/x86_64-w64-mingw32. When I attempt to compile a "Hello world" application in CodeBlocks the following error is generated:

    --------- Build: Release in TestHelloWorld ----------

    Compiling: main.cpp
    g++: error trying to exec 'cc1plus': execvp: No such file or directory
    Process terminated with status 1 (0 minutes, 0 seconds)
    0 errors, 0 warnings

    The compiler is obviously attempting to run. I searched my build of mingw and could not find cc1plus. Did I miss something with the build?

    Any insight would be appreciated.

    Thanks

     
  • NightStrike

    NightStrike - 2010-04-16

    What did you set your PATH to?

     
  • Steven Zalek

    Steven Zalek - 2010-04-16

    Fixed the compiler installation! More to do…

    I copied all of the contents of the mingw-w64-bin_Linux.tar.bz2 to the /usr/local directory, set up linux CodeBlocks for the cross compiler per the Wiki (mostly) and added a compiler path to /usr/local/libexec/gcc/x86_64-w64-mingw32/4.6.0 where cc1plus and other files exist.

    So I can compile a "Hello World" cosole application with CodeBlocks in debug and release mode.

    But the resulting binaries don't run on Windows or Wine…
    The binaries are built without the .exe extention (if that is a clue). I also don't know if they are 32-bit or 64-bit - I suspect 32-bit.

    Any assistance with my next step(s) would be greatly appreciated.

    Thanks

     
  • Jonathan Yong

    Jonathan Yong - 2010-04-16

    Hi,

    You are probably using the wrong compiler, cross gcc for windows adds the .exe extension for applications.

     
  • Jonathan Yong

    Jonathan Yong - 2010-04-16

    Hi,

    you are using the wrong compiler.

    Sorry, I have neglected to read your post carefully. "g++" is your native compiler, it produces linux executables. Try "x86_64-w64-mingw32-g++" instead.

     
  • Steven Zalek

    Steven Zalek - 2010-04-16

    Thanks,

    For my compiler toolchain executables I have set the installation directory to be /usr/local and the program files (within the underlying /bin folder) to be x86_64-w64-mingw32-gcc for the 'c' compiler, x86_64-w64-mingw32-g++ for the 'c++' compiler, etc.

    So my set-up seems to be correct, but obviously something is not right. Any other ideas?

     
  • Kai Tietz

    Kai Tietz - 2010-04-16

    Hello,

    as you wrote before

    Wiki (mostly) and added a compiler path to
    /usr/local/libexec/gcc/x86_64-w64-mingw32/4.6.0 where cc1plus and other files
    exist.

    This is wrong. Add the patch /usr/local/bin to your PATH and nothing else. Let the frontend doing its job to call internal tools. There is no reason to add this to your PATH.

    I assume if you have fixed this and made sure that /usr/local/bin (which contains x86_64-w64-mingw32-gcc, etc). Everything should work for you.

    Regards,
    Kai

     
  • Steven Zalek

    Steven Zalek - 2010-04-16

    Thanks - no joy.

    I removed the compiler path variable to /usr/local/libexec/gcc/x86_64-w64-mingw32/4.6.0 and verified that /usr/local/bin was in my global path variable.

    As before, the application compiles without the .exe extention and does not run in windows or wine.

    It does give a warning (possible clue?):
    warning: auto-importing has been activated without -enable-auto-import specified on the command line.
    Info: resolving std::cout  by linking to __imp___ZSt4cout

     
  • Doug Semler

    Doug Semler - 2010-04-16

    Umm dumb question but under windows:
    Have you copied lib*.dll (the shared libraries) to a subdir in your path (or the same directory as your executable) so that they can be found at runtime?

    Under wine: Have you added Z:\\usr\\local\\bin (which is where I believe the *.dll libraries live - or wherever they are located) to your PATH in the system.reg entry  ?

    In addition, are you compiling with the -o option?  if so, you'll need to add the .exe yourself, since it isn't automatic (in other words, the -o option just outputs the filename you give it)

    Doug

     
  • Ozkan Sezer

    Ozkan Sezer - 2010-04-16

    Probably a bad installation this is. Do you have an x86_64-w64-mingw32-gcc (and its friends similary prefixed with x86_64-w64-mingw32-) under your /usr/local/bin directory? Do you have a /usr/local/mingw as a symlink pointing to /usr/local/x86_64-w64-mingw32 ?

     
  • Steven Zalek

    Steven Zalek - 2010-04-16

    I have the first:

    Do you have an x86_64-w64-mingw32-gcc (and its friends similary prefixed with x86_64-w64-mingw32-) under your /usr/local/bin directory?

    YES

    I don't believe I have the second:

    Do you have a /usr/local/mingw as a symlink pointing to /usr/local/x86_64-w64-mingw32 ?

    How create this specific link would be appreciated. Thanks.

     
  • Ozkan Sezer

    Ozkan Sezer - 2010-04-16

    > I don't believe I have the second:
    >

    Do you have a /usr/local/mingw as a symlink pointing to
    > /usr/local/x86_64-w64-mingw32 ?

    >
    > How create this specific link would be appreciated. Thanks.

    Well, simply type this:
    ln -s x86_64-w64-mingw32 /usr/local/mingw
    (I assume that you do have the /usr/local/x86_64-w64-mingw32
    directory itself already present, of course.)

     
  • Steven Zalek

    Steven Zalek - 2010-04-16

    I created the symbolic link successfully:
    sudo ln -s /usr/local/x86_64-w64-mingw32 /usr/local/mingw
    ln: creating symbolic link `/usr/local/mingw/x86_64-w64-mingw32': File exists

    However, there has been no change in result; the compiler creates the binaries, but they do not have the '.exe' extension and will not run on windows.

     
  • Jonathan Yong

    Jonathan Yong - 2010-04-16

    alright, lets try something simple.

    use "file <executable>" in the console. What does it say?

    Try also "echo main(){}"|x86_64-w64-mingw32-gcc -xc - -v, does it create a.exe?

     
  • Steven Zalek

    Steven Zalek - 2010-04-16

    First check: (seems OK)
    file TestHelloWorld
    TestHelloWorld: PE32+ executable for MS Windows (console)

    Second check: (seems NOT OK; no a.exe file was created in the folder I ran this script from)
    zaleksf@name-b2crhh1:~/Apps/myProj/TestHelloWorld/bin/Release$ "echo main(){}"|x86_64-w64-mingw32-gcc -xc - -v
    Using built-in specs.
    COLLECT_GCC=x86_64-w64-mingw32-gcc
    COLLECT_LTO_WRAPPER=/usr/local/bin/../libexec/gcc/x86_64-w64-mingw32/4.6.0/lto-wrapper
    Target: x86_64-w64-mingw32
    Configured with: ../../../build/gcc/gcc/configure -target=x86_64-w64-mingw32 -prefix=/home/zaleksf/Apps/MinGW/build/root -with-sysroot=/home/zaleksf/Apps/MinGW/build/root -with-gmp=/home/zaleksf/Apps/MinGW/build/gmp/install -with-mpfr=/home/zaleksf/Apps/MinGW/build/mpfr/install -with-mpc=/home/zaleksf/Apps/MinGW/build/mpc/install -enable-languages=all,obj-c++ -enable-fully-dynamic-string -disable-multilib
    Thread model: win32
    gcc version 4.6.0 20100415 (experimental) (GCC)
    COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
    /usr/local/bin/../libexec/gcc/x86_64-w64-mingw32/4.6.0/cc1 -quiet -v -iprefix /usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/ - -quiet -dumpbase - -mtune=generic -march=x86-64 -auxbase - -version -o /tmp/cc5bCyDA.s
    GNU C (GCC) version 4.6.0 20100415 (experimental) (x86_64-w64-mingw32)
    compiled by GNU C version 4.4.1, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
    GGC heuristics: -param ggc-min-expand=30 -param ggc-min-heapsize=4096
    ignoring nonexistent directory "/home/zaleksf/Apps/MinGW/build/root/usr/local/include"
    ignoring duplicate directory "/usr/local/bin/../lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.6.0/include"
    ignoring duplicate directory "/usr/local/bin/../lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.6.0/include-fixed"
    ignoring duplicate directory "/usr/local/bin/../lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/include"
    #include "…" search starts here:
    #include <…> search starts here:
    /usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/include
    /usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/include-fixed
    /usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/include
    /home/zaleksf/Apps/MinGW/build/root/mingw/include
    End of search list.
    GNU C (GCC) version 4.6.0 20100415 (experimental) (x86_64-w64-mingw32)
    compiled by GNU C version 4.4.1, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
    GGC heuristics: -param ggc-min-expand=30 -param ggc-min-heapsize=4096
    Compiler executable checksum: bc56560b180bc901b4c103b0f0ce1544
    COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
    /usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/bin/as -v -o /tmp/ccoi0aAA.o /tmp/cc5bCyDA.s
    GNU assembler version 2.20.51 (x86_64-w64-mingw32) using BFD version (GNU Binutils) 2.20.51.20100415
    COMPILER_PATH=/usr/local/bin/../libexec/gcc/x86_64-w64-mingw32/4.6.0/:/usr/local/bin/../libexec/gcc/:/usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/bin/
    LIBRARY_PATH=/usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/:/usr/local/bin/../lib/gcc/:/usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib/../lib64/:/home/zaleksf/Apps/MinGW/build/root/mingw/lib/../lib64/:/usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib/:/home/zaleksf/Apps/MinGW/build/root/mingw/lib/
    COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
    /usr/local/bin/../libexec/gcc/x86_64-w64-mingw32/4.6.0/collect2 -sysroot=/home/zaleksf/Apps/MinGW/build/root -m i386pep -Bdynamic /usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib/crt2.o /usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib/crtbegin.o -L/usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0 -L/usr/local/bin/../lib/gcc -L/usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib/../lib64 -L/home/zaleksf/Apps/MinGW/build/root/mingw/lib/../lib64 -L/usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib -L/home/zaleksf/Apps/MinGW/build/root/mingw/lib /tmp/ccoi0aAA.o -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt /usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib/crtend.o
    /usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o): In function `main':
    /home/zaleksf/Apps/MinGW/build/mingw/obj/../../../build/mingw/mingw-w64-crt/crt/crt0_c.c:18: undefined reference to `_WinMain'
    collect2: ld returned 1 exit status

     
  • Doug Semler

    Doug Semler - 2010-04-16

    Command was wrong - quote in wrong spot:

    echo "main(){}"|i686-w64-mingw32-gcc -xc  - -v

    not

    "echo main(){}"|i686-w64-mingw32-gcc -xc  - -v

     
  • Doug Semler

    Doug Semler - 2010-04-16

    And please read comment 9, specifically the part about the -o parameter to gcc when linking the executable.  The .exe extension is NOT automatically added to the result.

     
  • Doug Semler

    Doug Semler - 2010-04-16

    (and obviously, the echo … should be piped to x86_64-w64-mingw32-gcc, and not i686, which is my copy-pasto error :))

     
  • Steven Zalek

    Steven Zalek - 2010-04-16

    This works, and creates a.exe file:

    echo "main(){}"|x86_64-w64-mingw32-gcc -xc - -v
    Using built-in specs.
    COLLECT_GCC=x86_64-w64-mingw32-gcc
    COLLECT_LTO_WRAPPER=/usr/local/bin/../libexec/gcc/x86_64-w64-mingw32/4.6.0/lto-wrapper
    Target: x86_64-w64-mingw32
    Configured with: ../../../build/gcc/gcc/configure -target=x86_64-w64-mingw32 -prefix=/home/zaleksf/Apps/MinGW/build/root -with-sysroot=/home/zaleksf/Apps/MinGW/build/root -with-gmp=/home/zaleksf/Apps/MinGW/build/gmp/install -with-mpfr=/home/zaleksf/Apps/MinGW/build/mpfr/install -with-mpc=/home/zaleksf/Apps/MinGW/build/mpc/install -enable-languages=all,obj-c++ -enable-fully-dynamic-string -disable-multilib
    Thread model: win32
    gcc version 4.6.0 20100415 (experimental) (GCC)
    COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
    /usr/local/bin/../libexec/gcc/x86_64-w64-mingw32/4.6.0/cc1 -quiet -v -iprefix /usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/ - -quiet -dumpbase - -mtune=generic -march=x86-64 -auxbase - -version -o /tmp/ccSFqgN7.s
    GNU C (GCC) version 4.6.0 20100415 (experimental) (x86_64-w64-mingw32)
    compiled by GNU C version 4.4.1, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
    GGC heuristics: -param ggc-min-expand=30 -param ggc-min-heapsize=4096
    ignoring nonexistent directory "/home/zaleksf/Apps/MinGW/build/root/usr/local/include"
    ignoring duplicate directory "/usr/local/bin/../lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.6.0/include"
    ignoring duplicate directory "/usr/local/bin/../lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.6.0/include-fixed"
    ignoring duplicate directory "/usr/local/bin/../lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/include"
    #include "…" search starts here:
    #include <…> search starts here:
    /usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/include
    /usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/include-fixed
    /usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/include
    /home/zaleksf/Apps/MinGW/build/root/mingw/include
    End of search list.
    GNU C (GCC) version 4.6.0 20100415 (experimental) (x86_64-w64-mingw32)
    compiled by GNU C version 4.4.1, GMP version 4.3.2, MPFR version 2.4.2, MPC version 0.8.1
    GGC heuristics: -param ggc-min-expand=30 -param ggc-min-heapsize=4096
    Compiler executable checksum: bc56560b180bc901b4c103b0f0ce1544
    COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
    /usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/bin/as -v -o /tmp/ccxSmmVb.o /tmp/ccSFqgN7.s
    GNU assembler version 2.20.51 (x86_64-w64-mingw32) using BFD version (GNU Binutils) 2.20.51.20100415
    COMPILER_PATH=/usr/local/bin/../libexec/gcc/x86_64-w64-mingw32/4.6.0/:/usr/local/bin/../libexec/gcc/:/usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/bin/
    LIBRARY_PATH=/usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/:/usr/local/bin/../lib/gcc/:/usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib/../lib64/:/home/zaleksf/Apps/MinGW/build/root/mingw/lib/../lib64/:/usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib/:/home/zaleksf/Apps/MinGW/build/root/mingw/lib/
    COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=x86-64'
    /usr/local/bin/../libexec/gcc/x86_64-w64-mingw32/4.6.0/collect2 -sysroot=/home/zaleksf/Apps/MinGW/build/root -m i386pep -Bdynamic /usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib/crt2.o /usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib/crtbegin.o -L/usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0 -L/usr/local/bin/../lib/gcc -L/usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib/../lib64 -L/home/zaleksf/Apps/MinGW/build/root/mingw/lib/../lib64 -L/usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib -L/home/zaleksf/Apps/MinGW/build/root/mingw/lib /tmp/ccxSmmVb.o -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc_eh -lgcc -lmoldname -lmingwex -lmsvcrt /usr/local/bin/../lib/gcc/x86_64-w64-mingw32/4.6.0/../../../../x86_64-w64-mingw32/lib/crtend.o

    The -o compiler setting is automatically set in the CodeBlocks compiler settings - I'll try to change this.

    When I execute a.exe (or TestHelloWorld) with Wine I get the following message:
    wine a
    Trying to load PE image for unsupported architecture (AMD-64)
    err:process:create_process starting 64-bit process L"H:\\Apps\\myProj\\TestHelloWorld\\bin\\Release\\a.exe" not supported on this platform
    wine: Bad EXE format for H:\Apps\myProj\TestHelloWorld\bin\Release\a.exe

    I'm not entirely sure of the significance of these messages for Wine. I'll try the same binaries on the Win7_x64 OS.

     
  • Steven Zalek

    Steven Zalek - 2010-04-16

    I attempted to run TestHelloWorld.exe ('.exe' added manually) in Win7_x64 OS, but it would not start indicating that there was a problem starting the file.

     
  • Steven Zalek

    Steven Zalek - 2010-04-16

    When I run the TestHelloWorld app from within CodeBlocks, a console windo pops up with the following error message:

    Trying to load PE image for unsupported architecture (AMD-64)
    err:process:create_process starting 64-bit process "TestHelloWorld." not supported on this platform
    wine: Bad EXE format for Test HelloWorld.
    Process returned 193 (0xC1)

     
  • Doug Semler

    Doug Semler - 2010-04-16

    Yet another really dumb question:  Your linux box is 64 bit, right (just checking), with the 64 bit version of wine installed, right?  With a fresh ~/.wine (FWIR, wine64 and wine32 don't coexist very well).

    Anyway.  What is the exact message you get from Win7 - and check your Event Log, because there may be more info in there.  I'm suspecting that you're missing the lib*.dll support on the windows box, since you're using g++ to create the executable.

     
  • Kai Tietz

    Kai Tietz - 2010-04-16

    Well, could it be that you have dependency to libgcc_s-dll or to shared libstdc++.dll file. Use for building the executable the option '-static'. It makes sure that just static libraries are linked and you won't have additional DLL dependencies linked into executable.

     
  • Steven Zalek

    Steven Zalek - 2010-04-16

    I am using 64-bit Ubuntu 9.10 with Wine-1.1.42; it may not be 64-bit Wine.

    I'm not sure what additional lib*.dll support I need on the windows OS - where do I look? I'll check my windows Event Log (pardon my slow response - I'm bouncing between OSs on the same machine)

    Thanks

     
  • Steven Zalek

    Steven Zalek - 2010-04-19

    Solved. Had to:

    1) build the cross compiler with the TARGET_ARCH=i686-w32-mingw32
    2) manually tell the compiler to add the '.exe' extention
    3) compile with the '-static' flag

    Thanks, All

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks