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

Fortan Mangling error on Windows when compiler flags are set #23

Closed
lefebvre opened this issue Sep 25, 2014 · 6 comments
Closed

Fortan Mangling error on Windows when compiler flags are set #23

lefebvre opened this issue Sep 25, 2014 · 6 comments
Assignees

Comments

@lefebvre
Copy link

There is an issue with the config_tests/FortranMangling.cmake.
The issues stems from Windows variety of system libraries.
One can use /MD[d] /MT[d] /LD[d] for linking their different libraries MSVCRT.lib, MSVCRTD.lib, LIBCMT.lib, LIBCMTD.lib.
CMake typically defaults to /MD for release and /MDd for debug.
If one needs a static build overriding all compiler flags with /MT[d] is necessary.
The FortranMangling.cmake doesn't pass the build type compiler flags through which usually results in duplicate defined symbols, because C/C++ will link against LIBCMT and Fortran will link agains MSVCRT.
This patch resolves the issue.

--- a/cmake/tribits/config_tests/FortranMangling.cmake    Thu Jul 17 15:26:06 2014 -0400
+++ b/cmake/tribits/config_tests/FortranMangling.cmake    Tue Sep 23 13:48:57 2014 -0400
@@ -99,7 +99,9 @@
         SET(F_FLAGS "${CMAKE_Fortran_FLAGS} ${${PROJECT_NAME}_EXTRA_LINK_FLAGS}")
         TRY_COMPILE(_fcmngl ${_fcmangledir_case} ${_fcmakelists} fmangle
           CMAKE_FLAGS "-DCMAKE_C_FLAGS:STRING=${C_FLAGS}"
+          "-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}"
           "-DCMAKE_Fortran_FLAGS:STRING=${F_FLAGS}"
+          "-DCMAKE_Fortran_FLAGS_RELEASE:STRING=${CMAKE_Fortran_FLAGS_RELEASE}"
           "-DCOMMON_DEFS=${COMMON_DEFS}"
           OUTPUT_VARIABLE _fcmngl_output
           )
@bartlettroscoe
Copy link
Member

Jordan,

Can you create a branch off of github/master and then point to it here or do a pull request? Call the branch something like fix_fortran_managling_23. I should be able to get to this today or tomorrow.

@bartlettroscoe bartlettroscoe added this to the 2_selected milestone Sep 25, 2014
@bartlettroscoe
Copy link
Member

Jordan,

Assuming that you have not created a branch for this, I will apply the patch and push to the TriBITS master branches on github and casl-dev.

@bartlettroscoe bartlettroscoe modified the milestones: 3_in_progress, 2_selected Oct 5, 2014
bartlettroscoe pushed a commit that referenced this issue Oct 5, 2014
There is an issue with the config_tests/FortranMangling.cmake.  The issues
stems from Windows variety of system libraries.  One can use /MD[d] /MT[d]
/LD[d] for linking their different libraries MSVCRT.lib, MSVCRTD.lib,
LIBCMT.lib, LIBCMTD.lib.  CMake typically defaults to /MD for release and /MDd
for debug.  If one needs a static build overriding all compiler flags with
/MT[d] is necessary.  The FortranMangling.cmake doesn't pass the build type
compiler flags through which usually results in duplicate defined symbols,
because C/C++ will link against LIBCMT and Fortran will link agains MSVCRT.
This patch resolves the issue.
bartlettroscoe pushed a commit that referenced this issue Oct 5, 2014
To make consistent with the outer TriBITS project build-type, here I have made
general for all CMAKE_BUILD_TYPE, not just CMAKE_BUILD_TYPE=RELEASE.

Build/Test Cases Summary
Enabled Packages:
Enabled all Packages
0) MPI_DEBUG => passed: passed=652,notpassed=0 (39.98 min)
1) SERIAL_RELEASE => passed: passed=560,notpassed=0 (6.21 min)
Other local commits for this build/test group: edcd8e5, 07fe96f, e475583, a955807
@bartlettroscoe
Copy link
Member

@lefebvre,

I just pushed your commit and a commit I made to generalize this for any CMAKE_BUILD_TYPE. This has been pushed to github/master (as you can see in this Issue ticket) and to the TriBITS git repo on casl-dev.

Please give this a try and let me know if it fixes your issues.

