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

Defect: OpenCoarrays-2.1.0, ISO_Fortran_binding_tests.c:53:10: error: conflicting types for '_errno' #550

Closed
jbmaggard opened this issue Jun 4, 2018 · 6 comments

Comments

@jbmaggard
Copy link

  • OpenCoarrays Version: 2.1.0
  • Fortran Compiler: GNU Fortran (Rev2, Built by MSYS2 project) 7.3.0
  • C compiler used for building lib: gcc.exe (Rev2, Built by MSYS2 project) 7.3.0
  • Installation method: install.sh
  • Output of uname -a: MINGW64_NT-6.1 PE-MGR-LAPTOP 2.10.0(0.325/5/3) 2018-02-09 15:25 x86_64 Msys
  • MPI library being used: Intel(R) MPI Library for Windows* OS, Version 2018 Update 2 Build 20180125
  • Machine architecture and number of physical cores: Intel Haswell, i7 (4 cores)
  • Version of CMake: 3.11.1

Attempted to build native Win64 CAF, using GCC 7.3.0 and OpenCoarrays-2.1.0 under MSYS2, following the procedure described in #541. No surprises until compiling OpenCoarrays-2.1.0/src/tests/unit/iso-fortran-binding/ISO_Fortran_binding_tests.c.

[ 72%] Building C object src/iso-fortran-binding/CMakeFiles/ISO_Fortran_binding.dir/ISO_Fortran_binding.c.obj
cd /C/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0/src/iso-fortran-binding && /C/msys2/mingw64/bin/gcc.exe -DGCC_GE_7 -DHAVE_MPI -DISO_Fortran_binding_EXPORTS -DPREFIX_NAME=_gfortran_caf_ -I/C/msys2/home/maggard.admin/OpenCoarrays-2.1.0/src -I"/C/Program Files (x86)/IntelSWTools/compilers_and_libraries_2018.2.185/windows/mpi/intel64/include" -I/C/msys2/home/maggard.admin/mpi/include  -O3 -DNDEBUG   -o CMakeFiles/ISO_Fortran_binding.dir/ISO_Fortran_binding.c.obj   -c /C/msys2/home/maggard.admin/OpenCoarrays-2.1.0/src/iso-fortran-binding/ISO_Fortran_binding.c
[ 73%] Linking C shared library ../../bin/OpenCoarrays-2.1.0-tests/libISO_Fortran_binding.dll
cd /C/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0/src/iso-fortran-binding && /C/msys2/mingw64/bin/cmake.exe -E remove -f CMakeFiles/ISO_Fortran_binding.dir/objects.a
cd /C/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0/src/iso-fortran-binding && /C/msys2/mingw64/bin/ar.exe cr CMakeFiles/ISO_Fortran_binding.dir/objects.a "CMakeFiles/ISO_Fortran_binding.dir/ISO_Fortran_binding.c.obj"
cd /C/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0/src/iso-fortran-binding && /C/msys2/mingw64/bin/gcc.exe  -O3 -DNDEBUG  -shared -o ../../bin/OpenCoarrays-2.1.0-tests/libISO_Fortran_binding.dll -Wl,--out-implib,../../lib/libISO_Fortran_binding.dll.a -Wl,--major-image-version,2,--minor-image-version,1 -Wl,--whole-archive CMakeFiles/ISO_Fortran_binding.dir/objects.a -Wl,--no-whole-archive -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
make[2]: Leaving directory 'C:/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0'
[ 73%] Built target ISO_Fortran_binding
C:/msys2/mingw64/bin/make -f src/tests/unit/iso-fortran-binding/CMakeFiles/ISO_Fortran_binding_tests.dir/build.make src/tests/unit/iso-fortran-binding/CMakeFiles/ISO_Fortran_binding_tests.dir/depend
make[2]: Entering directory 'C:/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0'
/C/msys2/mingw64/bin/cmake.exe -E cmake_depends "MSYS Makefiles" /C/msys2/home/maggard.admin/OpenCoarrays-2.1.0 /C/msys2/home/maggard.admin/OpenCoarrays-2.1.0/src/tests/unit/iso-fortran-binding /C/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0 /C/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0/src/tests/unit/iso-fortran-binding /C/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0/src/tests/unit/iso-fortran-binding/CMakeFiles/ISO_Fortran_binding_tests.dir/DependInfo.cmake --color=
make[2]: Leaving directory 'C:/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0'
C:/msys2/mingw64/bin/make -f src/tests/unit/iso-fortran-binding/CMakeFiles/ISO_Fortran_binding_tests.dir/build.make src/tests/unit/iso-fortran-binding/CMakeFiles/ISO_Fortran_binding_tests.dir/build
make[2]: Entering directory 'C:/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0'
[ 74%] Building C object src/tests/unit/iso-fortran-binding/CMakeFiles/ISO_Fortran_binding_tests.dir/ISO_Fortran_binding_tests.c.obj
cd /C/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0/src/tests/unit/iso-fortran-binding && /C/msys2/mingw64/bin/gcc.exe -DGCC_GE_7 -DHAVE_MPI -DPREFIX_NAME=_gfortran_caf_ -I/C/msys2/home/maggard.admin/OpenCoarrays-2.1.0/src -I"/C/Program Files (x86)/IntelSWTools/compilers_and_libraries_2018.2.185/windows/mpi/intel64/include" -I/C/msys2/home/maggard.admin/mpi/include  -O3 -DNDEBUG   -o CMakeFiles/ISO_Fortran_binding_tests.dir/ISO_Fortran_binding_tests.c.obj   -c /C/msys2/home/maggard.admin/OpenCoarrays-2.1.0/src/tests/unit/iso-fortran-binding/ISO_Fortran_binding_tests.c
In file included from C:/msys2/mingw64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/stddef.h:1:0,
                 from C:/msys2/home/maggard.admin/OpenCoarrays-2.1.0/src/iso-fortran-binding/ISO_Fortran_binding.h:24,
                 from C:/msys2/home/maggard.admin/OpenCoarrays-2.1.0/src/tests/unit/iso-fortran-binding/ISO_Fortran_binding_tests.c:34:
C:/msys2/home/maggard.admin/OpenCoarrays-2.1.0/src/tests/unit/iso-fortran-binding/ISO_Fortran_binding_tests.c: In function 'main':
C:/msys2/home/maggard.admin/OpenCoarrays-2.1.0/src/tests/unit/iso-fortran-binding/ISO_Fortran_binding_tests.c:53:10: error: conflicting types for '_errno'
   size_t errno;
          ^
C:/msys2/mingw64/x86_64-w64-mingw32/include/stddef.h:18:31: note: previous declaration of '_errno' was here
   _CRTIMP extern int *__cdecl _errno(void);
                               ^~~~~~
make[2]: *** [src/tests/unit/iso-fortran-binding/CMakeFiles/ISO_Fortran_binding_tests.dir/build.make:63: src/tests/unit/iso-fortran-binding/CMakeFiles/ISO_Fortran_binding_tests.dir/ISO_Fortran_binding_tests.c.obj] Error 1
make[2]: Leaving directory 'C:/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0'
make[1]: *** [CMakeFiles/Makefile2:2745: src/tests/unit/iso-fortran-binding/CMakeFiles/ISO_Fortran_binding_tests.dir/all] Error 2
make[1]: Leaving directory 'C:/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0'
make: *** [Makefile:141: all] Error 2

Full output from install.sh and output from make clean; make VERBOSE=1 are posted in web folder, along with a copy of the stddef.h file.

A workaround, replacing all instances of "errno" with "iso_errno" in ISO_Fortran_binding_tests.c, appears to have been successful, passing ctest 75, after a clean install.sh build (having deleted the install and builds folders).

      Start 75: ISO_Fortran_binding_tests
