I’m compiling GCC on Solaris x86 and got the following error:
Assembler: optimize.c
"/var/tmp//ccMndPR3.s", line 85111 : Trouble closing elf file
gmake[3]: *** [cp/optimize.o] Error 1
I downloaded MPC, GMP and MPFR and extracted them into GCC source directory as mpc,gmp and mpfr directories and configure GCC source with:
$ ../gcc-5.2.0.src/configure --prefix=$HOME/gcc-5.2.0 --enable-languages=c,c++
I used gmake for executing the compilation tasks.
$ gmake
The file mentioned in the error message doesn’t exist.
$ ls -l "/var/tmp//ccEtAJ5n.s"
/var/tmp//ccEtAJ5n.s: No such file or directory
$ ls -l "/var/tmp/ccEtAJ5n.s"
/var/tmp/ccEtAJ5n.s: No such file or directory
I’m not sure how this can happen.
The file system has plenty of room:
$ df -h /var/tmp
Filesystem size used avail capacity Mounted on
/dev/dsk/c0t0d0s6 99G 27G 71G 28% /var
$ uname -a
SunOS sbdsvrwm566 5.10 Generic_150401-20 i86pc i386 i86pc
the only error message in config.log is as follows:
configure:5091: g++ -o conftest -g -O2 -static-libstdc++ -static-libgcc conftest.cpp >&5
g++: unrecognized option `-static-libstdc++'
conftest.cpp:11:2: #error -static-libstdc++ not implemented
configure:5091: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| /* end confdefs.h. */
|
| #if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
| #error -static-libstdc++ not implemented
| #endif
| int main() {}
the error apparently is due to the missing space between -static and -libstdc++. however, what is strange is none of the mentioned confdefs.h conftest.cpp exist either under the source or build directory or installed packages.
obviously the older gcc was used to compile the new gcc:
configure:4074: checking for gcc
configure:4090: found /usr/sfw/bin/gcc
configure:4101: result: gcc
configure:4330: checking for C compiler version
configure:4339: gcc --version >&5
gcc (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ echo $PATH
/usr/ccs/bin:/usr/bin:/usr/sfw/bin:/usr/sbin:/usr/local/bin:/opt/SUNWspro/bin:/bin:/usr/bin:/usr/sbin:/usr/ucb:/bns/bin:/usr/openwin/bin:
$ echo $LD_LIBRARY_PATH
/opt/SUNWspro11/SUNWspro/prod/lib:/usr/local/lib:/usr/lib:/usr/lib/X11
Related
I've installed Cygwin64 and I now would like to install extundelete.
So I downloaded it, decompressed the file, but when I run ./configure it says:
$ ./configure
Configuring extundelete 0.2.4
configure: error: in `/cygdrive/c/Users/franc/Desktop/extundelete-0.2.4':
configure: error: C++ compiler cannot create executables
See `config.log' for more details
So I open the config.log file and I find some error:
configure:2876: $? = 0
configure:2865: CC -v >&5
Using built-in specs.
COLLECT_GCC=CC
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/9.2.0/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-9.2.0-2.x86_64/src/gcc-9.2.0/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-9.2.0-2.x86_64/src/gcc-9.2.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libgomp --enable-libquadmath --enable-libquadmath-support --disable-libssp --enable-libada --disable-symvers --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible --enable-libstdcxx-filesystem-ts
Thread model: posix
gcc version 9.2.0 (GCC)
configure:2876: $? = 0
configure:2865: CC -V >&5
CC: error: unrecognized command line option '-V'
CC: fatal error: no input files
compilation terminated.
configure:2876: $? = 1
configure:2865: CC -qversion >&5
CC: error: unrecognized command line option '-qversion'; did you mean '--version'?
CC: fatal error: no input files
compilation terminated.
configure:2876: $? = 1
configure:2896: checking whether the C++ compiler works
configure:2918: CC conftest.cpp >&5
CC: fatal error: cannot execute 'cc1plus': spawn: No such file or directory
compilation terminated.
configure:2922: $? = 1
configure:2960: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "extundelete"
| #define PACKAGE_TARNAME "extundelete"
| #define PACKAGE_VERSION "0.2.4"
| #define PACKAGE_STRING "extundelete 0.2.4"
| #define PACKAGE_BUGREPORT "extundelete.sourceforge.net"
| #define PACKAGE_URL ""
| #define PACKAGE "extundelete"
| #define VERSION "0.2.4"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:2965: error: in `/cygdrive/c/Users/franc/Desktop/extundelete-0.2.4':
configure:2967: error: C++ compiler cannot create executables
See `config.log' for more details
And the .log file ends up with configure: exit 77
Is it possible to compile files in Cygwin64?
Your build problem is likely due to permissions inherited from C:\Users\franc that screw the execution permission needed by the build process.
Use the /home/franc or the /usr/src directories or other similar ones.
Do NOT build under the Windows Home directories.
Unfortunately you can not build the program on Cygwin for another reason; see below:
In a proper directory you will have:
$ ./configure
Configuring extundelete 0.2.4
Writing generated files to disk
To avoid some scope error, you can remove the restricting invocation from the makefiles
$ find . -name Makefile -exec sed -e "s/-std=c99//" -i {} \;
$ find . -name Makefile -exec sed -e "s/-std=c++0x -std=c++11//" -i {} \;
and then build
$ make
make -s all-recursive
Making all in src
...
insertionops.cc: In function ‘std::ostream& operator<<(std::ostream&, const ext2_inode&)’:
insertionops.cc:36:36: error: ‘const struct ext2_inode’ has no member named ‘i_dir_acl’; did you mean ‘i_file_acl’?
36 | os << "Directory ACL: " << inode.i_dir_acl << std::endl;
| ^~~~~~~~~
| i_file_acl
make[2]: *** [Makefile:437: extundelete-insertionops.o] Error 1
make[1]: *** [Makefile:268: all-recursive] Error 1
make: *** [Makefile:208: all] Error 2
and you can not overcome the lack of extended property from the Cygwin ext2 inode structure.
As Cygwin is a Windows user mode program it can not mount a filesystem not recognized by Windows as its support of ext2 is very limited and mainly focused on just making the file system on a external disk but it can not really use it.
I am trying to configure OpenSMILE 2.3.0 on my Mac OS. Right now my only guess to why it's not working is that the Xcode syntax changed and OpenSMILE didn't catch up with it, so perhaps I need an older version of Xcode. Please let me know if it could be anything else.
I tried the suggestions from the other question (MacOS: configure: error: C compiler cannot create executables) and so far it has failed to configure still.
I tried downloading the latest Xcode command line tools to get the latest C compiler.
Command run:
bash buildStandalone.sh
Result:
- aclocal.
- autoconf.
- autoheader.
- automake.
- glibtoolize
- aclocal.
- autoconf.
- autoheader.
- automake.
- glibtoolize
./configure --without-portaudio --prefix=/Users/monica/music-emotion/opensmile-2.3.0/inst --enable-static --enable-shared=no
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/Users/monica/music-emotion/opensmile-2.3.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
failed to configure openSMILE!
And config.log contains this:
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2496: checking for a BSD-compatible install
configure:2564: result: /usr/bin/install -c
configure:2575: checking whether build environment is sane
configure:2630: result: yes
configure:2781: checking for a thread-safe mkdir -p
configure:2820: result: ./install-sh -c -d
configure:2827: checking for gawk
configure:2843: found /usr/local/bin/gawk
configure:2854: result: gawk
configure:2865: checking whether make sets $(MAKE)
configure:2887: result: yes
configure:2916: checking whether make supports nested variables
configure:2933: result: yes
configure:3110: checking for gcc
configure:3126: found /usr/bin/gcc
configure:3137: result: gcc
configure:3366: checking for C compiler version
configure:3375: gcc --version >&5
Apple clang version 11.0.0 (clang-1100.0.33.5)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
configure:3386: $? = 0
configure:3375: gcc -v >&5
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.5)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
configure:3386: $? = 0
configure:3375: gcc -V >&5
clang: error: unsupported option '-V -Wno-framework-include-private-from-public'
clang: error: no input files
configure:3386: $? = 1
configure:3375: gcc -qversion >&5
clang: error: unknown argument '-qversion', did you mean '--version'?
clang: error: no input files
configure:3386: $? = 1
configure:3406: checking whether the C compiler works
configure:3428: gcc -O2 -mfpmath=sse -msse2 -D__STATIC_LINK -DOPENSMILE_BUILD -DBUILD_SVMSMO -DBUILD_SVMSMO -DBUILD_LIBSVM -DBUILD_RNN -DBUILD_WITHOUT_EXPERIMENTAL -lrt -lm -lpthread -lc conftest.c >&5
ld: library not found for -lrt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:3432: $? = 1
configure:3470: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "openSMILE"
| #define PACKAGE_TARNAME "opensmile"
| #define PACKAGE_VERSION "2.3.0"
| #define PACKAGE_STRING "openSMILE 2.3.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "opensmile"
| #define VERSION "2.3.0"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3475: error: in `/Users/monica/music-emotion/opensmile-2.3.0':
configure:3477: error: C compiler cannot create executables
See `config.log' for more details
If you edit buildStandalone.sh as follows:
-export LDFLAGS="-lm -lpthread -lc"
+export LDFLAGS="-lrt -lm -lpthread -lc"
it should work. From what I can tell from elsewhere librt isn't need on OS-X.
I'm trying to install Alien::wxWidgets version 0.67 with wxWidgets version 3.0.2, but no matter what I do, I get the following error:
checking if C compiler (clang -mmacosx-version-min=10.5) works with SDK/version options... configure: error: in `/Users/David/.cpan/build/Alien-wxWidgets-0.67-GGkXTu/wxWidgets-3.0.2/bld':
configure: error: no. Try a different SDK
See `config.log' for more details
system: echo exit | sh ../configure --prefix=/Users/David/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/darwin-2level/Alien/wxWidgets/osx_cocoa_3_0_2_uni --with-osx_cocoa --with-opengl --disable-compat24 --enable-unicode --disable-monolithic --disable-universal_binary --enable-graphics_ctx CC=clang CXX=clang++ CXXFLAGS="-stdlib=libc++ -std=c++11" OBJCXXFLAGS="-stdlib=libc++ -std=c++11" LDFLAGS=-stdlib=libc++: 256 at Build line 60.
I've tried building with flags --with-macosx-sdk=10.5, --with-macosx-sdk=10.10, --without-macosx-sdk, --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/ but none of them worked.
Here's the part of the config.log, where I see the error, but I have no idea how to solve it:
configure:16429: checking for gcc
configure:16456: result: clang
configure:16685: checking for C compiler version
configure:16694: clang --version >&5
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
configure:16705: $? = 0
configure:16694: clang -v >&5
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
configure:16705: $? = 0
configure:16694: clang -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:16705: $? = 1
configure:16694: clang -qversion >&5
clang: error: unknown argument: '-qversion'
clang: error: no input files
configure:16705: $? = 1
configure:16725: checking whether the C compiler works
configure:16747: clang -stdlib=libc++ conftest.c >&5
configure:16751: $? = 0
configure:16799: result: yes
configure:16802: checking for C compiler default output file name
configure:16804: result: a.out
configure:16810: checking for suffix of executables
configure:16817: clang -o conftest -stdlib=libc++ conftest.c >&5
configure:16821: $? = 0
configure:16843: result:
configure:16865: checking whether we are cross compiling
configure:16873: clang -o conftest -stdlib=libc++ conftest.c >&5
configure:16877: $? = 0
configure:16884: ./conftest
configure:16888: $? = 0
configure:16903: result: no
configure:16908: checking for suffix of object files
configure:16930: clang -c conftest.c >&5
configure:16934: $? = 0
configure:16955: result: o
configure:16959: checking whether we are using the GNU C compiler
configure:16978: clang -c conftest.c >&5
configure:16978: $? = 0
configure:16987: result: yes
configure:16996: checking whether clang accepts -g
configure:17016: clang -c -g conftest.c >&5
configure:17016: $? = 0
configure:17057: result: yes
configure:17074: checking for clang option to accept ISO C89
configure:17137: clang -c conftest.c >&5
configure:17137: $? = 0
configure:17150: result: none needed
configure:17183: checking whether we are using the Intel C compiler
configure:17203: clang -c conftest.c >&5
conftest.c:18:17: error: use of undeclared identifier 'choke'
choke me
^
1 error generated.
configure:17203: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "wxWidgets"
| #define PACKAGE_TARNAME "wxwidgets"
| #define PACKAGE_VERSION "3.0.2"
| #define PACKAGE_STRING "wxWidgets 3.0.2"
| #define PACKAGE_BUGREPORT "wx-dev#lists.wxwidgets.org"
| #define PACKAGE_URL ""
| #define __BSD__ 1
| #define __DARWIN__ 1
| #define TARGET_CARBON 1
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| #ifndef __INTEL_COMPILER
| choke me
| #endif
|
| ;
| return 0;
| }
configure:17213: result: no
configure:17936: checking how to run the C preprocessor
configure:17967: clang -E conftest.c
configure:17967: $? = 0
configure:17981: clang -E conftest.c
conftest.c:12:10: fatal error: 'ac_nonexistent.h' file not found
#include <ac_nonexistent.h>
^
1 error generated.
configure:17981: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "wxWidgets"
| #define PACKAGE_TARNAME "wxwidgets"
| #define PACKAGE_VERSION "3.0.2"
| #define PACKAGE_STRING "wxWidgets 3.0.2"
| #define PACKAGE_BUGREPORT "wx-dev#lists.wxwidgets.org"
| #define PACKAGE_URL ""
| #define __BSD__ 1
| #define __DARWIN__ 1
| #define TARGET_CARBON 1
| /* end confdefs.h. */
| #include <ac_nonexistent.h>
If you have any idea how to solve this issue and get wxWidgets working on OSX 10.10, I'd be really grateful.
Add the following:
--with-macosx-version-min=10.11
This is not the right part of config.log, this error is normal/expected, you should look below to see the real one. Without seeing it, it's hard to be sure but I think -mmacosx-version-min=10.5 is the culprit, your SDK could be too new to support 10.5. Try either selecting a different SDK if you have an older one installed (look under /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs to check) or hunt down where this 10.5 comes from and replace it with 10.7 which is supported by 10.10 SDK (not sure about 10.11).
This is how I got to to mostly build under Mac OS 10.11.4:
Download Alien::wxWidgets from https://metacpan.org/pod/Alien::wxWidgets
tar xzf Alien-wxWidgets-0.67.tar.gz
cd Alien-wxWidgets
perl ./Build.PL --wxWidgets-extraflags="--with-macosx-versin-min=10.11"
./Build
After several minutes of compiling, the below error stopped the build process:
../src/osx/webview_webkit.mm:936:25: error: cannot initialize a variable of type 'WebBackForwardList *' with an rvalue of type 'WKBackForwardList *'
WebBackForwardList* history = [m_webView backForwardList];
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/osx/webview_webkit.mm:954:25: error: cannot initialize a variable of type 'WebBackForwardList *' with an rvalue of type 'WKBackForwardList *'
WebBackForwardList* history = [m_webView backForwardList];
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 warnings and 2 errors generated.
make: *** [webviewdll_osx_webview_webkit.o] Error 1
system: make all: 512 at ./Build line 60.
So --with-macosx-versin-min=10.11 gets us farther into the build process, but not (yet) to a successful build. :-(
I used the steps from #Cal above, but with the patch from wxWidgets project to fix the m_webView type mismatch errors. The wxWidgets issue is tracked here: http://trac.wxwidgets.org/ticket/16329 and the patch is here: http://trac.wxwidgets.org/attachment/ticket/16329/0001-using-proper-types-for-webkit-variants-see-16329.patch which gives you a html view of the patch. The download link is here: http://trac.wxwidgets.org/raw-attachment/ticket/16329/0001-using-proper-types-for-webkit-variants-see-16329.patch
It looks like they've fixed this in trunk for releases >= 3.1 and this is the proposed patch for a possible 3.0.3, but since no action for 18 mos., perhaps they'll just skip it and this will go away in the next release.
I repackaged the patch to work with Alien::wxWidgets Build.PL here: http://markwal.github.io/patches/Alien-wxWidgets-0.67-El-Capitan.patch
So to recap, the steps I used to build under Mac OS X El Capitan 10.11.6:
Download Alien::wxWidgets from https://metacpan.org/pod/Alien::wxWidgets
tar xvf Alien-wxWidgets-0.67.tar.gz
Download the patch from http://markwal.github.io/patches/Alien-wxWidgets-0.67-El-Capitan.patch
cd Alien-wxWidgets-0.67
patch -p1 < ../Alien-wxWidgets-0.67-El-Capitan.patch
perl ./Build.PL --wxWidgets-extraflags="--with-macosx-version-min=10.11"
perl Build
perl Build test
perl Build install
Problem overview
I am trying to learn how to build a cross-compiler, specifically a version of GNU gcc 4.7.2 on a 64-bit Intel OS X host that targets i386-apple-darwin (32-bit Intel). However, I keep getting stuck on the same error:
...
checking for i386-apple-darwin-gcc... /Users/alexpreynolds/Developer/third-party/build-gcc/./gcc/xgcc -B/Users/alexpreynolds/Developer/third-party/build-gcc/./gcc/ -B/Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/bin/ -B/Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/lib/ -isystem /Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/include -isystem /Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/sys-include
checking for suffix of object files... configure: error: in `/Users/alexpreynolds/Developer/third-party/build-gcc/i386-apple-darwin/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
make: *** [all] Error 2
Build process
I first build a version of GNU binutils which targets i386-apple-darwin, which is accessible to the GNU gcc build folder:
$ cd third-party
$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.23.2.tar.bz2
$ tar xjvf binutils-2.23.2.tar.bz2
$ mkdir i386-apple-darwin
$ mkdir build-binutils && cd build-binutils
$ ../binutils-2.23.2/configure --target=i386-apple-darwin --prefix="/Users/alexpreynolds/Developer/third-party/i386-apple-gcc"
$ make all && make install
...
Then I try to build a targeted version of gcc as follows:
$ cd ..
$ pwd
/Users/alexpreynolds/Developer/third-party
$ wget http://ftp.gnu.org/pub/gnu/gcc/gcc-4.7.2/gcc-4.7.2.tar.bz2
$ tar xvjf gcc-4.7.2.tar.bz2
$ cd gcc-4.7.2
$ ./contrib/download_prerequisites
... /* this grabs GMP, MPC and MPFR dependencies */
$ cd ..
$ mkdir build-gcc && cd build-gcc
$ ../gcc-4.7.2/configure --target=i386-apple-darwin --prefix="/Users/alexpreynolds/Developer/Bedops/bedops/third-party/i386-apple-gcc"
$ make
...
After about 30 minutes of compiling stuff, it gets stuck with the error message shown above.
Error details
To track down the source of the error, here is a snippet of build-gcc/i386-apple-darwin/libgcc/config.log:
configure:3344: /Users/alexpreynolds/Developer/third-party/build-gcc/./gcc/xgcc -B/Users/alexpreynolds/Developer/third-party/build-gcc/./gcc/ -B/Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/bin/ -B/Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/lib/ -isystem /Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/include -isystem /Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/sys-include -V >&5
xgcc: error: unrecognized command line option '-V'
xgcc: fatal error: no input files
compilation terminated.
configure:3355: $? = 1
configure:3344: /Users/alexpreynolds/Developer/third-party/build-gcc/./gcc/xgcc -B/Users/alexpreynolds/Developer/third-party/build-gcc/./gcc/ -B/Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/bin/ -B/Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/lib/ -isystem /Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/include -isystem /Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/sys-include -qversion >&5
xgcc: error: unrecognized command line option '-qversion'
xgcc: fatal error: no input files
compilation terminated.
configure:3355: $? = 1
configure:3371: /Users/alexpreynolds/Developer/third-party/build-gcc/./gcc/xgcc -B/Users/alexpreynolds/Developer/third-party/build-gcc/./gcc/ -B/Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/bin/ -B/Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/lib/ -isystem /Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/include -isystem /Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/sys-include -o conftest -g -O2 conftest.c >&5
Assembler messages:
Fatal error: invalid listing option `r'
configure:3374: $? = 1
configure:3562: checking for suffix of object files
configure:3584: /Users/alexpreynolds/Developer/third-party/build-gcc/./gcc/xgcc -B/Users/alexpreynolds/Developer/third-party/build-gcc/./gcc/ -B/Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/bin/ -B/Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/lib/ -isystem /Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/include -isystem /Users/alexpreynolds/Developer/third-party/i386-apple-gcc/i386-apple-darwin/sys-include -c -g -O2 conftest.c >&5
Assembler messages:
Fatal error: invalid listing option `r'
configure:3588: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL "http://www.gnu.org/software/libgcc/"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3602: error: in `/Users/alexpreynolds/Developer/third-party/build-gcc/i386-apple-darwin/libgcc':
configure:3605: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
The compiler I'm bootstrapping from
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin12/4.7.2/lto-wrapper
Target: x86_64-apple-darwin12
Configured with: ../gcc-4.7.2/configure --prefix=/opt/local --build=x86_64-apple-darwin12 --enable-languages=c,c++,objc,obj-c++,lto,fortran,java --libdir=/opt/local/lib/gcc47 --includedir=/opt/local/include/gcc47 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.7 --with-libiconv-prefix=/opt/local --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.7 --with-gxx-include-dir=/opt/local/include/gcc47/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-ppl=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl --disable-cloog-version-check --enable-stage1-checking --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --disable-ppl-version-check --with-pkgversion='MacPorts gcc47 4.7.2_2+universal'
Thread model: posix
gcc version 4.7.2 (MacPorts gcc47 4.7.2_2+universal)
Question
Is there a step I missed in setting up the build environment of coreutils or gcc such that this error results?
What else can I troubleshoot in trying to resolve this error? My Google searches on this error message are not bearing much fruit.
Changes
I changed the build script as follows:
#!/bin/bash -x
WORK_DIR=$PWD
INSTALL_DIR=$WORK_DIR/gcc-4.7.2-darwin
MIN_OSX_VERSION=10.5
if [ -d "$INSTALL_DIR" ]; then
echo "Directory $INSTALL_DIR already exists";
exit 1
fi
BINUTILS=binutils-2.23.2
TARBALL_BINUTILS=$BINUTILS.tar.bz2
URL_BINUTILS=http://ftp.gnu.org/gnu/binutils/$TARBALL_BINUTILS
SOURCE_BINUTILS_DIR=$WORK_DIR/$BINUTILS
BUILD_BINUTILS_DIR=$WORK_DIR/build-$BINUTILS
GCC=gcc-4.7.2
TARBALL_GCC=$GCC.tar.bz2
URL_GCC=http://ftp.gnu.org/pub/gnu/gcc/$GCC/$TARBALL_GCC
SOURCE_GCC_DIR=$WORK_DIR/$GCC
BUILD_GCC_DIR=$WORK_DIR/build-$GCC
curl -O $URL_BINUTILS
mkdir -p $SOURCE_BINUTILS_DIR
tar -xjvf $TARBALL_BINUTILS
rm $TARBALL_BINUTILS
mkdir -p $BUILD_BINUTILS_DIR
cd $BUILD_BINUTILS_DIR
$SOURCE_BINUTILS_DIR/configure --prefix=$INSTALL_DIR
make -j $(sysctl -n hw.availcpu) all CFLAGS='-Wno-error' && make install
find $INSTALL_DIR -name '*strip*' -delete
cd $WORK_DIR
curl -O $URL_GCC
mkdir -p $SOURCE_GCC_DIR
tar -xvjf $TARBALL_GCC
rm $TARBALL_GCC
cd $SOURCE_GCC_DIR
sed -i '' -e 's/wget/curl -O/g' $SOURCE_GCC_DIR/contrib/download_prerequisites
$SOURCE_GCC_DIR/contrib/download_prerequisites
cd $WORK_DIR
mkdir -p $BUILD_GCC_DIR
cd $BUILD_GCC_DIR
$SOURCE_GCC_DIR/configure --prefix=$INSTALL_DIR --enable-languages=c,c++
make -j $(sysctl -n hw.availcpu) CFLAGS="-mmacosx-version-min=$MIN_OSX_VERSION" && make install
find $INSTALL_DIR -name '*.a' -print0 | xargs -0 -n1 ranlib
rm -Rf $BUILD_GCC_DIR
rm -Rf $BUILD_BINUTILS_DIR
rm -Rf $SOURCE_GCC_DIR
rm -Rf $SOURCE_BINUTILS_DIR
The ranlib step was necessary due to numerous errors during the process of building a library.
To build an i386 binary, I had to do the following with my Makefile:
ARCH = i386
...
GCCDIR = ${PARTY3}/gcc-4.7.2-darwin
GCCBINDIR = ${GCCDIR}/bin
GCCLIBDIR = ${GCCDIR}/lib
GCCINCDIR = ${GCCDIR}/include
...
LIBCPP = libgcc_eh.a
LIBCXX = libstdc++.a
...
INCLUDES = -I${GCCINCDIR} ...
...
CC = ${GCCBINDIR}/gcc
CXX = ${GCCBINDIR}/g++
...
GCCCPPLIBPATH = ${GCCLIBDIR}/gcc/x86_64-apple-darwin12.3.0/4.7.2/${ARCH}/${LIBCPP}
GCCCXXLIBPATH = ${GCCLIBDIR}/${ARCH}/${LIBCXX}
...
FLAGS = ${SFLAGS} ${NONSTATICFLAGS} ${OBJS} -L${GCCLIBDIR} ...
...
run: dependencies
mkdir -p ${BIN} && ${CXX} -o ${BIN}/${PROG}_${ARCH} ${FLAGS} -static-libgcc -mmacosx-version-min=${MIN_OSX_VERSION} -arch ${ARCH} ... ${GCCCPPLIBPATH} ${GCCCXXLIBPATH} ${SOURCE1}
Summary of Makefile changes:
I had to add the -static-libgcc flag and leave out -static-libstdc++, which had no effect (except to cause the build to fail, until I ran ranlib on the static libraries, which fixed the build failure but had no effect on -static-libstdc++).
I added ${GCCCPPLIBPATH} and ${GCCCXXLIBPATH} to the run target, which each point to the static C anc C++ libraries libgcc_eh.a and libstdc++.a, respectively.
This allowed me to compile a working i386 (32-bit) binary, but the same GCC installation failed to build a working x86_64 (64-bit) binary.
After thinking about this a little, it occurs to me that by far the easiest solution would be to compile GCC for x86_64, and then to just pass -m32 when you wish to build for i386. Is that not sufficient for your needs for some reason? Building in this manner is dramatically simpler, and doesn't require any of the madness described below. Doing the following sequence of events results in a working compiler that will spit out i386 binaries when requested:
WORK_DIR=$PWD
INSTALL_DIR=$WORK_DIR/install
curl -O http://ftp.gnu.org/gnu/binutils/binutils-2.23.2.tar.bz2
tar xjvf binutils-2.23.2.tar.bz2
mkdir build-binutils && cd build-binutils
../binutils-2.23.2/configure --prefix=$INSTALL_DIR
make -j $(sysctl -n hw.availcpu) all CFLAGS='-Wno-error' && make install
find $INSTALL_DIR -name '*strip*' -delete
cd $WORK_DIR
curl -O http://ftp.gnu.org/pub/gnu/gcc/gcc-4.7.2/gcc-4.7.2.tar.bz2
tar xvjf gcc-4.7.2.tar.bz2
cd gcc-4.7.2
sed -i '' -e 's/wget/curl -O/g' ./contrib/download_prerequisites
./contrib/download_prerequisites
cd ..
mkdir build-gcc && cd build-gcc
../gcc-4.7.2/configure --prefix=$INSTALL_DIR --enable-languages=c,c++
make -j $(sysctl -n hw.availcpu) && make install
Once this completes you can see it in action like so:
mrowe#falcon:~/tmp$ cat > test.cpp
#include <iostream>
int main(int argc, char **argv) {
std::cerr << "Built with GCC 4.7" << std::endl;
return 0;
}
^D
mrowe#falcon:~/tmp$ ./install/bin/g++ -o test test.cpp
mrowe#falcon:~/tmp$ file test
test: Mach-O 64-bit executable x86_64
mrowe#falcon:~/tmp$ ./install/bin/g++ -m32 -static-libgcc -static-libstdc++ -o test test.cpp
mrowe#falcon:~/tmp$ file test
test: Mach-O executable i386
mrowe#falcon:~/tmp$ otool -L ./test
./test:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1192.0.0)
mrowe#falcon:~/tmp$ ./test
Built with GCC 4.7
mrowe#falcon:~/tmp$
If you see warnings like:
ignoring file …/4.7.2/i386/libgcc.a, file was built for archive which is not the architecture being linked (i386)
You can fix them by running ranlib on the static libraries:
find $INSTALL_DIR -name '*.a' -print0 | xargs -0 -n1 ranlib
Below is my attempt at helping you along the path you were attempting to follow. I don't think it's the ideal approach and it is fraught with problems.
The error you reported seeing is due to your GCC build trying to use the GNU assembler from binutils when the generated assembly is intended to be assembled with the GNU assembler from Apple's cctools. The dialect of assembly that is supported differs between the two as Apple's assembler diverged from the upstream GNU assembler many years ago.
All of the instructions I was able to find for building cctools were out of date so I experimented until I got something working. I did something close to the following:
curl -O http://opensource.apple.com/tarballs/cctools/cctools-829.tar.gz
tar xvzf cctools-829.tar.gz
cd cctools-829
You'll then need to patch two files in order to build without a dependency on LLVM:
diff -ru cctools-829/libstuff/lto.c cctools-829.modified/libstuff/lto.c
--- cctools-829/libstuff/lto.c 1969-12-31 16:00:00.000000000 -0800
+++ cctools-829.modified/libstuff/lto.c 2013-04-05 03:18:34.000000000 -0700
## -376,4 +376,18 ##
lto_dispose(mod);
}
+#else
+
+#include <stdlib.h>
+
+__private_extern__
+int
+is_llvm_bitcode(
+ struct ofile *ofile,
+ char *addr,
+ size_t size)
+{
+ return 0;
+}
+
#endif /* LTO_SUPPORT */
diff -ru cctools-829/misc/libtool.c cctools-829.modified/misc/libtool.c
--- cctools-829/misc/libtool.c 1969-12-31 16:00:00.000000000 -0800
+++ cctools-829.modified/misc/libtool.c 2013-04-05 03:20:21.000000000 -0700
## -1369,8 +1369,11 ##
}
}
}
- else if(ofiles[i].arch_type == OFILE_Mach_O ||
- ofiles[i].arch_type == OFILE_LLVM_BITCODE){
+ else if(ofiles[i].arch_type == OFILE_Mach_O
+#ifdef LTO_SUPPORT
+ || ofiles[i].arch_type == OFILE_LLVM_BITCODE
+#endif
+ ){
if(cmd_flags.ranlib == TRUE){
error("for architecture: %s file: %s is not an "
"archive (no processing done on this file)",
And then build:
make install USE_DEPENDENCY_FILE=NO BUILD_DYLIBS=NO LTO= TRIE= DSTROOT=../build-cctools
And install the necessary parts of by hand:
cd ..
cp build-cctools/usr/bin/as i386-apple-gcc/bin/i386-apple-darwin-as
cp build-cctools/usr/bin/as i386-apple-gcc/i386-apple-darwin/bin/as
cp build-cctools/usr/bin/lipo i386-apple-gcc/bin/i386-apple-darwin-lipo
cp build-cctools/usr/bin/lipo i386-apple-gcc/i386-apple-darwin/bin/lipo
cp build-cctools/usr/bin/strip i386-apple-gcc/bin/i386-apple-darwin-strip
cp build-cctools/usr/bin/strip i386-apple-gcc/i386-apple-darwin/bin/strip
If we then attempt to build GCC once more we'll discover that the build process is upset because our freshly-built assembler is unable to target x86_64. Since that doesn't seem relevant to what you're trying to achieve you can add the --disable-multilib argument to GCC's configure script to prevent it from trying that.
At this point I ran in to errors while attempting to build libgcc. These errors are because a suitable linker cannot be found, so I guess that now you'd need to download and build ld64 too.
And it's at this point that I've run out of time to make it any further. Good luck!
I've been doing a lot of cross-compiling of different libraries for iOS and until iOS5 there was no problem. Ok, apparently my problem is, that the iOS5 SDK does not include the GNU gcc compiler any more. Only llvm and clang are available.
My problem is, that I cannot finish to run the 'configure' script of any library any more. It always fails with:
configure: error: C preprocessor
"/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc" fails sanity check
gcc only is a symbolic link to the llvm compiler. If I set it to clang, it produces the same error. (Just with a nicer syntax error representation)
Here the important part of config.log:
configure:3338: checking how to recognise dependent libraries
configure:3514: result: pass_all
configure:3993: checking how to run the C preprocessor
configure:4111: result: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
configure:4135: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -B/Developer/Platforms/iPhoneOS.platform/Developer/usr -arch armv7 -miphoneos-version-min=5.0 -gdwarf-2 -mthumb -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/system conftest.c
conftest.c:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'error'
configure:4141: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME "expat"
| #define PACKAGE_TARNAME "expat"
| #define PACKAGE_VERSION "2.0.1"
| #define PACKAGE_STRING "expat 2.0.1"
| #define PACKAGE_BUGREPORT "expat-bugs#libexpat.org"
| /* end confdefs.h. */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
| Syntax error
configure:4135: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -B/Developer/Platforms/iPhoneOS.platform/Developer/usr -arch armv7 -miphoneos-version-min=5.0 -gdwarf-2 -mthumb -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk -L/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/usr/lib/system conftest.c
conftest.c:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'error'
configure:4141: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME "expat"
| #define PACKAGE_TARNAME "expat"
| #define PACKAGE_VERSION "2.0.1"
| #define PACKAGE_STRING "expat 2.0.1"
| #define PACKAGE_BUGREPORT "expat-bugs#libexpat.org"
| /* end confdefs.h. */
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
| Syntax error
configure:4210: error: C preprocessor "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc" fails sanity check
See `config.log' for more details.
Here's my environment. A little overkill, but it worked fine with iOS4.X.
# Defines
DEVROOT=/Developer/Platforms/iPhoneOS.platform/Developer
SDKROOT=$DEVROOT/SDKs/iPhoneOS5.0.sdk
# BUILD STUFF
export CXXFLAGS="-B/Developer/Platforms/iPhoneOS.platform/Developer/usr -arch armv7 -miphoneos-version-min=5.0 -gdwarf-2 -mthumb -isysroot $SDKROOT -L$SDKROOT/usr/lib/system"
export CPPFLAGS="$CXXFLAGS"
export CFLAGS="$CXXFLAGS"
export CPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
export CXXCPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++
#export CXX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++
export CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
export LD=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ld
export RANLIB=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ranlib
export AR=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar
export STRIP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/strip
export LIBTOOL=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/libtool
export INSTALL_DIR=/Users/mriedel/MPI/CrossCompiling/armv7_dev_install
export CPATH=$INSTALL_DIR/include
export LIBRARY_PATH=$INSTALL_DIR/lib
I've been trying to figure this out for weeks, but no luck. I feel other people must have come across this problem. But Google did not bring up anything. For a time, I tried to use the gas-preprocessor.pl, but also without any luck.
Ah, my configure calls are always similar to this:
./configure --prefix=$INSTALL_DIR --disable-shared --enable-static --host=arm-apple-darwin
I want to point out that this exact problem happens with all my libraries that use configure scrips. To name a few: apr, apr-util, expat, log4cxx etc... I'm not even sure what the desired output should be. There's just a weirdly placed 'Syntax error' in the middle of the code. No wonder it does not compile :).
Help and tips on how to proceed would be greatly appreciated.
Thanks.
I ran into the same issue. After some poking, my problem turned out to be that I was setting CPP explicitly. Don't set that (and in fact, 'unset' it if it's set). If it's not set, configure tries $CC -E by default. If it is set, configure doesn't add the -E automatically. Also, setting CPPFLAGS to -E doesn't work, because these flags are also passed to other steps.