On Tue, Sep 8, 2015 at 2:11 PM, arnaud gaboury <arnaud.gaboury@xxxxxxxxx> wrote: > On Tue, Sep 8, 2015 at 1:15 PM, Jan Chaloupka <jchaloup@xxxxxxxxxx> wrote: >> Hi Arnaud, >> >> I am assuming all scripts you are referring to are sourced and run in %build >> section. Can you be more specific which commands are you running? %build >> section is interpreted as a bash script so source and unset should work. >> Without the concrete example it is hard to guess what is going wrong. > > These are the two scripts I have to run: > > --------------------------------------------- > % cat /opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/bin/mklvars.sh > > #!/bin/sh > # > # Copyright (C) 2003-2015 Intel Corporation. All rights reserved. > # > # The information and source code contained herein is the exclusive property > # of Intel Corporation and may not be disclosed, examined, or reproduced in > # whole or in part without explicit written authorization from the Company. > # > > mkl_help() { > echo "" > echo "Syntax:" > echo " source $SCRIPT_NAME <arch> [MKL_interface] [${MOD_NAME}]" > echo "" > echo " <arch> must be one of the following" > echo " ia32 : Setup for IA-32 architecture" > echo " intel64 : Setup for Intel(R) 64 architecture" > echo " mic : Setup for Intel(R) Many Integrated > Core Architecture" > echo "" > echo " ${MOD_NAME} (optional) - set path to MKL F95 modules" > echo "" > echo " MKL_interface (optional) - MKL programming interface for intel64" > echo " Not applicable without ${MOD_NAME}" > echo " lp64 : 4 bytes integer (default)" > echo " ilp64 : 8 bytes integer" > echo "" > } > > set_mkl_env() { > CPRO_PATH=/opt/intel/compilers_and_libraries_2016.0.109/linux > export MKLROOT=${CPRO_PATH}/mkl > > typeset SCRIPT_NAME=$0 > typeset MOD_NAME=mod > > typeset MKL_LP64_ILP64= > typeset MKL_MOD= > typeset MKL_TARGET_ARCH= > typeset MKLVARS_VERBOSE= > typeset MKL_MIC_ARCH= > typeset MKL_BAD_SWITCH= > typeset OLD_LD_LIBRARY_PATH= > typeset OLD_LIBRARY_PATH= > typeset OLD_MIC_LD_LIBRARY_PATH= > typeset OLD_NLSPATH= > typeset OLD_CPATH= > > if [ -z "$1" ] ; then > mkl_help > else > > while [ -n "$1" ]; do > if [ "$1" = "ia32" ] ; then MKL_TARGET_ARCH=ia32; > elif [ "$1" = "intel64" ] ; then > MKL_TARGET_ARCH=intel64; MKL_MIC_ARCH=mic; > elif [ "$1" = "mic" ] ; then MKL_TARGET_ARCH=mic; > MKL_MIC_ARCH=mic; > elif [ "$1" = "lp64" ] ; then MKL_LP64_ILP64=lp64; > elif [ "$1" = "ilp64" ] ; then MKL_LP64_ILP64=ilp64; > elif [ "$1" = "${MOD_NAME}" ] ; then MKL_MOD=${MOD_NAME}; > elif [ "$1" = "verbose" ] ; then MKLVARS_VERBOSE=verbose; > else > MKL_BAD_SWITCH=$1 > break 10 > fi > shift; > done > > if [ -n "${MKL_BAD_SWITCH}" ] ; then > > echo > echo "ERROR: Unknown option '${MKL_BAD_SWITCH}'" > mkl_help > > else > > if [ -z "${MKL_TARGET_ARCH}" ] ; then > > echo > echo "ERROR: architecture is not defined. Accepted > values: ia32, intel64, mic" > mkl_help > > else > typeset > mkl_ld_arch="${CPRO_PATH}/compiler/lib/${MKL_TARGET_ARCH}:${MKLROOT}/lib/${MKL_TARGET_ARCH}" > typeset > mkl_ld_intel64="${CPRO_PATH}/compiler/lib/intel64:${MKLROOT}/lib/intel64" > typeset > mkl_ld_mic="${CPRO_PATH}/compiler/lib/${MKL_MIC_ARCH}:${MKLROOT}/lib/${MKL_MIC_ARCH}" > > if [ -z "${TBBROOT}" ]; then > typeset mkl_tbb_subdir="/gcc4.4" > if [ "${MKL_TARGET_ARCH}" = "mic" ]; then > mkl_tbb_subdir=""; fi > > typeset > mkl_ld_arch="${CPRO_PATH}/tbb/lib/${MKL_TARGET_ARCH}${mkl_tbb_subdir}:${mkl_ld_arch}" > typeset > mkl_ld_intel64="${CPRO_PATH}/tbb/lib/intel64/gcc4.4:${mkl_ld_intel64}" > typeset > mkl_ld_mic="${CPRO_PATH}/tbb/lib/${MKL_MIC_ARCH}:${mkl_ld_mic}" > fi > > if [ -n "${LD_LIBRARY_PATH}" ] ; then > OLD_LD_LIBRARY_PATH=":${LD_LIBRARY_PATH}"; fi > export LD_LIBRARY_PATH="${mkl_ld_arch}${OLD_LD_LIBRARY_PATH}" > if [ -n "${MKL_MIC_ARCH}" ]; then > if [ "${MKL_TARGET_ARCH}" = "mic" ] ; then > export > LD_LIBRARY_PATH="${mkl_ld_intel64}:${LD_LIBRARY_PATH}" > fi > if [ -d "/opt/intel/mic" ]; then > export > LD_LIBRARY_PATH="/opt/intel/mic/coi/host-linux-release/lib:/opt/intel/mic/myo/lib:${LD_LIBRARY_PATH}" > fi > fi > > if [ -n "${LIBRARY_PATH}" ] ; then > OLD_LIBRARY_PATH=":${LIBRARY_PATH}"; fi > if [ "${MKL_TARGET_ARCH}" = "mic" ] ; then > export LIBRARY_PATH="${mkl_ld_inte64}${OLD_LIBRARY_PATH}" > else > export LIBRARY_PATH="${mkl_ld_arch}${OLD_LIBRARY_PATH}" > fi > > if [ -n "${MKL_MIC_ARCH}" ]; then > if [ -n "${MIC_LD_LIBRARY_PATH}" ]; then > OLD_MIC_LD_LIBRARY_PATH=":${MIC_LD_LIBRARY_PATH}"; fi > export > MIC_LD_LIBRARY_PATH="${mkl_ld_mic}${OLD_MIC_LD_LIBRARY_PATH}" > if [ -d "/opt/intel/mic" ]; then > export > MIC_LD_LIBRARY_PATH="/opt/intel/mic/coi/device-linux-release/lib:/opt/intel/mic/myo/lib:${MIC_LD_LIBRARY_PATH}" > fi > fi > > if [ -n "${NLSPATH}" ] ; then OLD_NLSPATH=":${NLSPATH}"; fi > > export > NLSPATH="${MKLROOT}/lib/${MKL_TARGET_ARCH}/locale/%l_%t/%N${OLD_NLSPATH}" > if [ "${MKL_TARGET_ARCH}" = "mic" ] ; then > export > NLSPATH="${MKLROOT}/lib/intel64/locale/%l_%t/%N:${NLSPATH}" > fi > > if [ -z "${MANPATH}" ] ; then > export MANPATH="${CPRO_PATH}/man/en_US:`manpath`" > else > export MANPATH="${CPRO_PATH}/man/en_US:${MANPATH}" > fi > > if [ -n "$CPATH" ] ; then OLD_CPATH=":${CPATH}"; fi > export CPATH="${MKLROOT}/include${OLD_CPATH}" > > if [ "${MKL_MOD}" = "${MOD_NAME}" ] ; then > if [ "${MKL_TARGET_ARCH}" = "ia32" ] ; then > MKL_LP64_ILP64= > else > if [ -z "$MKL_LP64_ILP64" ] ; then > MKL_LP64_ILP64=lp64 > fi > fi > export > CPATH="${CPATH}:${MKLROOT}/include/${MKL_TARGET_ARCH}/${MKL_LP64_ILP64}" > if [ "${MKL_TARGET_ARCH}" = "mic" ] ; then > export > CPATH="${CPATH}:${MKLROOT}/include/intel64/${MKL_LP64_ILP64}" > fi > fi > > if [ "${MKLVARS_VERBOSE}" = "verbose" ] ; then > echo LD_LIBRARY_PATH=${LD_LIBRARY_PATH} > echo LIBRARY_PATH=${LIBRARY_PATH} > echo MIC_LD_LIBRARY_PATH=${MIC_LD_LIBRARY_PATH} > echo NLSPATH=${NLSPATH} > echo MANPATH=${MANPATH} > echo CPATH=${CPATH} > fi > fi > fi > fi > } > > set_mkl_env "$@" > ------------------------------------------------------------------------------ > > % cat /opt/intel/bin/compilervars.sh > > #!/bin/sh > # > # Copyright (C) 1985-2015 Intel Corporation. All rights reserved. > # > # The information and source code contained herein is the exclusive property > # of Intel Corporation and may not be disclosed, examined, or reproduced in > # whole or in part without explicit written authorization from the Company. > # > > PROD_DIR="/opt/intel/compilers_and_libraries_2016.0.109/linux" > > TARGET_ARCH= > TARGET_PLATFORM=linux > > if [ -e $PROD_DIR/bin/intel64/icl_fbsd.cfg ]; then > TARGET_ARCH=intel64 > TARGET_PLATFORM=freebsd > fi > > COMPILERVARS_ARGV=$# > if [ $# -eq 0 ]; then > if [ "$COMPILERVARS_ARCHITECTURE" != '' ]; then > TARGET_ARCH=$COMPILERVARS_ARCHITECTURE > fi > if [ "$COMPILERVARS_PLATFORM" != '' ]; then > TARGET_PLATFORM=$COMPILERVARS_PLATFORM > fi > fi > > while [ $# -gt 0 ] > do > opt="$1" > case $opt in > -arch) > shift > TARGET_ARCH="$1" > shift > ;; > -platform) > shift > TARGET_PLATFORM="$1" > shift > ;; > *) > TARGET_ARCH="$1" > shift > ;; > esac > done > > if [ ! -e $PROD_DIR/bin/intel64/icl_fbsd.cfg ] && \ > [ "$TARGET_ARCH" != "ia32" -a "$TARGET_ARCH" != "intel64" -o \ > "$TARGET_PLATFORM" != "android" -a "$TARGET_PLATFORM" != "linux" > -a "$TARGET_PLATFORM" != "mac" ]; then > > echo "compilervars.sh <arch> [-arch <arch>] [-platform <platform>]" > echo "" > echo " <arch> must be one of the following:" > echo " ia32 : Set up for IA-32 target." > echo " intel64 : Set up for Intel(R)64 target." > echo " <platform> must be of the following:" > echo " linux : Set to Linux target." > echo " mac : Set to Mac target." > echo " android : Set to Android target." > echo "" > echo "If the arguments to the sourced script are ignored (consult docs" > echo "for your shell) the alternative way to specify target is environment" > echo "variables COMPILERVARS_ARCHITECTURE to pass <arch> to the script" > echo "and COMPILERVARS_PLATFORM to pass <platform>" > > return 1 > elif [ -e $PROD_DIR/bin/intel64/icl_fbsd.cfg ] && \ > [ "$TARGET_ARCH" != "intel64" -o \ > "$TARGET_PLATFORM" != "freebsd" ]; then > > echo "compilervars.sh <arch> [-arch <arch>] [-platform <platform>]" > echo "" > echo " <arch> must be one of the following:" > echo " intel64 : Set up for Intel(R)64 target." > echo " <platform> must be of the following:" > echo " freebsd : Set to FreeBSD target." > echo "" > echo "If the arguments to the sourced script are ignored (consult docs" > echo "for your shell) the alternative way to specify target is environment" > echo "variables COMPILERVARS_ARCHITECTURE to pass <arch> to the script" > echo "and COMPILERVARS_PLATFORM to pass <platform>" > > return 1 > fi > > if [ "$TARGET_PLATFORM" = "mac" ]; then > TARGET_PLATFORM="linux" > fi > > if [ $COMPILERVARS_ARGV -eq 0 ] ; then > #pass default values via COMPILERVARS_* > if [ "$COMPILERVARS_ARCHITECTURE" = '' ]; then > COMPILERVARS_ARCHITECTURE=$TARGET_ARCH > fi > if [ "$COMPILERVARS_PLATFORM" = '' ]; then > COMPILERVARS_PLATFORM=$TARGET_PLATFORM > fi > TARGET_ARCH= > TARGET_PLATFORM= > fi > > if [ -e $PROD_DIR/daal/bin/daalvars.sh ]; then > . $PROD_DIR/daal/bin/daalvars.sh $TARGET_ARCH > fi > if [ -e $PROD_DIR/../../debugger_2016/bin/debuggervars.sh ]; then > . $PROD_DIR/../../debugger_2016/bin/debuggervars.sh $TARGET_ARCH > fi > if [ -e $PROD_DIR/tbb/bin/tbbvars.sh ]; then > . $PROD_DIR/tbb/bin/tbbvars.sh $TARGET_ARCH > fi > if [ -e $PROD_DIR/mkl/bin/mklvars.sh ]; then > . $PROD_DIR/mkl/bin/mklvars.sh $TARGET_ARCH > fi > if [ -e $PROD_DIR/ipp/bin/ippvars.sh ]; then > . $PROD_DIR/ipp/bin/ippvars.sh $TARGET_ARCH $TARGET_PLATFORM > fi > if [ -e $PROD_DIR/pkg_bin/compilervars_arch.sh ]; then > . $PROD_DIR/pkg_bin/compilervars_arch.sh $TARGET_ARCH $TARGET_PLATFORM > fi > ---------------------------------------------------------- > > Here is what I did under the %build section in my spec file: > > > unset R_HOME > source /opt/intel/compilers_and_libraries_2016/linux/mkl/bin/mklvars.sh intel64 > source /opt/intel/bin/compilervars.sh intel64 > > ---------------------------------------- > % rpmlint SPECS/R.spec > SPECS/R.spec:436: W: macro-in-comment %endif > SPECS/R.spec:458: W: macro-in-comment %endif > SPECS/R.spec:602: W: macro-in-comment %{_libdir} > SPECS/R.spec:608: W: macro-in-comment %lang > SPECS/R.spec:608: W: macro-in-comment %{_libdir} > SPECS/R.spec:828: W: macro-in-comment %{_libdir} > SPECS/R.spec:842: W: macro-in-comment %{_includedir} > SPECS/R.spec:895: W: macro-in-comment %__cat > SPECS/R.spec:895: W: macro-in-comment %{_libdir} > SPECS/R.spec:895: W: macro-in-comment %{_docdir} > SPECS/R.spec:895: W: macro-in-comment %{version} > SPECS/R.spec:897: W: macro-in-comment %{_libdir} > SPECS/R.spec:897: W: macro-in-comment %{_docdir} > SPECS/R.spec:897: W: macro-in-comment %{version} > SPECS/R.spec:900: W: macro-in-comment %__cat > SPECS/R.spec:900: W: macro-in-comment %{_datadir} > SPECS/R.spec:900: W: macro-in-comment %{_docdir} > SPECS/R.spec:900: W: macro-in-comment %{version} > SPECS/R.spec:902: W: macro-in-comment %{_docdir} > SPECS/R.spec:902: W: macro-in-comment %{version} > 0 packages and 1 specfiles checked; 0 errors, 20 warnings. > ------------------------------------------------- > > % rpmbuild -ba SPECS/R.spec > > ................ > make[2]: Entering directory '/home/poisonivy/rpmbuild/BUILD/R-3.2.1/src/unix' > icc -std=c99 -I. -I../../src/include -I../../src/include > -I/usr/local/include -DHAVE_CONFIG_H -fpic -ip -O3 > -opt-mem-layout-trans=3 -xHost -mavx -fp-model precise -wd188 > -DMKL_ILP64 -qopenmp -parallel > -I/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/include > -L/opt/intel/compilers_and_libraries_2016.0.109/linux/compiler/lib/intel64 > -DR_HOME='"/usr/lib64/R"' \ > -o Rscript ./Rscript.c > make[2]: icc: Command not found > .................................. > > This error does not appear if I run mannually the source of the two > scripts. What puzzles me is that this buid error arrises late in the > make process, and I am surprised the error did not appear much before > as everything is built with Intel Compiler (icc). > > As for the unset of R_HOME, it did the trick indeed! > > More about my config: > > ----------------------------------------------------------------------------------- > % cat BUILD/R-3.2.1/CONFIGURE.log | grep -A30 'R is now' > > 755:R is now configured for x86_64-redhat-linux-gnu > 756- > 757- Source directory: . > 758- Installation directory: /usr > 759- > 760- C compiler: icc -std=c99 -ip -O3 > -opt-mem-layout-trans=3 -xHost -mavx -fp-model precise -wd188 > -DMKL_ILP64 -qopenmp -parallel > -I/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/include > 761- Fortran 77 compiler: ifort -ip -O3 > -opt-mem-layout-trans=3 -xHost -mavx -fp-model precise -DMKL_ILP64 > -qopenmp -parallel > -I/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/include > 762- > 763- C++ compiler: icpc -ip -O3 -opt-mem-layout-trans=3 > -xHost -mavx -fp-model precise -DMKL_ILP64 -qopenmp-parallel > -I/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/include > 764- C++ 11 compiler: icpc -std=c++11 -ip -O3 > -opt-mem-layout-trans=3 -xHost -mavx -fp-model precise -DMKL_ILP64 > -qopenmp-parallel > -I/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/include > 765- Fortran 90/95 compiler: ifort -ip -O3 -opt-mem-layout-trans=3 > -xHost -mavx -fp-model precise -DMKL_ILP64 -qopenmp -parallel > -I/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/include > 766- Obj-C compiler: gcc -g -O2 -fobjc-exceptions > --------------------------------------------------------------------------------------- > > ( %configure \ > %if %{system_tre} > --with-system-tre \ > %endif > --with-system-zlib --with-system-bzlib --with-system-pcre \ > --with-system-valgrind-headers \ > --with-lapack \ > --with-blas="$MKL" \ > %endif > --with-tcl-config=%{_libdir}/tclConfig.sh \ > --with-tk-config=%{_libdir}/tkConfig.sh \ > --enable-R-shlib \ > --enable-memory-profiling \ > --enable-BLAS-shlib \ > --enable-prebuilt-html \ > ------------------------------------------------------ > > > I have a warning too at the begining of the build. No idea where this > option comes from: > configure: WARNING: unrecognized options: --disable-dependency-tracking > > > Hope these info can help to debug. The more I work on my spec file, the more I think my issue has nothing to do with the source command. I must have wrong or insufficient env variables definition in my spec file. > >> >> Jan >> >> On 09/08/2015 01:07 PM, arnaud gaboury wrote: >>> >>> I am building a rpm package. For make to success and have the correct >>> env variables, I need to source a few scripts and unset a few >>> variables. >>> rpmbuild does not understand the source and unset commands. >>> >>> How shall I proceed to get the desired variables? >>> >>> Thank you >>> >> >> -- >> devel mailing list >> devel@xxxxxxxxxxxxxxxxxxxxxxx >> https://admin.fedoraproject.org/mailman/listinfo/devel >> Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct > > > > -- > > google.com/+arnaudgabourygabx -- google.com/+arnaudgabourygabx -- devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/devel Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct