why disable-shared in gcc 4.7 build together with gmp mpfr mpc for native compile? - gmp

enviroment:
cpu: XEON NEHALEM E5530
os: SUSE 10 SP2
gcc: 4.1.2
m4,binutils,autoconf,automake: UPDATED newest for required by gcc 4.7 build.
PATH/LD_LIBRARY_PATH set correct.
object: native optimization for gcc php httpd.
with -march=nocona -O2 -pipe -fomit-frame-pointer
gcc 4.1.2 gmp,mpfr,mpc OK
gcc 4.1.2 gcc4.7 with gmp,mpfr,mpc OK
with -march=native -O2 -pipe -fomit-frame-pointer
gcc 4.7 gmp,mpfr,mpc OK
gcc 4.7 gcc4.7 with gmp,mpfr,mpc OK
newest built gcc 4.7
gcc 4.7 ppl,cloog OK
gcc 4.7 build source tree together with gmp,mpfr,mpc,ppl,cloog
error in configure ppl because not found gmp library.
gcc 4.7 build source tree for native compile together with gmp,mpfr,mpc without ppl and cloog OK
But disable-shared added by system through checking config.log in subdirectories, though explicitly gcc 4.7 configure --enable-shared --disable-static.
Configure parameters in ppl are not listed in ppl's configure help.

But disable-shared added by system through checking config.log in subdirectories, though explicitly gcc 4.7 configure --enable-shared --disable-static
gcc builds in several stages. Early stages use --disable-shared switch regardless.

Related

how to install g++ 4 on CentOS 8

Have some legacy C++ software that can only be compiled using g++ 4. How to install g++ 4 on CentOS 8 machine?
Found a lot of references to upgrade g++ in CentOS 6/7. But CentOS 8 seems totally different. E.g. can't find ways to access centos-release-scl and devtoolset-4 yum package.
Found a workaround for the legacy software issue.
Used the new default g++ compiler with option: -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++98
The resulting objects are ABI compatible with old libraries.

Apache Httpd Build from source: fatal error: expat.h: No such file or directory

I am trying to build Apache Server v 2.4.38 on RHEL 7.3 and I am using apr 1.6.5, apr-util 1.6.1, and pcre 8.42.
I am running following commands
./configure --with-included-apr --with-pcre=/data/abc/installed/pcre_installed --prefix=/data/abc/installed/httpd_installed
make
While running 'make' I am receiving error
/bin/sh /data/abc/installed/httpd-2.4.38/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/data/abc/installed/httpd-2.4.38/srclib/apr-util/include -I/data/abc/installed/httpd-2.4.38/srclib/apr-util/include/private -I/data/abc/installed/httpd-2.4.38/srclib/apr/include -o xml/apr_xml.lo -c xml/apr_xml.c && touch xml/apr_xml.lo
xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
#include <expat.h>
Download expat-2.2.6.tar.bz2 from https://libexpat.github.io/.
Extract expat using following command
tar xvjf expat-2.2.6.tar.bz2 -C /path-to-dir
Change to the extracted expat directory.
Build expat using following commands
./configure --prefix=/path-to-expat-installation-dir
make
make install
While building Apache Httpd from source specify --with-expat
./configure --with-included-apr --prefix=/path-to-apache-installation --with-expat=/path-to-expat-installation-dir
For anyone else coming across this:
OP had to do this because they didn't have sudo access. If you do, usually you don't need to download the source of expat manually; installing via package manager is way easier. Unless the software you are compiling requires a newer version of expat than your RPM repos provide.
So for the RHEL family of OSes you can just do sudo <dnf|yum> install expat expat-devel, then proceed with what you were compiling.
Do you have the expat library installed? (Because that's where the expat.h comes from.)
https://libexpat.github.io/
If you cannot install it globally to the system, I'm sure Apache's ./configure script must have an option to support a custom location for the library as well.
Tried In Ubuntu
apt install libexpat1-dev
For RHEL, I would suggest #cyqsimon's answer

how to compile this cpp file that uses gmp with g++ cygwin

I followed all the instructions for setting up gmp with cygwin,
./configure make make install and make check.
The libgmp.a is in the path C:/C++/gmp-6.1.2/.libs
I'm using this command to compile with g++
g++ -L/C:/C++/gmp-6.1.2/.libs -I/C:/C++/gmp-6.1.2 C:/foo/foo.cpp -lgmp
I get an error message that says : could not find -lgmp
What am i missing?
Why not install the gmp from the cygwin distribution?

Check which version of g++ being used

I have both 32 and 64 bit g++ installed on my server and when compiling I want to make sure that I am compiling in 64 bit mode, when I do g++ --version I don't get information about which architecture package I installed, is there a way I can check command line with g++ to see if it is using the 64 bit version.
I need the 32 bit version for other dependencies so its not an option to remove that.
~$ g++ -dumpmachine
x86_64-linux-gnu

Installing Homebrew, libjpeg, and optipng for HTML5 Boilerplate build tool use

Dipping my toe into command prompts.. totally lost.
I've installed Homebrew, and attempted to install libjpeg and optipng via brew install libjpeg optipngand have run into errors. I'm not sure how exactly to describe them.. so here's the code! I'm in Terminal on a Mac running OSX 10.6.7
Thank you SO much for the help.
1961:~ Daniel$ brew install libjpeg optipng
==> Downloading http://www.ijg.org/files/jpegsrc.v8c.tar.gz
File already downloaded and cached to /Users/Daniel/Library/Caches/Homebrew
==> ./configure --prefix=/usr/local/Cellar/jpeg/8c --disable-dependency-tracking
checking build system type... i386-apple-darwin10.7.3
checking host system type... i386-apple-darwin10.7.3
checking target system type... i386-apple-darwin10.7.3
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... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... no
checking for style of include used by make... none
checking for gcc... /usr/bin/cc
checking whether the C compiler works... no
configure: error: in `/private/tmp/homebrew-jpeg-8c-42or/jpeg-8c':
configure: error: C compiler cannot create executables
See `config.log' for more details
==> Exit Status: 77
http://github.com/mxcl/homebrew/blob/master/Library/Formula/jpeg.rb#L11
==> Environment
HOMEBREW_VERSION: 0.8
HEAD: (none)
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_LIBRARY_PATH: /usr/local/Library/Homebrew
Hardware: 8-core 64-bit dunno
OS X: 10.6.7
Kernel Architecture: x86_64
Ruby: 1.8.7-174
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Xcode:
GCC-4.0: N/A
GCC-4.2: N/A
LLVM: build 2335
MacPorts or Fink? false
X11 installed? true
==> Build Flags
CC: /usr/bin/cc
CXX: /usr/bin/c++
LD: /usr/bin/cc
CFLAGS: -O3 -w -pipe -arch i386 -arch x86_64
CXXFLAGS: -O3 -w -pipe -arch i386 -arch x86_64
LDFLAGS: -arch i386 -arch x86_64
MAKEFLAGS: -j8
Error: Failed executing: ./configure --prefix=/usr/local/Cellar/jpeg/8c --disable-dependency-tracking
Please report this bug: https://github.com/mxcl/homebrew/wiki/new-issue
These existing issues may help you:
https://github.com/mxcl/homebrew/issues/#issue/4442
It looks like an autotools configure failed.
Consider re-running the install with '-vd' to keep 'config.log' around:
brew install -vd jpeg
Gist 'config.log' and any error output when reporting an issue.
Remember to include your config information: brew --config
Also try:
`brew doctor` to check your setup for common problems.
`brew missing` to check installed packages for missing deps.
1961:~ Daniel$ brew doctor
We couldn't detect gcc 4.2.x. Some formulae require this compiler.
We couldn't detect gcc 4.0.x. Some formulae require this compiler.
/usr/bin is in your PATH before Homebrew's bin. This means that system-
provided programs will be used before Homebrew-provided ones. This is an
issue if you install, for instance, Python.
Consider editing your .bashrc to put:
/usr/local/bin
ahead of /usr/bin in your $PATH.
Some brews install binaries to sbin instead of bin, but Homebrew's
sbin was not found in your path.
Consider editing your .bashrc to add:
/usr/local/sbin
to $PATH.
"Git" was not found in your path.
Homebrew uses Git for several internal functions, and some formulae
use Git checkouts instead of stable tarballs.
You may want to do:
brew install git
You have an "autoconf" in your path blocking the system version at:
Custom autoconf in general and autoconf 2.66 in particular has issues
and will cause some Homebrew formulae to fail.
1961:~ Daniel$ brew install git
==> Downloading http://kernel.org/pub/software/scm/git/git-1.7.5.tar.bz2
######################################################################## 100.0%
==> make prefix=/usr/local/Cellar/git/1.7.5 install
==> Exit Status: 1
http://github.com/mxcl/homebrew/blob/master/Library/Formula/git.rb#L31
==> Environment
HOMEBREW_VERSION: 0.8
HEAD: (none)
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_LIBRARY_PATH: /usr/local/Library/Homebrew
Hardware: 8-core 64-bit dunno
OS X: 10.6.7
Kernel Architecture: x86_64
Ruby: 1.8.7-174
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Xcode:
GCC-4.0: N/A
GCC-4.2: N/A
LLVM: build 2335
MacPorts or Fink? false
X11 installed? true
==> Build Flags
CC: /usr/bin/cc
CXX: /usr/bin/c++
LD: /usr/bin/cc
CFLAGS: -O3 -w -pipe
CXXFLAGS: -O3 -w -pipe
MAKEFLAGS: -j8
Error: Failed executing: make prefix=/usr/local/Cellar/git/1.7.5 install
Please report this bug: https://github.com/mxcl/homebrew/wiki/new-issue
Also try:
`brew doctor` to check your setup for common problems.
`brew missing` to check installed packages for missing deps.
1961:~ Daniel$ brew missing
1961:~ Daniel$ brew doctor
We couldn't detect gcc 4.2.x. Some formulae require this compiler.
We couldn't detect gcc 4.0.x. Some formulae require this compiler.
/usr/bin is in your PATH before Homebrew's bin. This means that system-
provided programs will be used before Homebrew-provided ones. This is an
issue if you install, for instance, Python.
Consider editing your .bashrc to put:
/usr/local/bin
ahead of /usr/bin in your $PATH.
Some brews install binaries to sbin instead of bin, but Homebrew's
sbin was not found in your path.
Consider editing your .bashrc to add:
/usr/local/sbin
to $PATH.
"Git" was not found in your path.
Homebrew uses Git for several internal functions, and some formulae
use Git checkouts instead of stable tarballs.
You may want to do:
brew install git
You have an "autoconf" in your path blocking the system version at:
Custom autoconf in general and autoconf 2.66 in particular has issues
and will cause some Homebrew formulae to fail.
Try downloading and installing the Xcode development suite: http://developer.apple.com/xcode/
That will provide gcc (complier) to build the software