[Flang-dev] Flang honoring-DCMAKE_Fortran_COMPILER=${PATH}

Morin, Monique Marlene morin at lanl.gov
Thu Jul 12 09:32:24 EDT 2018


We have had similar trouble with cmake flags not being honored at certain points in the build from source process for Flang -- this was not always the case a couple of months ago.


Our solution/work-around has been to manually set/change environment variables throughout install steps.


It would be great if this could be fixed and we could provide feedback about install as well.

Thanks!

________________________________
From: flang-dev <flang-dev-bounces at lists.flang-compiler.org> on behalf of blubee blubeeme <gurenchan at gmail.com>
Sent: Wednesday, July 11, 2018 11:24 PM
To: flang-dev at lists.flang-compiler.org
Subject: [Flang-dev] Flang honoring-DCMAKE_Fortran_COMPILER=${PATH}

Hi

I am trying to build flang the build fails with this error:
[ 25%] Preprocessing ieee_arithmetic.F95
cd /wrkdirs/usr/ports/devel/flang-flang/work/.build/runtime/flang && /usr/bin/cc -E /wrkdirs/usr/ports/devel/flang-flang/work/flang-45d7aeb/runtime/flang/ieee_arithmetic.F95 -DDESC_I8 > I8_sources/ieee_arithmetic.F95
cc: error: unable to execute command: Executable "gcc" doesn't exist!
*** Error code 1

slack user: https://flang-compiler.slack.com/team/U5CNV08UB suggested that I replace cc with flang -E

After making those changes to the generated cmake files located:
.build/runtime/flang/CMakeFiles/flang_shared.dir/build.make

and replacing all calls to cc with flang -E as below
--------------------------------------------------------------------------------------
runtime/flang/I8_sources/ieee_arithmetic.F95:
        @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/wrkdirs/usr/ports/devel/flang-flang/work/.build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Preprocessing ieee_arithmetic.F95"
        cd /wrkdirs/usr/ports/devel/flang-flang/work/.build/runtime/flang && /usr/local/flang/bin/flang -E /wrkdirs/usr/ports/devel/flang-flang/work/flang-45d7aeb/runtime/flang/ieee_arithmetic.F95 -DDESC_I8 > I8_sources/ieee_arithmetic.F95

runtime/flang/I8_sources/ieee_exceptions.F95:
        @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/wrkdirs/usr/ports/devel/flang-flang/work/.build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Preprocessing ieee_exceptions.F95"
        cd /wrkdirs/usr/ports/devel/flang-flang/work/.build/runtime/flang && /usr/local/flang/bin/flang -E /wrkdirs/usr/ports/devel/flang-flang/work/flang-45d7aeb/runtime/flang/ieee_exceptions.F95 -DDESC_I8 > I8_sources/ieee_exceptions.F95

runtime/flang/CMakeFiles/flang_shared.dir/abort3f.c.o: runtime/flang/CMakeFiles/flang_shared.dir/flags.make
runtime/flang/CMakeFiles/flang_shared.dir/abort3f.c.o: /wrkdirs/usr/ports/devel/flang-flang/work/flang-45d7aeb/runtime/flang/abort3f.c
        @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/wrkdirs/usr/ports/devel/flang-flang/work/.build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Building C object runtime/flang/CMakeFiles/flang_shared.dir/abort3f.c.o"
        cd /wrkdirs/usr/ports/devel/flang-flang/work/.build/runtime/flang && /usr/local/flang/bin/flang $(C_DEFINES) -DHAVE_LONG_LONG_INT -DINT32PTR64 -DKANJI -DPGF90 -DTM_I8 $(C_INCLUDES) $(C_FLAGS) -o CMakeFiles/flang_shared.dir/abort3f.c.o   -c /wrkdirs/usr/ports/devel/flang-flang/work/flan
g-45d7aeb/runtime/flang/abort3f.c

runtime/flang/CMakeFiles/flang_shared.dir/abort3f.c.i: cmake_force
        @echo "Preprocessing C source to CMakeFiles/flang_shared.dir/abort3f.c.i"
        cd /wrkdirs/usr/ports/devel/flang-flang/work/.build/runtime/flang && /usr/local/flang/bin/flang $(C_DEFINES) -DHAVE_LONG_LONG_INT -DINT32PTR64 -DKANJI -DPGF90 -DTM_I8 $(C_INCLUDES) $(C_FLAGS) -E /wrkdirs/usr/ports/devel/flang-flang/work/flang-45d7aeb/runtime/flang/abort3f.c > CMakeFile
s/flang_shared.dir/abort3f.c.i

runtime/flang/CMakeFiles/flang_shared.dir/abort3f.c.s: cmake_force
        @echo "Compiling C source to assembly CMakeFiles/flang_shared.dir/abort3f.c.s"
        cd /wrkdirs/usr/ports/devel/flang-flang/work/.build/runtime/flang && /usr/local/flang/bin/flang $(C_DEFINES) -DHAVE_LONG_LONG_INT -DINT32PTR64 -DKANJI -DPGF90 -DTM_I8 $(C_INCLUDES) $(C_FLAGS) -S /wrkdirs/usr/ports/devel/flang-flang/work/flang-45d7aeb/runtime/flang/abort3f.c -o CMakeFil
es/flang_shared.dir/abort3f.c.s
--------------------------------------------------------------------------------------

The project compiles.

My questions is it possible to have the CMake properly generate the files so that I do not have to manually edit them during the middle of a build?

Are there any patches that I could apply to get this to build properly, I don't mind testing it before it's upstreamed.

Best,
Owen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.flang-compiler.org/pipermail/flang-dev_lists.flang-compiler.org/attachments/20180712/d4bb8be9/attachment-0001.html>


More information about the flang-dev mailing list