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

Windows: fixes #288

Open
wants to merge 151 commits into
base: master
Choose a base branch
from
Open

Windows: fixes #288

wants to merge 151 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Oct 25, 2017

No description provided.

@ghost ghost mentioned this pull request Oct 25, 2017
@ghost
Copy link
Author

ghost commented Oct 25, 2017

 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

@@ -133,7 +133,7 @@ __INT_T ENTCOMN(TYPE, type)[] = {
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43};

#if defined(WINNT) && !defined(WIN64) && !defined(WIN32)
#ifdef _WIN32
Copy link
Author

Choose a reason for hiding this comment

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

@sscalpone Thoughts?

@ghost
Copy link
Author

ghost commented Oct 25, 2017

@sscalpone Do you know where the allocated symbols are defined?

@ghost
Copy link
Author

ghost commented Oct 26, 2017

See my comments on #287.

@@ -32,3 +32,4 @@ build_script:
- ps: |
cmake --build . 2>&1 | Out-File build_output.txt
Push-AppveyorArtifact .\build_output.txt
if($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode ) }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this checking the error code of Push-AppveyorArtifact?

Copy link
Author

Choose a reason for hiding this comment

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

That's correct. Ugh.

@ghost
Copy link
Author

ghost commented Oct 26, 2017

@sscalpone Can we schedule a slack time?

@albertziegenhagel
Copy link

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.

@isuruf
Copy link
Collaborator

isuruf commented Oct 26, 2017

f90io_ldw_end should be in flang.dll. Is it being linked?

@albertziegenhagel
Copy link

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!

@isuruf
Copy link
Collaborator

isuruf commented Oct 26, 2017

I compiled a hello world application yesterday and linked to the static libs manually. Hello world was printed and then there was a crash.

@albertziegenhagel
Copy link

I can reproduce the same behavior when linking to the static flang runtime.

@sscalpone
Copy link
Member

PGI does export-all for the libraries.

@ghost
Copy link
Author

ghost commented Oct 26, 2017

@sscalpone Can you answer my question on #287?

@ghost
Copy link
Author

ghost commented Oct 26, 2017

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.

@isuruf
Copy link
Collaborator

isuruf commented Oct 29, 2017

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, isuruf#15 (review)
and need flang-compiler/clang#37 backported for llvm 4.0 branch so that we can run it on appveyor.

@ghost
Copy link
Author

ghost commented Oct 29, 2017

We also need to get the tests working so that we have some idea of where we are.

@isuruf
Copy link
Collaborator

isuruf commented Oct 29, 2017

@xoviat, conda package is available in my channel isuruf/label/flangdev

@ghost
Copy link
Author

ghost commented Oct 29, 2017

Okay.

@insertinterestingnamehere

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?

@isuruf
Copy link
Collaborator

isuruf commented Nov 1, 2017

@insertinterestingnamehere, see #222

@insertinterestingnamehere

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?

@ghost
Copy link
Author

ghost commented Nov 1, 2017

Don't use the ninja generator. Use the nmake makefiles generator.

@insertinterestingnamehere

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.

@ghost
Copy link
Author

ghost commented Nov 1, 2017

Try to compile OpenBLAS with DYNAMIC_ARCH.

@insertinterestingnamehere

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.

xoviat and others added 14 commits January 1, 2018 11:05
The CMake Ninja generator requires the
"use" statement to declare dependnecies
rather than the "use, instrinsic" statement.

Since we're bootsrapping, the "intrinsic"
makes no functional difference and leads
to race conditions.
CMake handles module dependencies now that flang -E works
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.

5 participants