Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update module output directory command for flang-new/f18 #645

Merged
merged 1 commit into from
Jan 10, 2022

Conversation

awvwgk
Copy link
Member

@awvwgk awvwgk commented Jan 9, 2022

Currently the new LLVM flang driver is mistaken for the classic flang driver and therefore it fails with

❯ fpm build --compiler flang-new -C example_packages/hello_fpm
fpm: Entering directory '/home/awvwgk/projects/src/git/fortran-package-manager/example_packages/hello_fpm'
 + mkdir -p build/dependencies
 + mkdir -p build/flang-new_00000000811C9DC5/hello_fpm
 + flang-new -c ./../hello_complex/source/subdir/constants.f90  -module build/flang-new_00000000811C9DC5/hello_fpm -I build/flang-new_00000000811C9DC5/hello_fpm  -o build/flang-new_00000000811C9DC5/hello_fpm/.._hello_complex_source_subdir_constants.f90.o

With this patch we can run the flang-new driver and get the expected error due to missing code generation:

❯ ./fpm-flang build --compiler flang-new -C example_packages/hello_fpm
fpm: Entering directory '/home/awvwgk/projects/src/git/fortran-package-manager/example_packages/hello_fpm'
 + mkdir -p build/dependencies
 + mkdir -p build/flang-new_00000000811C9DC5
 + mkdir -p build/flang-new_00000000811C9DC5/hello_fpm/
 + flang-new -c ./../hello_complex/source/subdir/constants.f90  -module-dir build/flang-new_00000000811C9DC5 -Ibuild/flang-new_00000000811C9DC5 -o build/flang-new_00000000811C9DC5/hello_fpm/.._hello_complex_source_subdir_constants.f90.o
error: code-generation is not available yet

The f18 driver is less picky and takes -J, -module and -module-dir to specify the module output directory, I went with the latter since this is apparently in line with flang-new.


Note that there is flang in LLVM flang which is not the classic flang compiler, but presumably an internal component for the flang-new / f18 drivers (or maybe the other way round?). We will currently detect it as classic flang and fail with

❯ ./fpm-flang build --compiler flang -C example_packages/hello_fpm
fpm: Entering directory '/home/awvwgk/projects/src/git/fortran-package-manager/example_packages/hello_fpm'
 + mkdir -p build/flang_00000000811C9DC5
 + mkdir -p build/flang_00000000811C9DC5/hello_fpm/
 + flang -c ../hello_complex/source/subdir/constants.f90  -module build/flang_00000000811C9DC5 -Ibuild/flang_00000000811C9DC5 -o build/flang_00000000811C9DC5/hello_fpm/.._hello_complex_source_subdir_constants.f90.o
error: unknown argument: '-module build/flang_00000000811C9DC5'
flang: in /home/awvwgk/projects/src/git/fortran-package-manager/example_packages/hello_fpm, flang-new failed with exit status 1: /usr/bin/flang-new -fc1 -Ibuild/flang_00000000811C9DC5 -module-suffix .f18.mod -fdebug-unparse -fno-analyzed-objects-for-unparse -module-dir build/flang_00000000811C9DC5 -c ../hello_complex/source/subdir/constants.f90 -module build/flang_00000000811C9DC5 -Ibuild/flang_00000000811C9DC5 -o build/flang_00000000811C9DC5/hello_fpm/.._hello_complex_source_subdir_constants.f90.o

But I can't figure out how I'm supposed to correctly use it anyway.

@awvwgk awvwgk linked an issue Jan 9, 2022 that may be closed by this pull request
Copy link
Member

@LKedward LKedward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, cheers 👍

@awvwgk awvwgk merged commit 32401f1 into fortran-lang:main Jan 10, 2022
@awvwgk awvwgk deleted the flang branch January 10, 2022 07:13
@awvwgk awvwgk added this to the v0.6.0 milestone Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues with flang/flang-new/f18
2 participants