75/75 Test #75: ISO_Fortran_binding_tests ..............   Passed    0.03 sec

88% tests passed, 9 tests failed out of 75

Total Test time (real) =  39.61 sec

The following tests FAILED:
         66 - image_fail_test_1 (Failed)
         67 - image_fail_and_sync_test_1 (Failed)
         68 - image_fail_and_sync_test_2 (Failed)
         69 - image_fail_and_sync_test_3 (Failed)
         70 - image_fail_and_status_test_1 (Failed)
         71 - image_fail_and_failed_images_test_1 (Failed)
         72 - image_fail_and_stopped_images_test_1 (Failed)
         73 - image_fail_and_get_test_1 (Failed)
         74 - test-installation-scripts.sh (BAD_COMMAND)
Errors while running CTest

The image_fail tests were not passed as previously discussed for 2.0.0 in #541, and the test-installation-scripts.sh fails (BAD_COMMAND) due to ctest trying to execute it as a Win64 executable file, rather than a bash script (note, installation was successful from install.sh).

@rouson
Copy link
Member

rouson commented Jun 4, 2018

@jbmaggard Thanks for the thorough report! Could you submit a pull request with the mentioned workaround (changing errno toiso_errno)?

@zbeekman
Copy link
Collaborator

zbeekman commented Jun 5, 2018

test-installation-scripts.sh fails (BAD_COMMAND) due to ctest trying to execute it as a Win64 executable file, rather than a bash script (note, installation was successful from install.sh).

@jbmaggard:

Any change you can copy the output here?

Also, can you remind me what, if anything, you had to do to compile with msys?

I remember some MPI shenanigans of some type. (I think CMake provides the infrastructure for generating the interface .lib files or whatever they're called.) Right now, I only have access to the Intel MPI runtime on windows, so I'm not sure if I can compile code with CMake to link against it; Intel compiler/composer xe products on Windows confuse me.

@jbmaggard
Copy link
Author

@zbeekman your commit LGTM, thanks.

As a total git beginner, my understanding is that I would:

  1. Install the git version control system. MSYS2 has package msys/git 2.17.1-1. I'd probably try this way first, rather than the Win64 version of git, so it would run under bash prompt.
  2. Clone master, and make my cloned project a branch, with name something like "ISO_Fortran_binding_tests" or "issue-550-ISO_Fortran_binding_tests" (please advise which would be preferable).
  3. Edit ISO_Fortran_binding_tests.c in my branch.
  4. Make the pull request, linked to this issue.

Feedback appreciated.

@zbeekman
Copy link
Collaborator

zbeekman commented Jun 5, 2018

@jbmaggard I meant not how would you go about creating a PR, as I'm going to do that for you on this issue (at least to replace the instances of errno with iso_errno).

As a total git beginner, my understanding is that I would:

Install the git version control system. MSYS2 has package msys/git 2.17.1-1. I'd probably try this way first, rather than the Win64 version of git, so it would run under bash prompt.
Clone master, and make my cloned project a branch, with name something like "ISO_Fortran_binding_tests" or "issue-550-ISO_Fortran_binding_tests" (please advise which would be preferable).
Edit ISO_Fortran_binding_tests.c in my branch.
Make the pull request, linked to this issue.
Feedback appreciated.

What I'm wondering is separate from the questions you've answered:

  1. The ctest output from running test-installation-scripts.sh. Please copy the output here after running:

    ctest -R test-installation-scripts --verbose

  2. How you created the Intel MPI interface library and if the tools you referenced (dlltool and gendef) are shipped with Windows, and if not, how does one install them?

Also, I just looked through your output, and I have no idea why iso_fortran_binding is segfaulting, and I'm guessing that the failed images tests are failing due to lack of intel MPI support.

I'd like to try to figure out why the tests are failing, but unless you run ctest --output-on-failure (best method) or ctest --verbose (not the preferred technique, too verbose) I can't get any insight into why the tests fail.

Thanks!

@jbmaggard
Copy link
Author

jbmaggard commented Jun 6, 2018

@zbeekman

  1. See above.

Fix for ctest 74 of OpenCoarrays-2.1.0, test-installation-scripts.sh.

      Start 74: test-installation-scripts.sh
74/75 Test #74: test-installation-scripts.sh ...........   Passed    5.70 sec

Similar to the way on the other add_test() lines, where the cafrun bash script has to be executed under the bash shell, rather than executed as a Win64 executable.

$ diff -Nu CTestTestfile.cmake.orig CTestTestfile.cmake
--- CTestTestfile.cmake.orig    2018-06-06 14:37:01.595598900 -0500
+++ CTestTestfile.cmake 2018-06-06 14:37:53.189672700 -0500
@@ -150,7 +150,7 @@
 set_tests_properties(image_fail_and_stopped_images_test_1 PROPERTIES  PASS_REGULAR_EXPRESSION "Test passed.")
 add_test(image_fail_and_get_test_1 "bash" "C:/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0/bin/cafrun" "-np" "4" "C:/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0/bin/OpenCoarrays-2.1.0-tests/image_fail_and_get_test_1")
 set_tests_properties(image_fail_and_get_test_1 PROPERTIES  PASS_REGULAR_EXPRESSION "Test passed.")
-add_test(test-installation-scripts.sh "C:/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0/src/tests/installation/installation-scripts.sh")
+add_test(test-installation-scripts.sh "bash" "C:/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0/src/tests/installation/installation-scripts.sh")
 set_tests_properties(test-installation-scripts.sh PROPERTIES  ENVIRONMENT "OPENCOARRAYS_SRC_DIR=C:/msys2/home/maggard.admin/OpenCoarrays-2.1.0" WORKING_DIRECTORY "C:/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0/src/tests/installation/")
 add_test(ISO_Fortran_binding_tests "C:/msys2/home/maggard.admin/OpenCoarrays-2.1.0/prerequisites/builds/opencoarrays/2.1.0/bin/OpenCoarrays-2.1.0-tests/ISO_Fortran_binding_tests")
 subdirs("src")
  1. See above.

On gendef and dlltool, see bullet three on this comment on #541.

Note that gcc would link correctly if impi.dll were supplied on the command line, but due to the way the mpifort and mpicc scripts (from MPICH-3.2) are written, I thought it was cleaner to create libmpi.a, as an import library to impi.dll.

  1. On my request for feedback on my understanding of the pull request process, I was just asking whether I was able to describe the steps correctly.

@jbmaggard
Copy link
Author

Here is a file with the output from from "ctest --ouput-on-failure" (with test 74 fixed as discussed above).

The output on test 75 matches what I get executing from MSYS2 bash command line with cafrun, and what I get from manual execution under Intel's mpiexec.exe from Win7-64 Command Prompt.

ctest also gave this output. I still haven't determined what changed from my successful run of test 75, ISO_Fortran_binding_tests in the first post of this issue. On one attempt, I got an an error message talking about virtual memory or swapfile, which would seem to agree with some type of allocation problem(s).

      Start 75: ISO_Fortran_binding_tests

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

On the failed image tests, I'd like to investigate whether GCC and Intel-MPI have the required elements. However, I have not yet been able to find simple, short test programs to try each part.

The following list of elements are found in mpi.h when running install.sh, and turn on -DUSE_FAILED_IMAGES (see NEEDED_SYMBOLS in OpenCoarrays-2.1.0/src/mpi/CMakeLists.txt)

-- Looking for MPIX_ERR_PROC_FAILED - found
-- Looking for MPIX_ERR_REVOKED - found
-- Looking for MPIX_Comm_failure_ack - found
-- Looking for MPIX_Comm_failure_get_acked - found
-- Looking for MPIX_Comm_shrink - found
-- Looking for MPIX_Comm_agree - found

zbeekman added a commit that referenced this issue Jun 27, 2018
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

3 participants