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

Request to add "-Wno-implicit-function-declaration" flag to silence implicit function declaration error #5

Closed
puneetmatharu opened this issue May 31, 2021 · 1 comment

Comments

@puneetmatharu
Copy link

puneetmatharu commented May 31, 2021

Hi,

I was trying to build the MUMPS library as part of a separate CMake-based project and when I do, I get -Wimplicit-function-declaration warnings which flare up as errors. To address this, I currently have a patch file that adds the C flag -Wno-implicit-function-declaration using the following code:

# Append to current flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-implicit-function-declaration")

ExternalProject_Add(
  SCALAPACK
  GIT_REPOSITORY ${scalapack_git}
  GIT_TAG ${scalapack_tag}
  UPDATE_DISCONNECTED ${EP_UPDATE_DISCONNECTED}
  CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${SCALAPACK_ROOT}
             -DLAPACK_ROOT:PATH=${LAPACK_ROOT}
             -DBUILD_SHARED_LIBS:BOOL=false
             -DCMAKE_BUILD_TYPE=Release
             -DBUILD_TESTING:BOOL=false
             -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}      # Specify flags in CMake arguments
  CMAKE_CACHE_ARGS -Darith:STRING=${arith}
  PATCH_COMMAND ${PATCH_COMMAND}
  BUILD_BYPRODUCTS ${SCALAPACK_LIBRARIES} 
  INACTIVITY_TIMEOUT 30
  CONFIGURE_HANDLED_BY_BUILD ON)

Would you have any problem with adding this flag in to prevent it from blocking the build of the project? I think this would be helpful for projects that pull MUMPS in using FetchControl or ExternalProject. If you'd like, I could create a PR for this.

Thanks!
Puneet

P.S. As I write this, I see that it would be more natural to append the flags with the following code:

# Append to current flags
list(APPEND CMAKE_C_FLAGS -Wno-implicit-function-declaration)
@puneetmatharu puneetmatharu changed the title Request to add C compiler flags to silence implicit function declaration error Request to add -Wno-implicit-function-declaration flag to silence "implicit function declaration" error May 31, 2021
@puneetmatharu puneetmatharu changed the title Request to add -Wno-implicit-function-declaration flag to silence "implicit function declaration" error Request to add "-Wno-implicit-function-declaration" flag to silence implicit function declaration error May 31, 2021
scivision added a commit that referenced this issue Jun 16, 2021
@puneetmatharu
Copy link
Author

Hi, in the commit that you closed this issue with, you added a flag to scalapack_c_flags to remove the aforementioned warning. However, it only accounts for the case that the user is using a GNU compiler. It unfortunately does not address the issue I encountered on MacOS (for which the compiler is Clang). Could you please adjust the code in cmake/scalapack.cmake to account for this? Thank you.

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

No branches or pull requests

1 participant