andrewwutw/build-djgpp

Missing cc1

msikma opened this issue · 5 comments

When attempting to compile a program, I get the following error:

$ ./gcc /path/to/lines.c -o /path/to/lines.exe
gcc: error trying to exec 'cc1': execvp: No such file or directory

This is on Mac OS X 10.10.3, with DJGPP 5.2.0 installed through the script. Am I missing a dependency or is there some other problem?

Strangely enough, the build script managed to make hello.exe and hello-cpp.exe which both work in DOS, though the regular Unix executables do not run. So that would indicate first and foremost that it's probably an environment problem on my end.

Edit: Ah, figured out why the hello world programs compiled. It seems to work fine when I invoke /usr/local/djgpp/bin/i586-pc-msdosdjgpp-gcc but not when I invoke /usr/local/djgpp/i586-pc-msdosdjgpp/bin/gcc. The latter is broken.

Be sure you're using the build-djgpp cross compiler. Try
./gcc -v

Or, to be more exact,
which i586-pc-msdosdjgpp-gcc && i586-pc-msdosdjgpp-gcc -v

There should be something about i586 and pc and msdos and djgpp in the output.

On OSX, gcc & cc are aliased to clang. Be sure your paths are set correctly too, especially if you want to use the short names.
echo PATH=$PATH
echo GCC_EXEC_PREFIX=$GCC_EXEC_PREFIX

Here's the output.

Non-working binary:

/usr/local/djgpp/i586-pc-msdosdjgpp/bin/gcc -v                                                                                                                                                          
Mon Sep 21 18:59:54 CEST 2015
Using built-in specs.
COLLECT_GCC=/usr/local/djgpp/i586-pc-msdosdjgpp/bin/gcc
Target: i586-pc-msdosdjgpp
Configured with: ../gnu/gcc-5.20/configure --target=i586-pc-msdosdjgpp --program-prefix=i586-pc-msdosdjgpp- --prefix=/usr/local/djgpp --disable-nls --disable-plugin --disable-lto --enable-lto --enable-libquadmath-support --with-gmp=/Users/msikma/Source/build-djgpp/build/djcross-gcc-5.2.0/tmpinst --with-mpfr=/Users/msikma/Source/build-djgpp/build/djcross-gcc-5.2.0/tmpinst --with-mpc=/Users/msikma/Source/build-djgpp/build/djcross-gcc-5.2.0/tmpinst --enable-version-specific-runtime-libs --enable-languages=c,c++
Thread model: single
gcc version 5.2.0 (GCC) 

Working binary:

/usr/local/djgpp/bin/i586-pc-msdosdjgpp-gcc -v
Using built-in specs.
COLLECT_GCC=/usr/local/djgpp/bin/i586-pc-msdosdjgpp-gcc
COLLECT_LTO_WRAPPER=/usr/local/djgpp/libexec/gcc/i586-pc-msdosdjgpp/5.2.0/lto-wrapper
Target: i586-pc-msdosdjgpp
Configured with: ../gnu/gcc-5.20/configure --target=i586-pc-msdosdjgpp --program-prefix=i586-pc-msdosdjgpp- --prefix=/usr/local/djgpp --disable-nls --disable-plugin --disable-lto --enable-lto --enable-libquadmath-support --with-gmp=/Users/msikma/Source/build-djgpp/build/djcross-gcc-5.2.0/tmpinst --with-mpfr=/Users/msikma/Source/build-djgpp/build/djcross-gcc-5.2.0/tmpinst --with-mpc=/Users/msikma/Source/build-djgpp/build/djcross-gcc-5.2.0/tmpinst --enable-version-specific-runtime-libs --enable-languages=c,c++
Thread model: single
gcc version 5.2.0 (GCC) 

The only difference is that the latter has a COLLECT_LTO_WRAPPER defined.

I always use i586-pc-msdosdjgpp-gcc and it works for me (on both linux x86_64 & linux ia32). It is common practice, when using a cross-compiler, to use the long form name for gcc to distinguish from the system native compiler. You can see an example of how I used it in my lz4 port for djgpp

Yeah, though I think both versions should probably work I'm definitely just going to use the longer named version. Maybe a short note in the readme would work. I'm still a bit puzzled why the shorter named one doesn't work.

If you want to use compiler short name(gcc), you need to setup PATH and GCC_EXEC_PREFIX environment variables.

For example, if you install DJGPP in /usr/local/djgpp-520, you will need to run :

export PATH=/usr/local/djgpp-520/i586-pc-msdosdjgpp/bin/:$PATH
export GCC_EXEC_PREFIX=/usr/local/djgpp-520/lib/gcc/

You can check the section "Using DJGPP compiler" in README.md file.