binutils and gcc with LTO - c++

I have binutils-2.25.1 installed to /usr/local/binutils-2.25.1, configured with
../configure --prefix=/usr/local/binutils-2.25.1 --enable-plugins --enable-gold --disable-werror
And I want to build RPM package - gcc with LTO support that uses linker ld from /usr/local/binutils-2.25.1.
I try:
Summary: The GNU Compiler Collection
Name: gcc-custom
Version: 4.9.3
%define full_name gcc-%{version}
%define binutils_path /usr/local/binutils-2.25.1
Release: 0
...
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
%description
%prep
%setup -q -a0 -n %{full_name}
%build
AR=%{binutils_path}/bin/ar NM=%{binutils_path}/bin/nm RANLIB=#%{binutils_path}/bin/ranlib ./configure \
--prefix=/usr/local/%{full_name} \
--disable-multilib \
--enable-languages=c,c++ \
--enable-lto \
--enable-linker-build-id \
--enable-plugin \
--with-ld=%{binutils_path}/bin/ld \
--with-plugin-ld=%{binutils_path}/bin/ld \
--with-as=%{binutils_path}/bin/as
make
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
/usr/local/%{full_name}
%changelog
After installing this package I try:
/usr/local/gcc-4.9.3/bin/g++ -flto -fno-fat-lto-objects -fuse-linker-plugin test.cpp -o test
And get:
cc1plus: error: -fno-fat-lto-objects are supported only with linker plugin
But, ld from /usr/local/binutils-2.25.1 has plugin support
/usr/local/binutils-2.25.1/bin/ld --help | grep plugin
-plugin PLUGIN Load named plugin
-plugin-opt ARG Send arg to last-loaded plugin
Also, gcc-{ar,nm,ranlib} from /usr/local/gcc-4.9.3 have --plugin support
/usr/local/gcc-4.9.3/bin/gcc-ar --help | grep plugin
--plugin <p> - load the specified plugin
Need your help, guys
UPD I managed to solve the problem. Just replaced
./configure ...
with
mkdir build && cd build && ../configure ...
and also added
cd build
to %install begin
gcc-4.9.3/lto-plugin/congifure script isn't written correct !!!

Related

How to build Opencv code in a docker file

I want to build and run a c++ opencv code using docker. Here is my dockerfile:
FROM nvidia/cuda:11.5.0-cudnn8-runtime-ubuntu20.04
FROM ubuntu
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y \
g++ git wget cmake sudo
RUN apt-get install -y \
build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev \
python3-dev python3-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev \
libcanberra-gtk-module libcanberra-gtk3-module
RUN git clone https://github.com/opencv/opencv.git && \
cd /opencv && mkdir build && cd build && \
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. && \
make -j"$(nproc)" && \
make install && ldconfig
The above commands makes my opencv libs, but I don't how to use it to run the actual code. I added this two lines at the end of the dockerfile (wav.cpp is the name of my cpp file that I want to run):
COPY . .
RUN g++ -o wav wav.cpp
But at the end I get this error, which obviously says it can't find the opencv headers.
wav.cpp:2:10: fatal error: opencv2/imgproc.hpp: No such file or
directory
2 | #include "opencv2/imgproc.hpp"
| ^~~~~~~~~~~~~~~~~~~~~ compilation terminated.
Now how should I resolve this header (and lib) dependency problem?
Thank you.
You didn't specify the location for the headers and which libraries should be linked by gcc. Please take a look at the manual of gcc/g++ for the flags -I and -L. Should be something like this:
RUN g++ -o wav wav.cpp -I <opencv header location> -L <opencv libs location> -lopencv_core ....
Using #emrhzc's answer I could build my code inside the dockerfile. Now my final working command is:
RUN g++ -o wav wav.cpp `pkg-config --cflags --libs opencv4`

Correct iOS architecture names for autotools?

What are the standard architecture names of mobile platforms, namely ARM-based, for autotools?
I've tried to build some C/C++ libs for iOS including arm64, armv7, and iOS simulators (i386 and x86_64), but I always ended up having identical binaries for arm64 and x86_64-simulator, which in turns fails the universal binary build by lipo. I've tried to set the --build and --host switches to one of the following pairs
For arm64: --build=x86_64-apple-darwinuname -r, --host=arm64
For x86_64-simulator: --build=x86_64-apple-darwinuname -r, --host=x86_64-apple-darwinuname -r
To my surprise, running the following script,
## Environments
ScriptDir="$( cd "$( dirname "$0" )" && pwd )"
cd - &> /dev/null
# Exit the build pass if any command returns a non-zero value
#set -o errexit
# Echo commands
set -x
DARWIN=darwin`uname -r`
MIN_SDK_VERSION=8.0
IPHONEOS_SYSROOT=`xcrun --sdk iphoneos --show-sdk-path`
IPHONESIMULATOR_SYSROOT=`xcrun --sdk iphonesimulator --show-sdk-path`
# Verbose clang output
#CLANG_VERBOSE="--verbose"
CC=/usr/bin/clang
CXX=/usr/bin/clang
SILENCED_WARNINGS="-Wno-unused-local-typedef -Wno-unused-function"
STDLIB=libc++
CFLAGS="${CLANG_VERBOSE} ${SILENCED_WARNINGS} -DNDEBUG -g -O0 -pipe -fPIC -fcxx-exceptions"
CXXFLAGS="${CFLAGS} -std=c++11 -stdlib=${STDLIB}"
LDFLAGS="-stdlib=${STDLIB}"
LIBS="-lc++ -lc++abi"
PROTOC=`which protoc`
SOURCE_DIR="$ScriptDir"
PREFIX="$ScriptDir"/_build
if [ -d ${PREFIX} ]
then
rm -rf "${PREFIX}"
fi
mkdir -p "${PREFIX}/platform" &> /dev/null
## Functions
build_arch() {
HOST=$1
ARCH=$2
PLATFORM_CFLAGS=$3
PLATFORM_NAME=${ARCH}
SYSROOT=${IPHONEOS_SYSROOT}
ARCH_BITS=x86_64
if [[ $ARCH==armv7 || $ARCH==armv7s ]]; then
ARCH_BITS=i386
fi
CC="${CC}"
CFLAGS="${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch ${ARCH} -isysroot ${SYSROOT} ${PLATFORM_CFLAGS}" \
CXX="${CXX}" \
CXXFLAGS="${CXXFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch ${ARCH} -isysroot ${SYSROOT}" \
LDFLAGS="-arch ${ARCH} -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" \
LIBS="${LIBS}" \
./configure \
--without-gcc \
--disable-ld-version-script \
--build=x86_64-apple-${DARWIN} \
--host=${HOST} \
--with-protoc=${PROTOC} \
--disable-shared \
--prefix=${PREFIX} \
--exec-prefix=${PREFIX}/platform/${PLATFORM_NAME}
make -j8
make install
}
build_simulator() {
ARCH=$1
PLATFORM_CFLAGS=$2
HOST=${ARCH}-apple-${DARWIN}
PLATFORM_NAME=${ARCH}-simulator
SYSROOT=${IPHONESIMULATOR_SYSROOT}
CC="${CC}" \
CFLAGS="${CFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch ${ARCH} -isysroot ${SYSROOT} ${PLATFORM_CFLAGS}" \
CXX="${CXX}" \
CXXFLAGS="${CXXFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch ${ARCH} -isysroot ${SYSROOT}" \
LDFLAGS="-arch ${ARCH} -mios-simulator-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" \
LIBS="${LIBS}" \
./configure \
--without-gcc \
--disable-ld-version-script \
--build=x86_64-apple-${DARWIN} \
--host=${HOST} \
--with-protoc=${PROTOC} \
--disable-shared \
--prefix=${PREFIX} \
--exec-prefix=${PREFIX}/platform/${PLATFORM_NAME}
make -j8
make install
}
build_fat_lib() {
OUT=${PREFIX}/universal
mkdir -p ${OUT}
PLATFORM_ROOT=${PREFIX}/platform
LIPO=lipo
LIB=libprotobuf.a
${LIPO} ${PLATFORM_ROOT}/arm64/lib/${LIB} \
${PLATFORM_ROOT}/x86_64-simulator/lib/${LIB} \
-create \
-output ${OUT}/${LIB}
LIB_LITE=libprotobuf-lite.a
${LIPO} ${PLATFORM_ROOT}/arm64/lib/${LIB_LITE} \
${PLATFORM_ROOT}/x86_64-simulator/lib/${LIB_LITE} \
-create \
-output ${OUT}/${LIB_LITE}
}
## Build pass
cd ${SOURCE_DIR}
./autogen.sh
build_simulator x86_64 "-fembed-bitcode"
build_arch arm arm64 "-fembed-bitcode"
build_fat_lib
echo DONE!
, I end up getting complaints from lipo:
+ lipo /path/to/protobuf/_build/platform/arm64/lib/libprotobuf.a /path/to/protobuf/_build/platform/x86_64-simulator/lib/libprotobuf.a -create -output /path/to/protobuf/_build/universal/libprotobuf.a
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: /path/to/protobuf/_build/platform/arm64/lib/libprotobuf.a and /path/to/protobuf/_build/platform/x86_64-simulator/lib/libprotobuf.a have the same architectures (x86_64) and can't be in the same fat output file
My first impression is that I'm misusing architecture names, and I don't know where to get the standard names. Is that it?
Solved it myself.
It turns out that the real problem is not a wrong arch triplet, but an inappropriate compiler executable assigned to CC/CXX. You gotta use
SDK="iphoneos"
export CC=$(xcrun --find --sdk "${SDK}" clang)
export CXX=$(xcrun --find --sdk "${SDK}" clang++)
export CPP=$(xcrun --find --sdk "${SDK}" cpp)
GOTCHA #1
config.guess as suggested by #JohnBolinger will always return
x86_64-apple-darwin18.7.0
This leads to the wrong x86_64 build that I had before.
GOTCHA #2
Observe the Xcode build log and you may find -target arm64-apple-ios13.1 as a Clang option, not to be confused with the autotool configure option --target. This one is useless either, unfortunately.

docker build error /usr/bin/ld: cannot find -lstdc++ fedora29

I'm trying to build a docker container using the following Dockerfile:
FROM fedora:29
RUN dnf -y update && dnf install -y file gcc gcc-c++ git make wget which libtool python3-pip redhat-rpm-config python3-devel zlib-devel libstdc++ openmpi-devel
RUN cd /tmp && \
wget http://www.mpich.org/static/downloads/3.3/mpich-3.3.tar.gz && \
gzip -dc mpich-3.3.tar.gz | tar xf - && \
cd mpich-3.3 && \
./configure --disable-fortran --prefix=/usr/mpich-3.3 && \
make && \
make install
ENV PATH /usr/mpich-3.3/bin:${PATH}
ENV LD_LIBRARY_PATH /usr/mpich-3.3/lib:${LD_LIBRARY_PATH}
RUN cd /usr && git clone https://github.com/Dowell-Lab/FStitch
RUN cd /usr/FStitch/src && make clean && make
RUN pip3 install FStitch-Bidir --user
ENV PATH /usr/FStitch/src:${PATH}
ENV PATH /root/.local/bin:${PATH}
RUN cd /usr && git clone https://github.com/Dowell-Lab/Tfit
RUN cd /usr/Tfit/src && make clean && make
ENV PATH /usr/Tfit/src:${PATH}
CMD /bin/bash
Where the projects I'm trying to clone are written in c++11 and the second of the two (Tfit) requires openmpi/mpich. The first program compiles successfully, but with the second, I'm getting the following error in the last step of the compiler:
/usr/bin/ld: cannot find -lstdc++
collect2: error: ld returned 1 exit status
make: *** [Makefile:20: NU_FIT] Error 1
I searched and found these two links:
cpp: usr/bin/ld: cannot find -l<nameOfTheLibrary>
usr/bin/ld: cannot find -l<nameOfTheLibrary>
But neither of these quite address the problem as I'm guessing I'm just missing a dependency/symlink to a library, but I'm unsure how to achieve this in the build. I can compile this successfully locally, but I have to module load mpi/openmpi-x86_64 to do so. My guess is that this is an openmpi issue when setting the LD_LIBRARY_PATH, but am unsure of how to resolve this in the Docker build.
The first few lines of the Makefile are as follows:
CXX = mpic++
CXXFLAGS = -static-libstdc++ -static-libgcc -Wno-unused-variable -Wno-non-virtual-dtor -std=c++11 -fopenmp -Wno-write-strings -Wno-literal-suffix -D_GLIBCXX_USE_CXX11_ABI=0 -g
EXEC = ${PWD}/Tfit
ARCH = getconf LONG_BIT
CPP_FLAGS_32 = -D32_BIT
CPP_FLAGS_64 = -D64_BIT
GCCVERSION = $(shell ${CXX} -dumpversion)
NU_FIT: main.o load.o split.o model.o across_segments.o template_matching.o \
read_in_parameters.o model_selection.o error_stdo_logging.o \
MPI_comm.o density_profiler.o bootstrap.o prelim_main.o model_main.o select_main.o FDR.o BIC.o ParamWrapper.o old_template_matching.o
#printf "linking : "
#${CXX} ${CXXFLAGS} ${PWD}/main.o ${PWD}/load.o ${PWD}/model_selection.o \
${PWD}/split.o ${PWD}/model.o ${PWD}/across_segments.o \
${PWD}/template_matching.o ${PWD}/read_in_parameters.o \
${PWD}/MPI_comm.o \
${PWD}/bootstrap.o ${PWD}/density_profiler.o \
${PWD}/prelim_main.o ${PWD}/model_main.o ${PWD}/BIC.o ${PWD}/FDR.o \
${PWD}/select_main.o ${PWD}/error_stdo_logging.o ${PWD}/ParamWrapper.o ${PWD}/old_template_matching.o -o ${EXEC} -lmpi
#cp ${PWD}/Tfit ${PWD}/EMGU
Any help is appreciated!
Try add libstdc++-static in your list of dnf install. (https://github.com/numenta/nupic/issues/1901)

Unknown package libcxx and libcxxabi when building Clang?

I'm trying to build Clang with libc++ from sources. And I'm trying to drop libc++ in-tree while building it out-of-tree with the other components. The recipe I use is below.
If I simply place libcxx and libcxxabi in-tree, then configure does not pick them up, and they are not built automatically. I placed them in llvm/projects per LLVM's libc++ Standard Library.
Additionally, adding make cxx to the recipe does not work as advertised on the LLVM's libc++ Standard Library page. It results in:
llvm[0]: Constructing LLVMBuild project information.
make: *** No rule to make target `cxx'. Stop.
When I configure LLVM/Clang with --with-libcxx and --with-libcxxabi:
# Issued from a scratch 'build' directory, which is next to the 'llvm' directory.
../llvm/configure --enable-optimized --enable-cxx11 --with-libcxx --with-libcxxabi \
$OTHER_OPTIONS --prefix=/usr/local
then I receive the following:
configure: WARNING: Unknown project (libcxx) won't be configured automatically
configure: WARNING: Unknown project (libcxxabi) won't be configured automatically
libcxx and libcxxabi are literally what LLVM calls them, so I'm not sure what names to use if they are not correct.
I tried to examine configure for what the package names should be, but its not very helpful. See below for the logic.
How do I configure and build Clang with libc++ (when libc++ and libc++ ABI are in-tree)?
Configure logic for --with-XXX is shown below.
this is all I can find (its not very helpful):
-with-* | --with-*)
ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
ac_package=`echo $ac_package| sed 's/-/_/g'`
eval with_$ac_package=\$ac_optarg ;;
Related links:
LLVM/Clang download page
LLVM's libc++ Standard Library page
And this Stack Overflow question is related: When is libc++ sources needed when building Clang from sources?
And this discussion of CFE-Dev mailing list: Questions about libc++ for linux and its git repository (if any). The thread says unpacking libcxx into llcm/projects ensures the headers are copied where Clang expects them during make install. But it does not address the --with-XXX question, it does not discuss why libc++ was not built, and it does not discuss how to get make install to actually install the libraries.
Recipe to fetch and build Clang. It works fine when not including libcxx and libcxxabi.
#! /bin/sh
# Clang 3.5 recipe.
# The script should be run from a scratch directory.
# Fetch
if [ ! -e llvm-3.5.0.src.tar.xz ]; then
wget http://llvm.org/releases/3.5.0/llvm-3.5.0.src.tar.xz
fi
if [ ! -e cfe-3.5.0.src.tar.xz ]; then
wget http://llvm.org/releases/3.5.0/cfe-3.5.0.src.tar.xz
fi
if [ ! -e compiler-rt-3.5.0.src.tar.xz ]; then
wget http://llvm.org/releases/3.5.0/compiler-rt-3.5.0.src.tar.xz
fi
if [ ! -e libcxx-3.5.0.src.tar.xz ]; then
wget http://llvm.org/releases/3.5.0/libcxx-3.5.0.src.tar.xz
fi
if [ ! -e libcxxabi-3.5.0.src.tar.xz ]; then
wget http://llvm.org/releases/3.5.0/libcxxabi-3.5.0.src.tar.xz
fi
if [ ! -e clang-tools-extra-3.5.0.src.tar.xz ]; then
wget http://llvm.org/releases/3.5.0/clang-tools-extra-3.5.0.src.tar.xz
fi
# Cleanup
echo "Cleaning up artifacts"
rm -rf llvm build llvm-3.5.0.src
# LLVM
echo "Unpacking LLVM"
tar xf llvm-3.5.0.src.tar.xz
mv llvm-3.5.0.src/ llvm
# Clang Front End
echo "Unpacking Clang Front End"
cd llvm/tools
tar xf ../../cfe-3.5.0.src.tar.xz
mv cfe-3.5.0.src clang
cd ../../
# Compiler RT
echo "Unpacking Compiler RT"
cd llvm/projects
tar xf ../../compiler-rt-3.5.0.src.tar.xz
mv compiler-rt-3.5.0.src/ compiler-rt
cd ../../
# Extra Tools
echo "Unpacking Extra Tools"
cd llvm/tools/clang/tools/
tar xf ../../../../clang-tools-extra-3.5.0.src.tar.xz
mv clang-tools-extra-3.5.0.src extra
cd ../../../../
# libc++
echo "Unpacking libc++"
cd llvm/projects
tar xf ../../libcxx-3.5.0.src.tar.xz
mv libcxx-3.5.0.src/ libcxx
cd ../../
# libc++ ABI
echo "Unpacking libc++ ABI"
cd llvm/projects
tar xf ../../libcxxabi-3.5.0.src.tar.xz
mv libcxxabi-3.5.0.src/ libcxxabi
cd ../../
# Determine if Apple
IS_DARWIN=`uname -s | egrep -i -c "Darwin"`
if [ $IS_DARWIN -ne 0 ]; then
OTHER_OPTIONS=" --enable-libcpp"
fi
# Configure
echo "Configuring build"
mkdir -p build
cd build
../llvm/configure --enable-optimized --enable-cxx11 --with-libcxx --with-libcxxabi $OTHER_OPTIONS --prefix=/usr/local
# Build
# 'make cxx' for libc++ is from http://libcxx.llvm.org/
echo "Running make"
make cxx
make -j2
RET=$?
if [ $RET -eq 0 ];then
echo "****************************************"
read -p "Press [ENTER] to install, or [CTRL]+C to quit"
sudo make install
fi
# ****************************************
# ****************************************
# Install does not install scan-build and scan-view
# Perform the copy, and/or put them on-path
#sudo cp llvm/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py /usr/local/bin
#sudo 2to3 -w /usr/local/bin/asan_symbolize.py
#sudo mkdir /usr/local/bin/scan-build
#sudo cp -r llvm/tools/clang/tools/scan-build /usr/local/bin
#sudo mkdir /usr/local/bin/scan-view
#sudo cp -r llvm/tools/clang/tools/scan-view /usr/local/bin
This is script which I used to build libcxxabi and libcxx. It use previously built Clang (with GCC (4.8.3 in my case) and GCC STL):
if ( $#argv != 2 ) then
echo "Usage: [32|64] <directory>"
exit
endif
set echo on
set CMake=<CMake executable>
set GCCDir=<recent GCC directory>
set LLVMSourceDir=${PWD}/llvm-${LLVM_VERSION}.src
set LLVMOutOfTreeSourceDir=${PWD}
set LLVMPass1Dir=${PWD}/pass1
set PythonDir=<Python directory>
set InstallDir=${PWD}/$argv[2]
if ( $argv[1] == 32 ) then
set GCC_EHDir=${GCCDir}/lib/gcc/x86_64-redhat-linux/4.8.3/32
set BuildMode="-m32"
set LibDirSuffix=""
else
set GCC_EHDir=${GCCDir}/lib/gcc/x86_64-redhat-linux/4.8.3
set BuildMode="-m64"
set LibDirSuffix="64"
endif
set BuildDir=libcxxabi.build
if ( -d ${BuildDir} ) then
rm -rf ${BuildDir}
endif
mkdir ${BuildDir}
cd ${BuildDir}
${CMake} \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_INSTALL_PREFIX:PATH=${InstallDir} \
-DCMAKE_C_COMPILER=${LLVMPass1Dir}/bin/clang \
-DCMAKE_C_FLAGS=${BuildMode} \
-DCMAKE_CXX_COMPILER=${LLVMPass1Dir}/bin/clang++ \
-DCMAKE_CXX_FLAGS=${BuildMode} \
-DCMAKE_SHARED_LINKER_FLAGS="-L ${GCC_EHDir}" \
-DCMAKE_STATIC_LINKER_FLAGS="${GCC_EHDir}/libgcc_eh.a" \
-DLLVM_FORCE_USE_OLD_TOOLCHAIN=YES \
-DLLVM_PATH=${LLVMSourceDir} \
-DLIBCXXABI_LIBCXX_INCLUDES=${LLVMOutOfTreeSourceDir}/libcxx-${LLVM_VERSION}.src/include \
-DLIBCXXABI_LIBCXX_PATH=${LLVMOutOfTreeSourceDir}/libcxx-${LLVM_VERSION}.src \
-DLIBCXXABI_LIBDIR_SUFFIX=${LibDirSuffix} \
${LLVMOutOfTreeSourceDir}/libcxxabi-${LLVM_VERSION}.src
make
make install
cd ..
set BuildDir=libcxx.build
if ( -d ${BuildDir} ) then
rm -rf ${BuildDir}
endif
mkdir ${BuildDir}
cd ${BuildDir}
${CMake} \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_INSTALL_PREFIX:PATH=${InstallDir} \
-DCMAKE_C_COMPILER=${LLVMPass1Dir}/bin/clang \
-DCMAKE_C_FLAGS=${BuildMode} \
-DCMAKE_CXX_COMPILER=${LLVMPass1Dir}/bin/clang++ \
-DCMAKE_CXX_FLAGS=${BuildMode} \
-DCMAKE_SHARED_LINKER_FLAGS="-L ${GCCDir}/lib${LibDirSuffix}" \
-DLLVM_PATH=${LLVMSourceDir} \
-DLIBCXX_CXX_ABI=libcxxabi \
-DLIBCXX_CXX_ABI_INCLUDE_PATHS=${LLVMOutOfTreeSourceDir}/libcxxabi-${LLVM_VERSION}.src/include \
-DLIBCXX_CXX_ABI_LIBRARY_PATH=${InstallDir}/lib \
-DLIBCXX_LIBDIR_SUFFIX=${LibDirSuffix} \
-DLIT_EXECUTABLE=${LLVMSourceDir}/utils/lit/lit.py \
${LLVMOutOfTreeSourceDir}/libcxx-${LLVM_VERSION}.src
make
make install
cd ..
libc++ and libc++abi aren't maintained to work with configure. I think libc++ might work if you invoke it correctly, but there isn't even a configure script for libc++abi.
See our docs for using cmake with these projects:
# In-tree build:
# Check out libcxx and libcxxabi into llvm/projects
cd llvm
mkdir build && cd build
cmake .. # Linux may require -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
make cxx

Error in linking fftw libraries for pyFFTW installation

I tried to install pyFFTW 0.9.2 to OSX mavericks, but I encounter the following errors:
/usr/bin/clang -bundle -undefined dynamic_lookup
-L//anaconda/lib -arch x86_64 -arch x86_64
build/temp.macosx-10.5-x86_64-2.7/anaconda/lib/python2.7/site-packages/pyFFTW-master/pyfftw/pyfftw.o
-L//anaconda/lib -lfftw3 -lfftw3f -lfftw3l -lfftw3_threads -lfftw3f_threads -lfftw3l_threads
-o build/lib.macosx-10.5-x86_64-2.7/pyfftw/pyfftw.so
ld: library not found for -lfftw3
clang: error: linker command failed with exit code 1 (use -v to see invocation)
As mentioned in pyFFTW installation -> cannot find -lfftw3_threads, I tried to compile and install fftw 3.3.4 for three times. But it is not working for me.
How I did was:
./configure --enable-float --enable-share => make => make install
./configure --enable-long-double --enable-share => make => make install
./configure --enable-threads --enable-share => make => make install
then I run python (2.7) setup files in pyFFTW folder, and I get the error above.
I appreciate your help.
I had the same issue on OSX 10.9.4 Maverick.
Try this:
download FFTW 3.3.4 than open a terminal window and go in the extracted FFTW directory and run these commands:
$ ./configure --enable-long-double --enable-threads
$ make
$ sudo make install
$ ./configure --enable-float --enable-threads
$ make
$ sudo make install
Than install pyFFTW using pip as suggested:
$ sudo pip install pyfftw
I'm using MacOX 10.11.4 and Python 3.5.1 installed through conda and the above answer didn't work for me.
I would still get this error:
ld: library not found for -lfftw3l
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for pyfftw
or:
ld: library not found for -lfftw3l_threads
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'gcc' failed with exit status 1
----------------------------------------
Failed building wheel for pyfftw
What did work for me was a slight variation on what I found here:
First install long-double libraries
comp:fftw-3.3.4 user$ ./configure --enable-threads --enable-shared --disable-fortran --enable-long-double CFLAGS="-O3 -fno-common -fomit-frame-pointer -fstrict-aliasing"
comp:fftw-3.3.4 user$ make
comp:fftw-3.3.4 user$ sudo make install
Then install float and double libraries
comp:fftw-3.3.4 user$ ./configure --enable-threads --enable-shared --disable-fortran --enable-sse2 --enable-float CFLAGS="-O3 -fno-common -fomit-frame-pointer -fstrict-aliasing"
comp:fftw-3.3.4 user$ make
comp:fftw-3.3.4 user$ sudo make install
comp:fftw-3.3.4 user$ ./configure --enable-threads --enable-shared --disable-fortran --enable-sse2 CFLAGS="-O3 -fno-common -fomit-frame-pointer -fstrict-aliasing"
comp:fftw-3.3.4 user$ make
comp:fftw-3.3.4 user$ sudo make install
Then install pyfftw
comp:fftw-3.3.4 user$ sudo -H pip install pyfftw
I don't think the --disable-fortran and --enable-sse2 flags are necessary and I'm not sure sudo is necessary for pip but this is what worked for me.
Note that your /usr/local/lib folder should contain the following files when you're done:
libfftw3.3.dylib
libfftw3.a
libfftw3.dylib
libfftw3.la
libfftw3_threads.3.dylib
libfftw3_threads.a
libfftw3_threads.dylib
libfftw3_threads.la
libfftw3f.3.dylib
libfftw3f.a
libfftw3f.dylib
libfftw3f.la
libfftw3f_threads.3.dylib
libfftw3f_threads.a
libfftw3f_threads.dylib
libfftw3f_threads.la
libfftw3l.3.dylib
libfftw3l.a
libfftw3l.dylib
libfftw3l.la
libfftw3l_threads.3.dylib
libfftw3l_threads.a
libfftw3l_threads.dylib
libfftw3l_threads.la