I'm trying to compile gcc 4.x on osx 10.11 (mainly focusing around 4.9.2 and 4.9.3). No matter what I do, I can't get it to build properly, it always errors out somewhere. Using 5.x is not an option, and neither is using gcc from brew or macports.
I've got Xcode 7.2 and Command Line Tools installed (and updated). The following has worked fine for me on previous versions of osx (such as 10.9, but not sure about 10.10). Here's what I'm using to build it:
cd gcc-4.9.2
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.9.2/configure --prefix=/usr/local/gcc-4.9.2
make
make install
Here's how this errors out (with a lot more ptrdiff_t errors as well):
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1854:29: error: use of undeclared identifier 'ptrdiff_t'
const ptrdiff_t __m = (~ptrdiff_t(0) ^
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[3]: *** [graphite.o] Error 1
make[3]: *** Waiting for unfinished jobs....
20 errors generated.
make[3]: *** [graphite-blocking.o] Error 1
20 errors generated.
20 errors generated.
make[3]: *** [graphite-clast-to-gimple.o] Error 1
make[3]: *** [graphite-dependences.o] Error 1
20 errors generated.
make[3]: *** [graphite-interchange.o] Error 1
13 warnings generated.
/bin/sh /usr/local/src/objdir/../gcc-4.9.2/gcc/../move-if-change tmp-attrtab.c insn-attrtab.c
/bin/sh /usr/local/src/objdir/../gcc-4.9.2/gcc/../move-if-change tmp-dfatab.c insn-dfatab.c
/bin/sh /usr/local/src/objdir/../gcc-4.9.2/gcc/../move-if-change tmp-latencytab.c insn-latencytab.c
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2
So, I guess the question here is if anyone knows any tricks to getting gcc 4.x to build on 10.11. Or if not, any advice for figuring out what's going on here. I've tried searching for days and haven't come up with much of anything. Not really sure how to approach this. I can definitely post more relevant info if needed (just not sure what's relevant).
tar xf gcc-4.9.3.tar.bz2
cd gcc-4.9.3
#fix - os x got now wget
sed -i.bak 's/wget/curl -O/g' contrib/download_prerequisites
./contrib/download_prerequisites
# this fixes your problem !!!!
sed -i.bak '/__need_size_t/d' gmp/gmp-h.in
mkdir build
cd build
#for example
../configure --target=x86_64-apple-darwin15.5.0 --build=x86_64-apple- darwin15.5.0 \
--prefix=/usr/local --program-suffix=-4.9 \
--enable-languages=c,c++ --with-system-zlib --enable-libstdcxx-time=yes \
--enable-stage1-checking --enable-checking=release --enable-lto \
--disable-multilib --disable-nls
Related
I want to compile gcc10.1 in a master node of a cluster. When i execute make, i get an error: cc1: internal compiler error: Segmentation fault 0x12b2b57 crash_signal
The protocol of compilation and the error are shown below.
1. cd gcc-10.1.0
2. ./contrib/download_prerequisites
3. mkdir build-by-wangshuai install-by-wangshuai
4. cd build-by-wangshuai
5. ../configure --disable-multilib --prefix=/data/yiming-wangshuai/software/gcc-10.1.0/install-by-wangshuai
6. make VERBOSE=1
Then i get an error (i copy the end information output from "make VERBOSE=1"):
...
...
mv tmp2-tm.texi tmp-tm.texi
/bin/sh ../../gcc/../move-if-change tmp-tm.texi tm.texi
cp doc/gcc.1 doc/g++.1
/data/yiming-wangshuai/software/gcc-10.1.0/build-by-wangshuai/./gcc/xgcc -B/data/yiming-
wangshuai/software/gcc-10.1.0/build-by-wangshuai/./gcc/ -xc -nostdinc /dev/null -S -o
/dev/null -fself-test=../../gcc/testsuite/selftests
cc1: internal compiler error: Segmentation fault
0x12b2b57 crash_signal
../../gcc/toplev.c:328
0x7fbd8894dfef ???
/root/glibc-2.23/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x7fbd88941195 __gconv_transform_utf8_internal
../iconv/skeleton.c:665
0x7fbd8893c5b1 __gconv
/root/glibc-2.23/iconv/gconv.c:79
0x7fbd8893be20 iconv
/root/glibc-2.23/iconv/iconv.c:52
0x23ea6ab convert_using_iconv
../../libcpp/charset.c:579
0x23efdd5 cpp_interpret_string_1
../../libcpp/charset.c:1728
0x23effca cpp_interpret_string(cpp_reader*, cpp_string const*, unsigned long, cpp_string*, cpp_ttype)
../../libcpp/charset.c:1784
0x23de858 test_lexer_string_locations_ebcdic
../../gcc/input.c:2507
0x23e3d85 selftest::for_each_line_table_case(void (*)(selftest::line_table_case const&))
../../gcc/input.c:3571
0x23e4e53 selftest::input_c_tests()
../../gcc/input.c:3710
0x22d7111 selftest::run_tests()
../../gcc/selftest-run-tests.c:84
0x12b62ab toplev::run_self_tests()
../../gcc/toplev.c:2337
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
make[3]: *** [s-selftest-c] Error 1
make[3]: Leaving directory `/data/yiming-wangshuai/software/gcc-10.1.0/build-by-wangshuai/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/data/yiming-wangshuai/software/gcc-10.1.0/build-by-wangshuai'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/data/yiming-wangshuai/software/gcc-10.1.0/build-by-wangshuai'
make: *** [all] Error 2
Next, i introduce the configuration environment of the master node.
System: Centos 7.8
CPU: Intel(R) Xeon(R) Gold 5218R
GPU: Tesla V100s
Driver Version: 460.73.01 CUDA Version: 11.2
I am not sure how to diagnose and resolve this issue. Much appreciate if anyone can help me.
This is my first question in stack overflow and hope I make it clear.
I am trying to install a program (gmtsar) in fedora 32. However, the compilation was not complete and two errors return at the end.
I ran the following commands:
sudo -i
cd /usr/local
git clone --branch 6.0 https://github.com/gmtsar/gmtsar GMTSAR
cd GMTSAR
autoconf
./configure --with-orbits-dir=/usr/local/orbits
make
make install
after make and mak install the following errors return:
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:44: envi_slc_decode] Error 1
make[2]: Leaving directory '/usr/local/GMTSAR/preproc/ENVI_preproc/ENVI_SLC_decode'
make[1]: *** [Makefile:8: all] Error 2
make[1]: Leaving directory '/usr/local/GMTSAR/preproc/ENVI_preproc'
make: *** [Makefile:37: preprocess] Error 2
I followed the same procedures in ubuntu 16.04 and the compilation was complete without errors.
Can anyone help me understand why I got these errors and how to fix them, please?
I'm an inexperienced programmer so bear with me if this little sense. I'm trying to run a basic "hello world" kind of program in CLion, except I'm trying to print out a value in the main.cpp file from a header and cpp file. I'm using MacOS and everything is update in terms of software. When I try to build or run the program, it gives me these errors:
====================[ Build | untitled1 | Debug ]===============================
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/anshuldaga/untitled1/cmake-build-debug --target untitled1 -- -j 2
[ 33%] Building CXX object CMakeFiles/untitled1.dir/main.cpp.o
[ 66%] Building CXX object CMakeFiles/untitled1.dir/test.cpp.o
make[3]: /Library/Developer/CommandLineTools/usr/bin/c++: Permission denied
make[3]: /Library/Developer/CommandLineTools/usr/bin/c++: Permission denied
make[3]: *** [CMakeFiles/untitled1.dir/main.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [CMakeFiles/untitled1.dir/test.cpp.o] Error 1
make[2]: *** [CMakeFiles/untitled1.dir/all] Error 2
make[1]: *** [CMakeFiles/untitled1.dir/rule] Error 2
make: *** [untitled1] Error 2
I've already tried running the sudo g++ main.cpp command and it gives me this error:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Based off my research, I know that clang is the compiler for c++ and a linker error is basically when something can't find the right files or library.
I've uninstalled and reinstalled Xcode, did the
sudo xcode-select -switch /Library/Developer/CommandLineTools/
command. I'm not sure what to do at this point. Any help would be greatly appreciated, thank you!
According to this(archive.org) old post from the CLion forum, the xcode license agreement might be the issue. Try to start xcode and agree to the license, or run sudo xcodebuild -license.
I'm trying to build glibc 2.27 as a static library from sources on Ubuntu 18.04. This is the command I am using(after making a separate build directory for glibc):
$ git clone git://sourceware.org/git/glibc.git && cd glibc
$ git checkout release/2.27/master
$ cd ..
$ mkdir glibc-build && cd glibc-build
$ ../glibc/configure --enable-kernel=4.4 --disable-shared --enable-static --enable-static-nss --prefix=/usr
$ make
make results in this error:
cc1: fatal error: /home/parallels/glibc-build/libc-modules.h: No such file or directory
compilation terminated.
../Makerules:281: recipe for target '/home/parallels/glibc-build/ucontext_i.h' failed
make[2]: *** [/home/parallels/glibc-build/ucontext_i.h] Error 1
make[2]: Leaving directory '/home/parallels/glibc/csu'
Makefile:215: recipe for target 'csu/subdir_lib' failed
make[1]: *** [csu/subdir_lib] Error 2
make[1]: Leaving directory '/home/parallels/glibc'
Makefile:9: recipe for target 'all' failed
make: *** [all] Error 2
Full log for make
I am running Ubuntu 18.04 and am using the preinstalled versions of gcc and make.
This is a known issue:
Unable to build GLIBC with --disable-shared
In general, this is not a problem because a default build (without --disable-shared) builds both the static and dynamically linked version of the library, and make install DESTDIR=… installs both.
After downloading the package of GNU Binutils 2.25
I followed the instructions on "Installing Binutils":
./cnofigure
make
errors happened after build:
../../binutils-gdb/binutils/nm.c:1733:28: error: 'sbrk' is deprecated [-Werror,-Wdeprecated-declarations]
char *lim = (char *) sbrk (0);
/usr/include/unistd.h:582:7: note: 'sbrk' has been explicitly marked deprecated here
void *sbrk(int);
1 error generated.
make[4]: *** [nm.o] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-binutils] Error 2
make: *** [all] Error 2
I did some research on net and they said using this command
./configure --prefix=/usr --disable-werror
and I get
/Library/Developer/CommandLineTools/usr/bin/make all-recursive
make[8]: Nothing to be done for 'all-am'.
make[1]: Nothing to be done for 'all-target'.
(what does that mean "nothing to be done for all-am and all-target")
I don't know what to do anymore.
Is it a bug or it's me doing something wrong?
Please help.
You really would make life easier for yourself if you used homebrew as a package manager on OSX.
Goto the homebrew website and copy and paste the one-line install script into your Terminal.
Then you can install binutils simply by typing
brew install binutils
If, down the line, you want to find GNU sed, or ImageMagick, you can just do
brew search sed
or
brew search imagemagick
then
brew install sed
If you have any problems, just run
brew doctor
If you want to update all your packages, just run
brew update
brew upgrade --all
More cool ideas and suggestions here.
After build failure , you should clean previously generated object files
So,
make clean
./configure --prefix=/usr --disable-werror
make