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

Fix compiler issues #5160

Merged
merged 1 commit into from
May 2, 2024
Merged

Conversation

macumber
Copy link
Contributor

Pull request overview

Fixes compiler issues I hit when attempting to build with Microsoft Visual Studio Community 2022 (64-bit) - Version 17.9.6

New definitions needed to overcome:

Severity	Code	Description	Project	File	Line	Suppression State	Details
Warning	C4996	'stdext::checked_array_iterator<T *>': warning STL4043: stdext::checked_array_iterator, stdext::unchecked_array_iterator, and related factory functions are non-Standard extensions and will be removed in the future. std::span (since C++20) and gsl::span can be used instead. You can define _SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING or _SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS to suppress this warning.
        with
        [
            T=fmt::v9::detail::bigint::bigit
        ]	GenerateIddFactory	C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\xutility	1151		

Public linking of openstudiolib in openstudio_workflow needed to overcome:

Severity	Code	Description	Project	File	Line	Suppression State	Details
Error	LNK2005	"public: virtual __cdecl openstudio::IdfObject::~IdfObject(void)" (??1IdfObject@openstudio@@UEAA@XZ) already defined in RunPreProcessMonthlyReports_GTest.obj	openstudio_workflow_tests	C:\repos\os\debug\src\workflow\openstudiolib.lib(openstudiolib.dll)	1	

Pull Request Author

  • Model API Changes / Additions
  • Any new or modified fields have been implemented in the EnergyPlus ForwardTranslator (and ReverseTranslator as appropriate)
  • Model API methods are tested (in src/model/test)
  • EnergyPlus ForwardTranslator Tests (in src/energyplus/Test)
  • If a new object or method, added a test in NREL/OpenStudio-resources: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Verified that C# bindings built fine on Windows, partial classes used as needed, etc.
  • All new and existing tests passes
  • If methods have been deprecated, update rest of code to use the new methods

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified

Comment on lines +614 to +617
# ignore c++20 deprecation warnings generated by fmt
add_definitions(-D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING)
add_definitions(-D_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't really have an issue with these

@@ -25,7 +25,7 @@ add_library(openstudio_workflow
Timer.cpp
)

target_link_libraries(openstudio_workflow PRIVATE openstudiolib)
target_link_libraries(openstudio_workflow PUBLIC openstudiolib)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This one looks slightly problematic to me, especially since it appears the issue is in the workflow_test

Severity	Code	Description	Project	File	Line	Suppression State	Details
Error	LNK2005	"public: virtual __cdecl openstudio::IdfObject::~IdfObject(void)" (??1IdfObject@openstudio@@UEAA@XZ) already defined in RunPreProcessMonthlyReports_GTest.obj	openstudio_workflow_tests	C:\repos\os\debug\src\workflow\openstudiolib.lib(openstudiolib.dll)	1	

Copy link
Contributor Author

@macumber macumber Apr 23, 2024

Choose a reason for hiding this comment

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

That is the linker error that this change fixes, I don't know why you would want to PRIVATE link openstudiolib with openstudio_workflow, I don't think you can use openstudio_workflow without also linking openstudiolib

Copy link
Contributor Author

@macumber macumber Apr 23, 2024

Choose a reason for hiding this comment

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

It's possible that this might work instead, I'll try it out:

-target_link_libraries(openstudio_workflow PUBLIC openstudiolib)
+target_link_libraries(openstudio_workflow PRIVATE openstudiolib)

 if(BUILD_TESTING)
   set(openstudio_workflow_test_depends
+    openstudiolib
     openstudio_workflow
-    boost::boost # Maybe at some point replace with openstudiolib more simply
-    fmt::fmt
   )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup that works, I can push if you prefer. However, that requires anyone who links openstudio_workflow to also link openstudiolib which is what the PUBLIC link option does.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think anyone should link to openstudio_workflow.

Copy link
Contributor

Choose a reason for hiding this comment

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

Public is fine to me. You guys understand the implications.

@jmarrec jmarrec added Developer Issue Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. labels Apr 25, 2024
@jmarrec jmarrec added this to the OpenStudio SDK 3.8.0 milestone Apr 29, 2024
@jmarrec jmarrec requested a review from kbenne May 2, 2024 20:21
@jmarrec
Copy link
Collaborator

jmarrec commented May 2, 2024

@kbenne any opinion here? please

@kbenne kbenne merged commit 1b8f215 into NREL:develop May 2, 2024
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Developer Issue Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants