flang
flang copied to clipboard
Windows: fixes
Creating library ..\..\lib\flang.lib and object ..\..\lib\flang.exp
[00:07:40] mmulcplx16.c.obj : error LNK2019: unresolved external symbol pg_mm_cplx16_str1_mxv_ referenced in function pgf90_matmul_cplx16
[00:07:40] mmulcplx16.c.obj : error LNK2019: unresolved external symbol pg_mm_cplx16_str1_vxm_ referenced in function pgf90_matmul_cplx16
[00:07:40] mmulcplx16.c.obj : error LNK2019: unresolved external symbol pg_mm_cplx16_str1_ referenced in function pgf90_matmul_cplx16
[00:07:40] mmulcplx16_t.c.obj : error LNK2019: unresolved external symbol pg_mm_cplx16_str1_mxv_t_ referenced in function pgf90_matmul_cplx16mxv_t
[00:07:40] mmulcplx8.c.obj : error LNK2019: unresolved external symbol pg_mm_cplx8_str1_mxv_ referenced in function pgf90_matmul_cplx8
[00:07:40] mmulcplx8.c.obj : error LNK2019: unresolved external symbol pg_mm_cplx8_str1_vxm_ referenced in function pgf90_matmul_cplx8
[00:07:40] mmulcplx8.c.obj : error LNK2019: unresolved external symbol pg_mm_cplx8_str1_ referenced in function pgf90_matmul_cplx8
[00:07:40] mmulcplx8_t.c.obj : error LNK2019: unresolved external symbol pg_mm_cplx8_str1_mxv_t_ referenced in function pgf90_matmul_cplx8mxv_t
[00:07:40] mmulint1.c.obj : error LNK2019: unresolved external symbol pg_mm_int1_str1_mxv_ referenced in function pgf90_matmul_int1
[00:07:40] mmulint1.c.obj : error LNK2019: unresolved external symbol pg_mm_int1_str1_vxm_ referenced in function pgf90_matmul_int1
[00:07:40] mmulint1.c.obj : error LNK2019: unresolved external symbol pg_mm_int1_str1_ referenced in function pgf90_matmul_int1
[00:07:40] mmulint2.c.obj : error LNK2019: unresolved external symbol pg_mm_int2_str1_mxv_ referenced in function pgf90_matmul_int2
[00:07:40] mmulint2.c.obj : error LNK2019: unresolved external symbol pg_mm_int2_str1_vxm_ referenced in function pgf90_matmul_int2
[00:07:40] mmulint2.c.obj : error LNK2019: unresolved external symbol pg_mm_int2_str1_ referenced in function pgf90_matmul_int2
[00:07:40] mmulint4.c.obj : error LNK2019: unresolved external symbol pg_mm_int4_str1_mxv_ referenced in function pgf90_matmul_int4
[00:07:40] mmulint4.c.obj : error LNK2019: unresolved external symbol pg_mm_int4_str1_vxm_ referenced in function pgf90_matmul_int4
[00:07:40] mmulint4.c.obj : error LNK2019: unresolved external symbol pg_mm_int4_str1_ referenced in function pgf90_matmul_int4
[00:07:40] mmulint8.c.obj : error LNK2019: unresolved external symbol pg_mm_int8_str1_mxv_ referenced in function pgf90_matmul_int8
[00:07:40] mmulint8.c.obj : error LNK2019: unresolved external symbol pg_mm_int8_str1_vxm_ referenced in function pgf90_matmul_int8
[00:07:40] mmulint8.c.obj : error LNK2019: unresolved external symbol pg_mm_int8_str1_ referenced in function pgf90_matmul_int8
[00:07:40] mmulreal4.c.obj : error LNK2019: unresolved external symbol pg_mm_real4_str1_mxv_ referenced in function pgf90_matmul_real4
[00:07:40] mmulreal4.c.obj : error LNK2019: unresolved external symbol pg_mm_real4_str1_vxm_ referenced in function pgf90_matmul_real4
[00:07:40] mmulreal4.c.obj : error LNK2019: unresolved external symbol pg_mm_real4_str1_ referenced in function pgf90_matmul_real4
[00:07:40] mmulreal4_t.c.obj : error LNK2019: unresolved external symbol pg_mm_real4_str1_mxv_t_ referenced in function pgf90_matmul_real4mxv_t
[00:07:40] mmulreal8.c.obj : error LNK2019: unresolved external symbol pg_mm_real8_str1_mxv_ referenced in function pgf90_matmul_real8
[00:07:40] mmulreal8.c.obj : error LNK2019: unresolved external symbol pg_mm_real8_str1_vxm_ referenced in function pgf90_matmul_real8
[00:07:40] mmulreal8.c.obj : error LNK2019: unresolved external symbol pg_mm_real8_str1_ referenced in function pgf90_matmul_real8
[00:07:40] mmulreal8_t.c.obj : error LNK2019: unresolved external symbol pg_mm_real8_str1_mxv_t_ referenced in function pgf90_matmul_real8mxv_t
[00:07:40] mtaxtb_cmplx16.F95.obj : error LNK2019: unresolved external symbol f90_alloc04_chk referenced in function ftn_mtaxtb_cmplx16_
[00:07:40] mtaxtb_cmplx8.F95.obj : error LNK2001: unresolved external symbol f90_alloc04_chk
[00:07:40] mtaxtb_real4.F95.obj : error LNK2001: unresolved external symbol f90_alloc04_chk
[00:07:40] mtaxtb_real8.F95.obj : error LNK2001: unresolved external symbol f90_alloc04_chk
[00:07:40] mtaxnb_cmplx16.F95.obj : error LNK2001: unresolved external symbol f90_alloc04_chk
[00:07:40] mtaxnb_cmplx8.F95.obj : error LNK2001: unresolved external symbol f90_alloc04_chk
[00:07:40] mtaxnb_real4.F95.obj : error LNK2001: unresolved external symbol f90_alloc04_chk
[00:07:40] mtaxnb_real8.F95.obj : error LNK2001: unresolved external symbol f90_alloc04_chk
[00:07:40] mnaxtb_cmplx16.F95.obj : error LNK2001: unresolved external symbol f90_alloc04_chk
[00:07:40] mnaxtb_cmplx8.F95.obj : error LNK2001: unresolved external symbol f90_alloc04_chk
[00:07:40] mnaxtb_real4.F95.obj : error LNK2001: unresolved external symbol f90_alloc04_chk
[00:07:40] mnaxtb_real8.F95.obj : error LNK2001: unresolved external symbol f90_alloc04_chk
[00:07:40] mnaxnb_cmplx16.F95.obj : error LNK2001: unresolved external symbol f90_alloc04_chk
[00:07:40] mnaxnb_cmplx8.F95.obj : error LNK2001: unresolved external symbol f90_alloc04_chk
[00:07:40] mnaxnb_real4.F95.obj : error LNK2001: unresolved external symbol f90_alloc04_chk
[00:07:40] mnaxnb_real8.F95.obj : error LNK2001: unresolved external symbol f90_alloc04_chk
[00:07:40] mtaxtb_cmplx16.F95.obj : error LNK2019: unresolved external symbol f90_dealloc03 referenced in function ftn_mtaxtb_cmplx16_
[00:07:40] mtaxtb_cmplx8.F95.obj : error LNK2001: unresolved external symbol f90_dealloc03
[00:07:40] mtaxtb_real4.F95.obj : error LNK2001: unresolved external symbol f90_dealloc03
[00:07:40] mtaxtb_real8.F95.obj : error LNK2001: unresolved external symbol f90_dealloc03
[00:07:40] mtaxnb_cmplx16.F95.obj : error LNK2001: unresolved external symbol f90_dealloc03
[00:07:40] mtaxnb_cmplx8.F95.obj : error LNK2001: unresolved external symbol f90_dealloc03
[00:07:40] mtaxnb_real4.F95.obj : error LNK2001: unresolved external symbol f90_dealloc03
[00:07:40] mtaxnb_real8.F95.obj : error LNK2001: unresolved external symbol f90_dealloc03
[00:07:40] mnaxtb_cmplx16.F95.obj : error LNK2001: unresolved external symbol f90_dealloc03
[00:07:40] mnaxtb_cmplx8.F95.obj : error LNK2001: unresolved external symbol f90_dealloc03
[00:07:40] mnaxtb_real4.F95.obj : error LNK2001: unresolved external symbol f90_dealloc03
[00:07:40] mnaxtb_real8.F95.obj : error LNK2001: unresolved external symbol f90_dealloc03
[00:07:40] mnaxnb_cmplx16.F95.obj : error LNK2001: unresolved external symbol f90_dealloc03
[00:07:40] mnaxnb_cmplx8.F95.obj : error LNK2001: unresolved external symbol f90_dealloc03
[00:07:40] mnaxnb_real4.F95.obj : error LNK2001: unresolved external symbol f90_dealloc03
[00:07:40] mnaxnb_real8.F95.obj : error LNK2001: unresolved external symbol f90_dealloc03
[00:07:40] mtaxtb_cmplx16.F95.obj : error LNK2019: unresolved external symbol f90_allocated referenced in function ftn_mtaxtb_cmplx16_
[00:07:40] mtaxtb_cmplx8.F95.obj : error LNK2001: unresolved external symbol f90_allocated
[00:07:40] mtaxtb_real4.F95.obj : error LNK2001: unresolved external symbol f90_allocated
[00:07:40] mtaxtb_real8.F95.obj : error LNK2001: unresolved external symbol f90_allocated
[00:07:40] mtaxnb_cmplx16.F95.obj : error LNK2001: unresolved external symbol f90_allocated
[00:07:40] mtaxnb_cmplx8.F95.obj : error LNK2001: unresolved external symbol f90_allocated
[00:07:40] mtaxnb_real4.F95.obj : error LNK2001: unresolved external symbol f90_allocated
[00:07:40] mtaxnb_real8.F95.obj : error LNK2001: unresolved external symbol f90_allocated
[00:07:40] mnaxtb_cmplx16.F95.obj : error LNK2001: unresolved external symbol f90_allocated
[00:07:40] mnaxtb_cmplx8.F95.obj : error LNK2001: unresolved external symbol f90_allocated
[00:07:40] mnaxtb_real4.F95.obj : error LNK2001: unresolved external symbol f90_allocated
[00:07:40] mnaxtb_real8.F95.obj : error LNK2001: unresolved external symbol f90_allocated
[00:07:40] mnaxnb_cmplx16.F95.obj : error LNK2001: unresolved external symbol f90_allocated
[00:07:40] mnaxnb_cmplx8.F95.obj : error LNK2001: unresolved external symbol f90_allocated
[00:07:40] mnaxnb_real4.F95.obj : error LNK2001: unresolved external symbol f90_allocated
[00:07:40] mnaxnb_real8.F95.obj : error LNK2001: unresolved external symbol f90_allocated
[00:07:40] ..\..\bin\flang.dll : fatal error LNK1120: 31 unresolved externals
@sscalpone Do you know where the allocated
symbols are defined?
See my comments on #287.
@sscalpone Can we schedule a slack time?
I've just opened a pull request at flang-compiler/clang#37 that applies additional changes to the compiler driver. These changes add additional linker arguments so that the correct runtime libraries are linked.
Calling flang main.f90
on a simple hello world program now gives me
warning: overriding the module target triple with x86_64-pc-windows-msvc19.11.25547 [-Woverride-module]
1 warning generated.
libcmt.lib(initializers.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
main-99545d.o : error LNK2019: unresolved external symbol fort_init referenced in function _MAIN_
main-99545d.o : error LNK2019: unresolved external symbol f90io_src_info03 referenced in function _MAIN_
main-99545d.o : error LNK2019: unresolved external symbol f90io_print_init referenced in function _MAIN_
main-99545d.o : error LNK2019: unresolved external symbol f90io_sc_ch_ldw referenced in function _MAIN_
main-99545d.o : error LNK2019: unresolved external symbol f90io_ldw_end referenced in function _MAIN_
flangmain.lib(flangmain.c.obj) : error LNK2019: unresolved external symbol _pgimain referenced in function main
flangmain.lib(flangmain.c.obj) : error LNK2019: unresolved external symbol MAIN_ referenced in function main
flangmain.lib(flangmain.c.obj) : error LNK2019: unresolved external symbol f90_exit referenced in function main
a.exe : fatal error LNK1120: 8 unresolved externals
flang.exe: error: linker command failed with exit code 1120 (use -v to see invocation)
so there are still some basic symbols missing. If I take a look at flangmain.c
, it looks as if this file has not yet been adjusted correctly since it has been taken from PGI.
After these symbol errors would be resolved, I would start to look into making the test-suite work on windows, so that we can get a clearer image of what is really working and what is not.
f90io_ldw_end
should be in flang.dll
. Is it being linked?
It was a missing __declspec(dllexport)
again. WINDOWS_EXPORT_ALL_SYMBOLS solved that.
Now the executable links successfully but does not produce any output when being executed. I will dig deeper into that!
I compiled a hello world application yesterday and linked to the static libs manually. Hello world was printed and then there was a crash.
I can reproduce the same behavior when linking to the static flang runtime.
PGI does export-all for the libraries.
@sscalpone Can you answer my question on #287?
So I think we removed the signal handlers because they don't work with MSVC. I'm going to attempt to install a signal handler that will work for us.
I don't know which of the above incremental changes fixed it for me, but a simple hello world works as intended now. Hooray!
Couple of issues, https://github.com/isuruf/flang/pull/15#pullrequestreview-72685585 and need https://github.com/flang-compiler/clang/pull/37 backported for llvm 4.0 branch so that we can run it on appveyor.
We also need to get the tests working so that we have some idea of where we are.
@xoviat, conda package is available in my channel isuruf/label/flangdev
Okay.
Using the latest conda package from this I haven't been able to get a minimal working example yet because things like flang -cpp -E hello.f90 -o hello.f90-pp.f90
don't actually do anything. That command should output a preprocessed file. Am I missing something in the command line interface or is there a bug that needs to be addressed here?
@insertinterestingnamehere, see https://github.com/flang-compiler/flang/issues/222
Got it. That makes sense. Is there some way to get around needing to run that command on testFortranCompiler.f
when using CMake or is that something that still needs to be done?
Don't use the ninja generator. Use the nmake makefiles generator.
Thanks. Good find. A minimal hello world example is working with CMake for me. I'm using NMake in the MSVC 2015 native x64 terminal and had to set the LIB
environment variable to include the Anaconda Library/lib
directory.
Try to compile OpenBLAS with DYNAMIC_ARCH.
That also configures correctly. Compilation will take a while. Note I'm also using the patches from all three of the PR's listed at https://gitlab.kitware.com/cmake/cmake/issues/17384.
@insertinterestingnamehere, you need to give -DBUILD_WITHOUT_LAPACK=Off
because it is off by default with MSVC.
Right. It looks like there is some additional work to be done in their CMakeLists files. I'll see what I can do.