Using a static library (flang wrapper and f18) #897
Comments
|
Will 'flang -v' print out the list of commands that are being executed? Maybe something is wrrong? |
|
Thank you for your reply.
|
|
Look for the following in the output. I think they are in the wrong order. I don't know why.
|
|
Good point. So in order to see if it was just a reordering issue, I tried:
But the result was the same. So I picked the call to the linker and I added
And it worked. So, is it a bug in how the intermediate command lines are generated? |
|
Hi, |
|
Update: in some cases, I have the problem with dynamic libraries too. When I try to compile a Fortran program (here: from the MPICH testsuite), I get
If I look at what mpif77 does, I see:
So I used the trick mentioned above: I looked at the commands executed using flang -v, and I modified the order of the arguments, from:
to
and it compiled successfully. I have updated my wrapper script mentioned above. |
|
If you are compiling f18 yourself, you might modify f18.cc to add another list for object files. Then, in CompileFortran add the relos to the object file list instead of the relocatables. Then, call Link if the object file list is not empty and add the object files to the link command before the relocatables. |
|
Hi Steve, Thank you for your help; I have made the modifications you are indicating and it seems to work. I also needed to make a list for the libraries, because they were still at the beginning of the argument list. With this patch, most MPICH F77 and F90 tests pass. I still have a couple of unrelated compilation errors that I will investigate. The patch is here: |
|
Update:
|
When the f18 frontend calls the link editor, put the libraries and object files in the correct order. Fixes the issues reported here flang-compiler/flang#897 Reviewed By: sscalpone, AlexisPerry Differential Revision: https://reviews.llvm.org/D84340
When the f18 frontend calls the link editor, put the libraries and object files in the correct order. Fixes the issues reported here flang-compiler/flang#897 Reviewed By: sscalpone, AlexisPerry Differential Revision: https://reviews.llvm.org/D84340 (cherry picked from commit ca0bf44)
When the f18 frontend calls the link editor, put the libraries and object files in the correct order. Fixes the issues reported here flang-compiler/flang#897 Reviewed By: sscalpone, AlexisPerry Differential Revision: https://reviews.llvm.org/D84340 (cherry picked from commit ca0bf44)
When the f18 frontend calls the link editor, put the libraries and object files in the correct order. Fixes the issues reported here flang-compiler/flang#897 Reviewed By: sscalpone, AlexisPerry Differential Revision: https://reviews.llvm.org/D84340
Hello,
I am trying to use a static library written in Fortran and called from a program written in Fortran.
My test files are located here. In particular, I use:
However, if I look at the symbols defined in my static library, I can find them:
If I use a dynamic library, it works fine
If I try to link against my static library using the same command-line, the symbols are not found:
I also tried using
-fno-underscoringin order to avoid the trailing_:I have the same errors with f18. If works fine with gfortran:
Is there anything particular to do if I want to work with static libraries?
The text was updated successfully, but these errors were encountered: