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

Compilation Errors and Linker Issues in Fortran Code #1

Closed
Foadsf opened this issue Apr 24, 2024 · 0 comments · Fixed by #3
Closed

Compilation Errors and Linker Issues in Fortran Code #1

Foadsf opened this issue Apr 24, 2024 · 0 comments · Fixed by #3

Comments

@Foadsf
Copy link
Owner

Foadsf commented Apr 24, 2024

Description

I encountered multiple compilation and linker errors when building the NASTRAN-95 project with Intel oneAPI and the Microsoft Visual Studio toolchain. These include syntax errors with directives, multiple definitions of MAIN__, and unresolved external symbols.

Errors

Compilation Warnings:

The following warnings appear for Fortran files partn3.f, rcard.f, rcard2.f indicating syntax errors with directives:

C:\dev\NASTRAN-95\mis\partn3.f(2): remark #5082: Directive ignored - Syntax error, found '=' when expecting one of: :
CDIR$ INTEGER=64

Similar errors are repeated across the specified files.

Linker Errors:

Linking the Fortran executable results in errors related to multiple definitions and unresolved external symbols:

chkfil.f.obj : error LNK2005: MAIN__ already defined in nastrn.f.obj
shtrmd.f.obj : error LNK2019: unresolved external symbol Q8SHPD referenced in function SHTRMD
C:\dev\NASTRAN-95\bin\nastran.exe : fatal error LNK1120: 3 unresolved externals

Unrecognized Directives:

Additional warnings about unrecognized directives in dsupkc.f:

C:\dev\NASTRAN-95\mds\dsupkc.f(12): remark #5140: Unrecognized directive
CDIR$ NEXTSCALAR

Build Environment

  • Compiler: Intel oneAPI
  • IDE: Microsoft Visual Studio 2022
  • Build tool: CMake, NMAKE

Steps to Reproduce

  1. Clone the repository from dev branch and this commit.
  2. Run the build process as per the setup instructions using the build.bat script.

Expected Behavior

The project should compile without errors and link all symbols correctly.

Actual Behavior

Compilation stops with syntax errors on Fortran directives, and the linker fails with multiple definitions and unresolved symbols errors.

Possible Solutions

  • Review and correct the syntax of the Fortran directive.
  • Ensure that there is no duplication in the definition of MAIN__ across different files.
  • Verify and ensure all external symbols are defined and correctly linked.

This issue needs attention to correct the errors for a successful build. Any help or insights are welcome!

Foadsf referenced this issue Apr 24, 2024
with both Intel's ifrot and GNU's GFortran
Foadsf added a commit that referenced this issue Apr 26, 2024
```
The use of 64-bit integers can be specified by -i64 in the cft77 command, INTEGER=64 in the CFT77 control statement, or CDIR$ INTEGER=64 in your program.
```

so I wrapped the lines including the Cray compiler directive (`CDIR$`) like:

```fortran
!DEC$ IF DEFINED(CRAY_COMPILER)
CDIR$ <...>
!DEC$ ENDIF
```

and instructed `ifort.exe` with `/integer-size=64`

this partly solves issue #1 [here](#1)
@Foadsf Foadsf closed this as completed Apr 26, 2024
@Foadsf Foadsf linked a pull request Apr 27, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant