Re: correct solution for llvm34 is to switch stage1 to -std=c++11 -stdlib=libc++
Jack Howarth <[email protected]>
| Newsgroups | gmane.os.apple.fink.devel |
|---|---|
| Message-ID | <CAP5Ds0ATHMZoCihk1-8xR+k4KB5BdV1g+qbio7Gv5FEoxm7Eyg@mail.gmail.com> |
David,
I have tested the following changes to the llvm34-3.4.1-0c info file
at r1.54 from your experimental directory on 10.7 with Xcode 4.6.3 and
10.8/10.9 with Xcode 5.1.1…
--- llvm34.info.r1.54 2014-05-24 09:05:45.000000000 -0400
+++ llvm34.info 2014-05-24 09:04:04.000000000 -0400
@@ -19,7 +19,8 @@
libncurses5-dev,
# xml and lzma are used to build an uninstalled bin/c-index-test, so
bdep-only
libxml2,
- liblzma5
+ liblzma5,
+ xcode (>= 4.6)
<<
Depends: %N-shlibs
# no longer uses cloog directly, only indirectly through isl
@@ -333,7 +334,8 @@
-DCMAKE_INSTALL_PREFIX:PATH=$fink_root/opt/llvm-$brv \
-DCMAKE_BUILD_TYPE:STRING=$build_type )
- STAGE1_CMAKE_OPTIONS=( -DCMAKE_C_FLAGS=-fno-common
-DCMAKE_CXX_FLAGS=-fno-common )
+ STAGE1_CMAKE_OPTIONS=( -DCMAKE_C_FLAGS=-fno-common \
+ -DCMAKE_CXX_FLAGS="-fno-common -std=c++11 -stdlib=libc++" )
# trying to disable optimization flags on non-trustworthy compilers
# worked around in recompile_known_units(), and now using RelWithDebInfo
ccvers=`$CXX -v 2>&1 | tail -n 1 | cut -d\ -f3`
@@ -720,52 +722,16 @@
pushd ../build
echo "######## Comparing objects from stage 2 vs. 3 of LLVM/Clang"
- do_stage4=0
- llvm_stage_diff stage{2,3} || do_stage4=1
+ rejoice=1
+ llvm_stage_diff stage{2,3} || rejoice=0
mv compare{,2v3}
popd
-if test "$do_stage4" != 1
-then echo "######## 3-STAGE BOOTSTRAP of llvm/clang PASSED"
+if test "$rejoice" = 1
+ then echo "######## 3-STAGE BOOTSTRAP of llvm/clang PASSED"
else
- echo "######## START of BOOTSTRAP STAGE 4: building llvm/clang with stage
3 clang"
- # reuse CC and CXX from stage 3.5
- # yes, reuse STAGE2_CMAKE_OPTIONS in stage 4
- mkdir -p ../build/stage4
- pushd ../build/stage4
- echo "LLVM_CMAKE_OPTIONS = ${COMMON_CMAKE_OPTIONS[@]}
${LLVM_CMAKE_OPTIONS[@]} ${STAGE2_CMAKE_OPTIONS[@]}"
- export LDFLAGS="${STAGE2_COMMON_LDFLAGS[@]} ${STAGE2_LLVM_LDFLAGS[@]}
${FINK_LDFLAGS[@]}"
- echo "LDFLAGS = $LDFLAGS"
- cmake "${COMMON_CMAKE_OPTIONS[@]}" "${LLVM_CMAKE_OPTIONS[@]}"
"${STAGE2_CMAKE_OPTIONS[@]}" $relsrcdir
- fix_llvm_config_build_variables
- make -k || make VERBOSE=1
- asm_link_clang_rt
- make
- pushd lib
- ln -s BugpointPasses.{so,dylib}
- ln -s LLVMPolly.{so,dylib}
- ln -s LLVMHello.{so,dylib}
- popd
- cd ..
- rm -f last
- ln -s stage4 last
- popd
- # wd: %b
- for f in ../build/stage4/{llvm,clang,polly,compiler-rt}-$version-check.log
- do echo "Stage 4 Tests were not run." > $f
- done
- echo "######## END of BOOTSTRAP STAGE 4: built llvm/clang with stage 3
clang"
- pushd ../build
- echo "######## Comparing objects from stage 3 vs. 4 of LLVM/Clang"
- rejoice=1
- llvm_stage_diff stage{3,4} || rejoice=0
- mv compare{,3v4}
- popd
- if test "$rejoice" = 1
- then echo "######## 4-STAGE BOOTSTRAP of llvm/clang PASSED"
- else echo "######## 4-STAGE BOOTSTRAP of llvm/clang FAILED" ; exit 1
- fi
-# $do_stage4 != 1
+ echo "######## 3-STAGE BOOTSTRAP of llvm/clang FAILED" ; exit 1
+# $rejoice = 1
fi
# $do_bootstrap = 1
fi
The bootstrap succeeds on all three targets and there are no test suite
regressions. I've also tested the -fopenmp support on all three targets
using the clang-3.4 symlink against
the OpenMP3.1_Validation, taskbench-1.0-20110715 and the openmp example
code at https://computing.llnl.gov/tutorials/openMP/exercise.html.
Jack
ps The complete llvm34.info is attached. I've gone ahead and deployed r1.54
from your experimental with the above changes after testing in the 10.7
tree so we can get some wider testing over the weekend, but I would be
shocked if anyone sees fails stage3 now. I'll email the fink build logs for
all three targets shortly.
pps I plan on mocking-up a variation of the llvm34.info for the 10.6-EOL
tree to use the llvm33 clang/clang++ compilers and its libc++for stage1 and
start testing. The main question going forward in those EOL trees is which
llvm3x package to use for the stage1 bootstrap in later llvm3x releases. I
think you will want to keep it at llvm33 to avoid forcing end users to
build a cascade of intervening llvm3x releases (such as llvm33 and llvm34
in order to build llvm35).
On Sat, May 24, 2014 at 1:45 AM, Jack Howarth <[email protected]>wrote:
> David,
> I tested changes of the form...
>
> +++ llvm34.info 2014-05-23 19:33:22.000000000 -0400
> @@ -442,7 +442,9 @@
> echo "######## START of BOOTSTRAP STAGE 2: building llvm/clang with
> stage 1 clang"
> # reuse CC and CXX from stage 1.5
> STAGE2_CMAKE_OPTIONS=( \
> - -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++ -cxx-isystem
> $libcxx_abs_srcdir/include" )
> + -DCMAKE_CXX_FLAGS="-std=c++11 -stdlib=libc++ -cxx-isystem
> $libcxx_abs_srcdir/include" \
> + -DCMAKE_C_FLAGS_RELEASE:STRING="-O3 -DNDEBUG -fno-slp-vectorize" \
> + -DCMAKE_CXX_FLAGS_RELEASE:STRING="-O3 -DNDEBUG -fno-slp-vectorize" )
> STAGE2_LLVM_LDFLAGS=( "-L$libcxx_stage_dir" )
> # if not bootstrapping libc++, use system C++ library (buried in XCode)
> # if test "$darwin_vers" -ge 13
>
> to reduce the optimizations used to generate the stage2 and stage3
> compilers in llvm34 and this doesn't eliminate the unwanted stage4
> bootstrap on 10.7 and 10.8. The following set of reduced optimization
> levels have been tested on 10.8 against llvm34-3.4.1-0a and all still
> result in a stage4 bootstrap…
>
> -O3 -DNDEBUG -fno-slp-vectorize
> -O3 -DNDEBUG -fno-vectorize
> -O2 -DNDEBUG
> -O1 -DNDEBUG
>
> However I do see that on both 10.7 and 10.8, stage1 is built against
> libstdc++ rather than libc++. The following change, which enforces the use
> of the system libc++ in the stage1 bootstrap, eliminates the occurrence of
> a stage4 bootstrap on both 10.7 and 10.8.
>
> --- llvm34.info.orig 2014-05-23 17:40:20.000000000 -0400
> +++ llvm34.info 2014-05-23 22:35:38.000000000 -0400
> @@ -325,7 +325,7 @@
> -DCMAKE_INSTALL_PREFIX:PATH=$fink_root/opt/llvm-$brv \
> -DCMAKE_BUILD_TYPE:STRING=$build_type )
>
> - STAGE1_CMAKE_OPTIONS=( -DCMAKE_C_FLAGS=-fno-common
> -DCMAKE_CXX_FLAGS=-fno-common )
> + STAGE1_CMAKE_OPTIONS=( -DCMAKE_C_FLAGS=-fno-common
> -DCMAKE_CXX_FLAGS="-fno-common -std=c++11 -stdlib=libc++" )
> # trying to disable optimization flags on non-trustworthy compilers
> # worked around in recompile_known_units(), and now using RelWithDebInfo
> ccvers=`$CXX -v 2>&1 | tail -n 1 | cut -d\ -f3`
>
> The fact that I have never seen a stage4 bootstrap occur on 10.9 (which
> has always built stage1 as -std=c++11 -stdlib=libc++) argues that the
> current mixing of libstdc++ in stage1 and libc++ later is at fault and the
> solution is to stop doing that.
> I would also note that even in Xcode 5.1.1 on 10.8, Apple is building
> the system clang++ compiler against libc++ even though the compiler
> defaults to -stdlib=libstdc++ for the 10.8 SDK behavior.
>
> % otool -L
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
> | grep "c++"
> /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version
> 120.0.0)
>
> So I would argue that the convention for building 3.4svn on darwin is to
> use the libc++ shared library throughout the bootstrap process. In our
> case, the main difference is that the final clang++ compiler is built and
> linked against the libc++-3.5 of the llvm34 package rather than the system
> libc++. Which is a good thing considering the age of the system libc++ in
> 10.8 and especially 10.7.
> Jack
> ps While I realize that this solution doesn't help you eliminate the
> stage4 bootstrap pre-10.7. it is the most sensible and direct fix for
> llvm34 in the 10.7 tree. We just need to add a BuildDepends (xcode >= 4.6)
> to llvm34.info in addition to the above change to STAGE1_CMAKE_OPTIONS.
> Considering that llvm 3.5svn now requires a c++ shared library with c++-11
> support (gcc 4.7 or later), we will have to switch to the -std=c++11
> -stdlib=libc++ anyway for llvm35 in the 10.7 tree.
>
> pps In the llvm34 info file for the 10.7 tree, you will also want to yank
> out the hack supporting the stage4 bootstrap and properly emit a fatal
> bootstrap error message if the stage2 and stage3 comparison fails.
>
------------------------------------------------------------------------------
The best possible search technologies are now affordable for all companies.
Download your FREE open source Enterprise Search Engine today!
Our experts will assist you in its installation for $59/mo, no commitment.
Test it for FREE on our Cloud platform anytime!
http://pubads.g.doubleclick.net/gampad/clk?id=145328191&iu=/4140/ostg.clktrk
_______________________________________________
Fink-devel mailing list
[email protected]
List archive:
http://news.gmane.org/gmane.os.apple.fink.devel
Subscription management:
https://lists.sourceforge.net/lists/listinfo/fink-devel
llvm34.info
(application/octet-stream, 41.7 KB) - not displayed