@bartlettroscoe bartlettroscoe modified the milestones: 4_in_review, 3_in_progress Oct 5, 2014
@bartlettroscoe
Copy link
Member

I have pushed these changes to pass the Fortran flags to the name managning determination code back to Trilinos proper in the below snapshot of TriBITS into Trilinos.

Hopefully this will fix this issue for users of Trilinos on this platform on the next Trilinos release that is about to be frozen.

Jordan,

I will assume this is complete until I hear from you.

From: [email protected] [mailto:trilinos-
[email protected]] On Behalf Of
[email protected]
Sent: Monday, October 06, 2014 9:43 AM
To: [email protected]
Subject: [Trilinos-Checkins] [Trilinos] rabartl pushed to master

rabartl pushed the following commits to the "master" branch:

commit 0f07f0be154d73d9d2d48015a549a7b822744f4c
Author: Roscoe A. Bartlett <[email protected]>
Date:   Mon Oct 6 09:34:59 2014 -0400

    Automatic snapshot commit from TriBITS at e908f96

    Origin repo remote tracking branch: 'origin/master'
    Origin repo remote repo URL: 'origin = [email protected]:TriBITSPub/TriBITS'

    At commit:

    e908f96 Updated generated files.
    Author: Roscoe A. Bartlett <[email protected]>
    Date: Mon Oct 6 09:33:48 2014 -0400

    Build/Test Cases Summary
    Enabled Packages: TriBITS, Teuchos
    Disabled Packages:
CTrilinos,ForTrilinos,PyTrilinos,Didasko,Mesquite,Phdmesh,Pliris,Claps,Ames
os2,STK,FEApp,TriKota
    0) MPI_DEBUG => passed: passed=262,notpassed=0 (1.49 min)
    1) SERIAL_RELEASE => passed: passed=255,notpassed=0 (1.06 min)

-------------------------------------------------------------------------------

Limited summary of changes (large patch):
  78.1% cmake/tribits/doc/developers_guide/
   4.7% cmake/tribits/doc/examples/TribitsExampleProject/packages/mixed_lang/src/
   4.7% cmake/tribits/doc/examples/TribitsExampleProject/packages/mixed_language/src/
   3.7% cmake/tribits/doc/examples/TribitsExampleProject/packages/
   4.6% cmake/tribits/doc/examples/UnitTests/
   3.9% cmake/tribits/

----
Trilinos
Git repository: software.sandia.gov:/sems/git/Trilinos
_______________________________________________
Trilinos-Checkins mailing list
[email protected]
https://software.sandia.gov/mailman/listinfo/trilinos-checkins

bartlettroscoe pushed a commit to bartlettroscoe/TriBITS that referenced this issue Dec 3, 2014
There is an issue with the config_tests/FortranMangling.cmake.  The issues
stems from Windows variety of system libraries.  One can use /MD[d] /MT[d]
/LD[d] for linking their different libraries MSVCRT.lib, MSVCRTD.lib,
LIBCMT.lib, LIBCMTD.lib.  CMake typically defaults to /MD for release and /MDd
for debug.  If one needs a static build overriding all compiler flags with
/MT[d] is necessary.  The FortranMangling.cmake doesn't pass the build type
compiler flags through which usually results in duplicate defined symbols,
because C/C++ will link against LIBCMT and Fortran will link agains MSVCRT.
This patch resolves the issue.
bartlettroscoe pushed a commit to bartlettroscoe/TriBITS that referenced this issue Dec 3, 2014
To make consistent with the outer TriBITS project build-type, here I have made
general for all CMAKE_BUILD_TYPE, not just CMAKE_BUILD_TYPE=RELEASE.

Build/Test Cases Summary
Enabled Packages:
Enabled all Packages
0) MPI_DEBUG => passed: passed=652,notpassed=0 (39.98 min)
1) SERIAL_RELEASE => passed: passed=560,notpassed=0 (6.21 min)
Other local commits for this build/test group: edcd8e5, 07fe96f, e475583, a955807
@bartlettroscoe
Copy link
Member

Jordan (@lefebvre),

Can you confirm that this issue has been resolved on your side?

@bartlettroscoe
Copy link
Member

@lefebvre. I am going to assume this is fixed given there was no response since July.

@bartlettroscoe bartlettroscoe modified the milestones: 6_deployed, 4_in_review Dec 16, 2015
@bartlettroscoe bartlettroscoe self-assigned this Dec 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants