mdanalysis icon indicating copy to clipboard operation
mdanalysis copied to clipboard

Build fails: incompatible function pointer types initializing

Open yurivict opened this issue 1 year ago • 7 comments

MDAnalysis/lib/formats/src/xdrfile.c:2535:3: error: incompatible function pointer types initializing 'unsigned int (*)(XDR *)' (aka 'unsigned int (*)(struct XDR *)') with an expression of type 'int64_t (XDR *)' (aka 'long (struct XDR *)') [-Wincompatible-function-pointer-types]
 2535 |                 xdrstdio_getpos,                /* get offset in the stream */
      |                 ^~~~~~~~~~~~~~~
MDAnalysis/lib/formats/src/xdrfile.c:2536:3: error: incompatible function pointer types initializing 'int (*)(XDR *, unsigned int)' (aka 'int (*)(struct XDR *, unsigned int)') with an expression of type 'int (XDR *, int64_t, int)' (aka 'int (struct XDR *, long, int)') [-Wincompatible-function-pointer-types]
 2536 |                 xdrstdio_setpos,                /* set offset in the stream */
      |                 ^~~~~~~~~~~~~~~

Current version of MDAnalysis

  • Which version are you using? 2.7.0
  • Which version of Python (python -V)? 3.9
  • Which operating system? FreeBSD 14.0 clang-17

yurivict avatar May 06 '24 07:05 yurivict

Hi @yurivict this was fixed in #4408, try cloning a developer copy of the repo and installing the latest develop. Let me know how that goes?

hmacdope avatar May 06 '24 23:05 hmacdope

Ok, thanks,

I'll wait for the next release.

Yuri

yurivict avatar May 06 '24 23:05 yurivict

I'll leave this open for anyone experiencing similar issues.

hmacdope avatar May 06 '24 23:05 hmacdope

People can only build this code successfully due to compiler bugs that allow invalid code. You should probably consider to make a release with this fix soon. (I myself applied a similar patch but others would likely suffer from this.)

yurivict avatar May 06 '24 23:05 yurivict

People can only build this code successfully due to compiler bugs that allow invalid code.

I just want to correct this:

  1. GNU compiler compilations are not affected as far as we know
  2. Nothing in our test suite fails nor do we have any evidence that these clang compilations lead to incorrect results

A release will come soon, although not until at the very least June.

IAlibay avatar May 07 '24 08:05 IAlibay

The GNU compiler version that you use is buggy. It is probably very old too. Functions of incompatible signatures are allowed to be assigned, which should be an undefined behavior. Recent clang-17 fails to compile it.

yurivict avatar May 07 '24 08:05 yurivict

The compiler versions we use are those that come as default in GitHub actions runners and those that have been chosen as appropriate over conda forge.

In any case, because this discussion can cast doubt on the scientific validity of MDAnalysis, I again want to emphasize that we have no evidence that the validity of any results is in any way affected.

IAlibay avatar May 07 '24 08:05 IAlibay

Given that this issue is a duplicate of #4397, which we already closed because of merged PR #4408, I would suggest to also close this issue.

I understand https://github.com/MDAnalysis/mdanalysis/issues/4589#issuecomment-2097098749 but I feel it's more consistent to close duplicates together with the original issues. @hmacdope I leave it to you to make the decision.

orbeckst avatar May 09 '24 22:05 orbeckst

P.S.: Cool to see FreeBSD — gave me a reason to add a new OpSys-FreeBSD label :-)

orbeckst avatar May 09 '24 22:05 orbeckst