Building GCC-4.9.2 on OS X Yosemite - macos

Ok, I'm having trouble building gcc-4.9.2 on Apple's new OS X Yosemite. I'm not sure if I need to be building a gnu-gcc compiler on OS X, as most other software has compiled fine, apart from tesseract-3.0.1 and some of my own wxWidgets applications. Are there certain programs/code features that clang can't compile?
My build steps are as follows:
cd build-gcc
../gcc-4.9.1/configure --program-prefix="gnu-" --prefix="/usr/local/gcc-4.9.1" --with-gmp="/usr/local" --with-mpfr="/usr/local" --with-mpc="/usr/local" CC=clang CXX=clang++
make
My build path and gcc source paths do not contain any whitespace, and I have installed GMP, MPFR and MPC in /usr/local.
My build outputs are:
clang++ -g -DIN_GCC -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -Wl,-no_pie -o cc1 c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c/c-array-notation.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-cilkplus.o c-family/array-notation-common.o c-family/cilk.o c-family/c-ubsan.o i386-c.o darwin-c.o \
cc1-checksum.o libbackend.a main.o tree-browser.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ./../intl/libintl.a -liconv ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib -lmpc -lmpfr -lgmp -L../zlib -lz
ld: warning: ld: warning: ld: warning: ignoring file libbackend.a, file was built for archive which is not the architecture being linked (x86_64): libbackend.aignoring file libcommon-target.a, file was built for archive which is not the architecture being linked (x86_64): libcommon-target.aignoring file ../libdecnumber/libdecnumber.a, file was built for archive which is not the architecture being linked (x86_64): ../libdecnumber/libdecnumber.a
ld: warning: ignoring file ../zlib/libz.a, file was built for archive which is not the architecture being linked (x86_64): ../zlib/libz.a
Undefined symbols for architecture x86_64:
... (Lots of symbols)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [cc1] Error 1
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2
Configure outputs the build type as: x86_64-apple-darwin14.0.0, so I don't understand why this is happening.
Thank You in advance for any help.

Turns out that I had a broken ranlib in /usr/local/bin - maybe GNU Binutils don't work on OS X? All I needed to do to fix the problem was to:
sudo mv /usr/local/bin/ranlib /usr/local/ranlib_old
and then make, and now I have a working GCC!

Related

sqlcipheron MacOS HighSierra build error

I build sqlcipher from github repository on MacOS :
9429:sqlcipher administrator$ ./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_ENABLE_UNLOCK_NOTIFY"
checking build system type... i386-apple-darwin17.4.0
...
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing libtool commands
9429:sqlcipher administrator$ make
./libtool --mode=link gcc -DSQLITE_HAS_CODEC -DSQLCIPHER_CRYPTO_OPENSSL -DSQLITE_OS_UNIX=1 -I. -I/Users/administrator/pjx/sqlcipher/src -I/Users/administrator/pjx/sqlcipher/ext/rtree -I/Users/administrator/pjx/sqlcipher/ext/icu -I/Users/administrator/pjx/sqlcipher/ext/fts3 -I/Users/administrator/pjx/sqlcipher/ext/async -I/Users/administrator/pjx/sqlcipher/ext/session -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -DNDEBUG -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_UNLOCK_NOTIFY -no-undefined -o libsqlcipher.la sqlite3.lo -lcrypto \
-rpath "/usr/local/lib" -version-info "8:6:8"
libtool: link: gcc -dynamiclib -o .libs/libsqlcipher.0.dylib .libs/sqlite3.o -lcrypto -install_name /usr/local/lib/libsqlcipher.0.dylib -compatibility_version 9 -current_version 9.6 -Wl,-single_module
Undefined symbols for architecture x86_64:
"_HMAC_CTX_free", referenced from:
_sqlcipher_openssl_hmac in sqlite3.o
"_HMAC_CTX_new", referenced from:
_sqlcipher_openssl_hmac in sqlite3.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libsqlcipher.la] Error 1
What's my mistake?
What is "_HMAC_CTX_free" error ?
I had the same problem. The solution is to compile with OpenSSL statically.
You need to give the static library in the ./configure command!
./configure --enable-tempstore=yes \
CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_ENABLE_UNLOCK_NOTIFY"\
LDFLAGS="/usr/local/lib/libcrypto.a"
make
Don't forget to link the right library libcrypto.a

Linking argp library for gcc on OSX

I am having pretty much the same problem as in this question
Undefined symbols argp_parse and arpg_usage when installing rng-tools on OSX
but it's a different project. It seems the problem was solved by linking in argp, which I installed with homebrew. However, I can't link it properly. This is the error, where you can see how I've tried to link argp-standalone with -L.
gcc -std=gnu99 -pedantic -Wall -Wextra -Wmissing-prototypes -DRESDIR=\"/usr/local/share/tsim\"
-g -O2 -L/usr/local/opt/argp-standalone/lib -L/usr/X11R6/lib -lXaw -lXt -lXmu -lX11 -lXext
-o tsim tsim-AddToggleWidget.o tsim-DialogPopup.o tsim-file.o tsim-resources.o tsim-timer.o
tsim-tsim.o tsim-bitmap.o tsim-DrawingPalette.o tsim-Graph.o tsim-sound.o tsim-train.o
tsim-BitmapDirectory.o tsim-errcheck.o tsim-pipe.o tsim-Sprite.o tsim-tsim_argp.o
Undefined symbols for architecture x86_64:
"_argp_parse", referenced from:
_parse in tsim-tsim_argp.o
"_argp_usage", referenced from:
_parse_opt in tsim-tsim_argp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [tsim] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

CUDA, OSX, MPI symbol(s) not found for architecture x86_64

Helllo, I have some code, that I'm trying to compile. The code runs well on Linux but I can't compile it on OSX.
In the makefile I use for Linux:
LD_FLAGS = -lcudart -L$(CUDA_HOME)/lib64
For Mac I try to use these flags:
LD_FLAGS = -lcudart -L$(CUDA_HOME)/lib
LD_FLAGS = -lm -F/Library/Frameworks -framework CUDA
CXXFLAGS = -O3 -g -m32 -I$(CUDA_HOME)/include
NVCC_FLAGS = -O3 -g -G -I$(CUDA_HOME)/include -arch=sm_11
This is the make output file:
mpic++ -c -o main.o main.cpp -O3 -m32 -I/Developer/NVIDIA/CUDA-5.0/include
/Developer/NVIDIA/CUDA-5.0/bin/nvcc -c -o kernel.o kernel.cu -O3 -I/Developer/NVIDIA/CUDA-5.0/include -arch=sm_11
ptxas /tmp/tmpxft_000026f4_00000000-5_kernel.ptx, line 146; warning : Double is not supported. Demoting to float
/Developer/NVIDIA/CUDA-5.0/bin/nvcc -c -o support.o support.cu -O3 -I/Developer/NVIDIA/CUDA-5.0/include -arch=sm_11
mpic++ main.o kernel.o support.o -o stencil-mpi -lcudart -L/Developer/NVIDIA/CUDA-5.0/lib
ld: warning: ld: warning: ignoring file kernel.o, file was built for i386 which is not the architecture being linked (x86_64): kernel.o
ignoring file main.o, file was built for i386 which is not the architecture being linked (x86_64): main.o
ld: warning: ignoring file support.o, file was built for i386 which is not the architecture being linked (x86_64): support.o
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [stencil-mpi] Error 1
This problem was caused by trying to mix 32 and 64 bit compilation between the CUDA and MPI toolchains. It was noted in comments that adding -m64 instead of -m32 for LD_FLAGS, CXXFLAGS, and NVCC_FLAGS produced a working 64 bit build.

cloog and ppl error (graphite-ppl.c) in GCC 4.6.2 installation

I'm trying to install gcc 4.6.2 with ppl and cloog in 64 bit ubuntu 10.10. I get the following error when I do make.
make[3]: Entering directory `/home/praveen/gcc-4.6.2/host-x86_64-unknown-linux-gnu/gcc'
/home/praveen/gcc-4.6.2/host-x86_64-unknown-linux-gnu/prev-gcc/xgcc -B/home/praveen/gcc-4.6.2/host-x86_64-unknown-linux-gnu/prev-gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include -g -O2 -gtoggle -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc -o cc1 c-lang.o c-family/stub-objc.o attribs.o c-errors.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-objc-common.o c-parser.o tree-mudflap.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o i386-c.o \
cc1-checksum.o main.o libbackend.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a ../libcpp/libcpp.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -lcloog -lppl_c -lppl -lpwl -lgmpxx -lmpc -lmpfr -lgmp -rdynamic -ldl -L../zlib -lz
libbackend.a(graphite-ppl.o): In function `ppl_powerset_is_empty':
graphite-ppl.c:(.text+0xd5d): undefined reference to `ppl_new_PIP_Problem_from_constraints'
graphite-ppl.c:(.text+0xd66): undefined reference to `ppl_PIP_Problem_is_satisfiable'
graphite-ppl.c:(.text+0xd71): undefined reference to `ppl_delete_PIP_Problem'
collect2: ld returned 1 exit status
make[3]: *** [cc1] Error 1
make[3]: Leaving directory `/home/praveen/gcc-4.6.2/host-x86_64-unknown-linux-gnu/gcc'
make[2]: *** [all-stage2-gcc] Error 2
make[2]: Leaving directory `/home/praveen/gcc-4.6.2'
make[1]: *** [stage2-bubble] Error 2
make[1]: Leaving directory `/home/praveen/gcc-4.6.2'
make: *** [all] Error 2
Can some one help me out on this ?
I faced the same problem a while ago on my gentoo installation. The workarround was to build gcc without graphite option then to rebuild ppl and cloog-ppl libraries with a new version of gcc. Only after that gcc was successfully built with graphite.
The problem, I believe, is that the ppl library libppl_c.so.4 is reported by make to be non-existent during the linking process -- even if the library has been installed to the standard /usr/local/lib directory successfully. Try reconfiguring with the flag --with-ppl-lib. I also included the flag --with-ppl-include and the corresponding cloog flags too (just to pre-empt any possible corresponding problems with cloog) because I didn't want to have to keep recompiling to discover exactly which flags I needed, so I played it cautiously and included all of these; maybe you also need them too, but probably not. Whilst you should be able to just use the flag --with-ppl, that will not work.
# I installed ppl and cloog to the standard subdirectories of /usr/local
# but you can amend the flag inputs as necessary
tar xjf gcc-x.tar.bz2
mkdir build && cd build
../gcc-x/configure --with-ppl-lib=/usr/local/lib \
--with-ppl-include=/usr/local/include \
--with-cloog-lib=/usr/local/lib \
--with-cloog-include=/usr/local/include
Again, the issue is probably that the non-existence of the --with-ppl-lib flag is setting some internal configure variable incorrectly rather than there being a general linking issue with the library.

ERROR while installing rb-appscript

Got a big problem installing rb-appscript.
I already installed the latest Version of xCode & I'm running Lion.
Hope you can help me, thanks a lot!
This is the Error Message:
sudo gem install rb-appscript
Building native extensions. This could take a while...
ERROR: Error installing rb-appscript:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
create /usr/local/lib/ruby/gems/1.8/gems/rb-appscript-0.6.1/src/osx_ruby.h ...
create /usr/local/lib/ruby/gems/1.8/gems/rb-appscript-0.6.1/src/osx_intern.h ...
creating Makefile
make
Makefile:188: warning: overriding commands for target `/usr/local/lib/ruby/gems/1.8/gems/rb-appscript-0.6.1/lib'
Makefile:182: warning: ignoring old commands for target `/usr/local/lib/ruby/gems/1.8/gems/rb-appscript-0.6.1/lib'
gcc -I. -I/usr/local/lib/ruby/1.8/i686-darwin9.7.0 -I/usr/local/lib/ruby/1.8/i686-darwin9.7.0 -Isrc -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -D_XOPEN_SOURCE=1 -fno-common -pipe -fno-common -Wall -c src/rbae.c
gcc -I. -I/usr/local/lib/ruby/1.8/i686-darwin9.7.0 -I/usr/local/lib/ruby/1.8/i686-darwin9.7.0 -Isrc -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -D_XOPEN_SOURCE=1 -fno-common -pipe -fno-common -Wall -c src/SendThreadSafe.c
cc -dynamic -bundle -undefined suppress -flat_namespace -o ae.bundle rbae.o SendThreadSafe.o -L. -L/usr/local/lib -L. -framework Carbon -framework ApplicationServices -lruby -lpthread -ldl -lobjc
ld: warning: ignoring file /usr/local/lib/libruby.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: in /usr/local/lib/libxml2.2.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64) for architecture x86_64
collect2: ld returned 1 exit status
make: *** [ae.bundle] Error 1
Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/rb-appscript-0.6.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/rb-appscript-0.6.1/./gem_make.out
Seems like something is wrong with your Ruby install. It complains about a wrong architecture here
ld: warning: ignoring file /usr/local/lib/libruby.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: in /usr/local/lib/libxml2.2.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64) for architecture x86_64
Be sure your ruby is installed right. For a super-easy Ruby installation, I would recommend the Ruby Version Manager -> https://rvm.io

Resources