Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: Re: [OMPI users] Windows CMake build problems ... (cont.)
From: Shiqing Fan (fan_at_[hidden])
Date: 2010-01-25 04:09:39


Hi Charlie,

Actually, to compile and link your application with Open MPI on Windows
is similar as on Linux. You have to link your application against the
generated Open MPI libraries, e.g. libopen-mpi.lib (don't forget the
suffix 'd' if you build debug version of the OMPI libraries, e.g.
libopen-mpid.lib).

But according to the information you provided, I assume that you only
added the search path into the project, that's not enough, you should
probably add the library names into "Project Property Pages" ->
"Configuration Properties" -> Linker -> Input -> "Additional
Dependencies", normally only libopen-mpi.lib (or libopen-mpid.lib) would
be enough, so that Visual Studio will know which libraries to link to.

Besides, the Open MPI compiler wrappers should also work on Windows, in
this case you just need to open a "Visual Studio command prompt" with
the Open MPI path env added (e.g. "set PATH=c:\Program
Files\OpenMPI_v1.4\bin;%PATH%"), and simply run command like:

> mpicc app.c

and

> mpirun -np 2 app.exe

Please note that, before executing the application, Open MPI has to be
installed somewhere either by build the "INSTALL" project or by running
the generated installer, so that the correct Open MPI folder structure
could be created.

Regards,
Shiqing

cjohnson_at_[hidden] wrote:
> OK, so I'm a little farther on and perplexed.
>
> As I said, Visual C++ 2005 (release 8.0.50727.867) build
> of OpenMPI 1.4, using CMake 2.6.4, built everything and it all linked.
>
> Went ahead and built the PACKAGE item in the OpenMPI.sln project,
> which made a zip file and an installer (although it was not obvious
> where to look for this , what its name was, etc., I figured it out by
> dates on files).
>
> Another thing that''s not obvious, is how to shoehorn your code into a
> VCC project that will successfully build.
>
> I created a project from existing files in a place where the include
> on the mpi.h would be found and examples, etc. did compile.
>
> However, they did not find any of the library routines. Link errors.
>
> So, I added in the generated libraries location into the search
> locations for libraries.
>
> No good.
>
> So, I added all of the generated libraries into the VCC project I created.
>
> No good.
>
> How does one do this (aside from rigging up something through CMake,
> cygwin, minGW, or MS SFU)?
>
> Charlie ...
>
>
> -------- Original Message --------
> Subject: Re: [OMPI users] Windows CMake build problems ... (cont.)
> From: Shiqing Fan <fan_at_[hidden]>
> Date: Fri, January 15, 2010 2:56 am
> To: cjohnson_at_[hidden]
> Cc: Open MPI Users <users_at_[hidden]>
>
>
> Hi Charlie,
>
> Glad to hear that you compiled it successfully.
>
> The error you got with 1.3.4 is a bug that the CMake script didn't
> set
> the SVN information correctly, and it has been fixed in 1.4 and later.
>
>
> Thanks,
> Shiqing
>
>
> cjohnson_at_[hidden] wrote:
> > Yes that was it.
> >
> > A much improved result now from CMake 2.6.4, no errors from
> compiling
> > openmpi-1.4:
> >
> > 1>libopen-pal - 0 error(s), 9 warning(s)
> > 2>libopen-rte - 0 error(s), 7 warning(s)
> > 3>opal-restart - 0 error(s), 0 warning(s)
> > 4>opal-wrapper - 0 error(s), 0 warning(s)
> > 5>libmpi - 0 error(s), 42 warning(s)
> > 6>orte-checkpoint - 0 error(s), 0 warning(s)
> > 7>orte-ps - 0 error(s), 0 warning(s)
> > 8>orted - 0 error(s), 0 warning(s)
> > 9>orte-clean - 0 error(s), 0 warning(s)
> > 10>orterun - 0 error(s), 3 warning(s)
> > 11>ompi_info - 0 error(s), 0 warning(s)
> > 12>ompi-server - 0 error(s), 0 warning(s)
> > 13>libmpi_cxx - 0 error(s), 61 warning(s)
> > ========== Build: 13 succeeded, 0 failed, 1 up-to-date, 0 skipped
> > ==========
> >
> > And only one failure from compiling openmpi-1.3.4 (the ompi_info
> project):
> >
> > > 1>libopen-pal - 0 error(s), 9 warning(s)
> > > 2>libopen-rte - 0 error(s), 7 warning(s)
> > > 3>opal-restart - 0 error(s), 0 warning(s)
> > > 4>opal-wrapper - 0 error(s), 0 warning(s)
> > > 5>orte-checkpoint - 0 error(s), 0 warning(s)
> > > 6>libmpi - 0 error(s), 42 warning(s)
> > > 7>orte-ps - 0 error(s), 0 warning(s)
> > > 8>orted - 0 error(s), 0 warning(s)
> > > 9>orte-clean - 0 error(s), 0 warning(s)
> > > 10>orterun - 0 error(s), 3 warning(s)
> > > 11>ompi_info - 3 error(s), 0 warning(s)
> > > 12>ompi-server - 0 error(s), 0 warning(s)
> > > 13>libmpi_cxx - 0 error(s), 61 warning(s)
> > > ========== Rebuild All: 13 succeeded, 1 failed, 0 skipped
> ==========
> >
> > Here's the listing from the non-linking project:
> >
> > 11>------ Rebuild All started: Project: ompi_info, Configuration:
> > Debug Win32 ------
> > 11>Deleting intermediate and output files for project 'ompi_info',
> > configuration 'Debug|Win32'
> > 11>Compiling...
> > 11>version.cc
> > 11>..\..\..\..\openmpi-1.3.4\ompi\tools\ompi_info\version.cc(136) :
> > error C2059: syntax error : ','
> > 11>..\..\..\..\openmpi-1.3.4\ompi\tools\ompi_info\version.cc(147) :
> > error C2059: syntax error : ','
> > 11>..\..\..\..\openmpi-1.3.4\ompi\tools\ompi_info\version.cc(158) :
> > error C2059: syntax error : ','
> > 11>param.cc
> > 11>output.cc
> > 11>ompi_info.cc
> > 11>components.cc
> > 11>Generating Code...
> > 11>Build log was saved at
> > "file://c:\prog\mon\ompi\tools\ompi_info\ompi_info.dir\Debug\BuildLog.htm
> <file:///c:/prog/mon/ompi/tools/ompi_info/ompi_info.dir/Debug/BuildLog.htm>"
> > 11>ompi_info - 3 error(s), 0 warning(s)
> >
> > Thank you Shiqing !
> >
> > Charlie ...
> >
> > -------- Original Message --------
> > Subject: Re: [OMPI users] Windows CMake build problems ... (cont.)
> > From: Shiqing Fan <fan_at_[hidden]>
> > Date: Thu, January 14, 2010 11:20 am
> > To: Open MPI Users <users_at_[hidden]>,
> > cjohnson_at_[hidden]
> >
> >
> > Hi Charlie,
> >
> > The problem turns out to be the different behavior of one CMake
> > macro in
> > different version of CMake. And it's fixed in Open MPI trunk with
> > r22405. I also created a ticket to move the fix over to 1.4
> > branch, see
> > #2169: https://svn.open-mpi.org/trac/ompi/ticket/2169 .
> >
> > So you could either switch to use OMPI trunk or use CMake 2.6 to
> > solve
> > the problem. Thanks a lot.
> >
> >
> > Best Regards,
> > Shiqing
> >
> >
> > cjohnson_at_[hidden] wrote:
> > > The OpenMPI build problem I'm having occurs in both OpenMPI 1.4
> > and 1.3.4.
> > >
> > > I am on a Windows 7 (US) Enterprise (x86) OS on an HP system with
> > > Intel core 2 extreme x9000 (4GB RAM), using the 2005 Visual
> > Studio for
> > > S/W Architects (release 8.0.50727.867).
> > >
> > > [That release has everything the platform SDK would have.]
> > >
> > > I'm using CMake 2.8 to generate code, I used it correctly,
> > pointing at
> > > the root directory where the makelists are located for the source
> > side
> > > and to an empty directory for the build side: did configure,
> _*I did
> > > not click debug this time as suggested by Shiqing*_, configure
> > again,
> > > generate and opened the OpenMPI.sln file created by CMake. Then I
> > > right-clicked on the "ALL_BUILD" project and selected "build". Then
> > > did one "rebuild", just in case build order might get one more
> > success
> > > (which it seemed to, but I could not find).
> > >
> > > 2 projects built, 12 did not. I have the build listing. [I'm
> > afraid of
> > > what the mailing list server would do if I attached it to this
> > email.]
> > >
> > > All the compiles were successful (warnings at most.) All the errors
> > > were were from linking the VC projects:
> > >
> > > *1>libopen-pal - 0 error(s), 9 warning(s)*
> > > 3>opal-restart - 32 error(s), 0 warning(s)
> > > 4>opal-wrapper - 21 error(s), 0 warning(s)
> > > 2>libopen-rte - 749 error(s), 7 warning(s)
> > > 5>orte-checkpoint - 32 error(s), 0 warning(s)
> > > 7>orte-ps - 28 error(s), 0 warning(s)
> > > 8>orted - 2 error(s), 0 warning(s)
> > > 9>orte-clean - 13 error(s), 0 warning(s)
> > > 10>orterun - 100 error(s), 3 warning(s)
> > > 6>libmpi - 2133 error(s), 42 warning(s)
> > > 12>ompi-server - 27 error(s), 0 warning(s)
> > > 11>ompi_info - 146 error(s), 0 warning(s)
> > > 13>libmpi_cxx - 456 error(s), 61 warning(s)
> > > ========== Rebuild All: 2 succeeded, 12 failed, 0 skipped
> ==========
> > >
> > > It said that 2 succeeded, I could not find the second build
> > success in
> > > the listing.
> > >
> > > *However, everything did compile, and thank you Shiqing !*
> > >
> > > Here is the listing for the first failed link, on "opal-restart":
> > >
> > > 3>------ Rebuild All started: Project: opal-restart, Configuration:
> > > Debug Win32 ------
> > > 3>Deleting intermediate and output files for project
> 'opal-restart',
> > > configuration 'Debug|Win32'
> > > 3>Compiling...
> > > 3>opal-restart.c
> > > 2>Compiling...
> > > 2>snapc_base_select.c
> > > 3>Compiling manifest to resources...
> > > 3>Linking...
> > > 2>snapc_base_open.c
> > > 3>opal-restart.obj : error LNK2001: unresolved external symbol
> > > __imp__opal_crs
> > > 3>opal-restart.obj : error LNK2001: unresolved external symbol
> > > __imp__opal_crs_base_snapshot_t_class
> > > 3>opal-restart.obj : error LNK2001: unresolved external symbol
> > > __imp__opal_crs_base_selected_component
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_crs_base_select referenced in function _main
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_crs_base_open referenced in function _main
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_output_verbose referenced in function _main
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_crs_base_extract_expected_component referenced in
> > function
> > > _main
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_crs_base_get_snapshot_directory referenced in
> > function _main
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_setenv referenced in function _main
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__mca_base_param_env_var referenced in function _main
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_show_help referenced in function _main
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_class_initialize referenced in function "struct
> > > opal_object_t * __cdecl opal_obj_new(struct opal_class_t *)"
> > > (?opal_obj_new@@YAPAUopal_object_t@@PAUopal_class_t@@@Z)
> > > 3>opal-restart.obj : error LNK2001: unresolved external symbol
> > > __imp__opal_cr_is_tool
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_init referenced in function "int __cdecl
> > > initialize(int,char * * const)" (?initialize@@YAHHQAPAD_at_Z)
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_output_set_verbosity referenced in function "int
> __cdecl
> > > initialize(int,char * * const)" (?initialize@@YAHHQAPAD_at_Z)
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_output_open referenced in function "int __cdecl
> > > initialize(int,char * * const)" (?initialize@@YAHHQAPAD_at_Z)
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_init_util referenced in function "int __cdecl
> > > initialize(int,char * * const)" (?initialize@@YAHHQAPAD_at_Z)
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_finalize referenced in function "int __cdecl
> > > finalize(void)" (?finalize@@YAHXZ)
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_argv_join referenced in function "int __cdecl
> > > parse_args(int,char * * const)" (?parse_args@@YAHHQAPAD_at_Z)
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_cmd_line_get_tail referenced in function "int __cdecl
> > > parse_args(int,char * * const)" (?parse_args@@YAHHQAPAD_at_Z)
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_cmd_line_get_usage_msg referenced in function "int
> > __cdecl
> > > parse_args(int,char * * const)" (?parse_args@@YAHHQAPAD_at_Z)
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_argv_count referenced in function "int __cdecl
> > > parse_args(int,char * * const)" (?parse_args@@YAHHQAPAD_at_Z)
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__mca_base_cmd_line_process_args referenced in function "int
> > > __cdecl parse_args(int,char * * const)" (?parse_args@@YAHHQAPAD_at_Z)
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_cmd_line_parse referenced in function "int __cdecl
> > > parse_args(int,char * * const)" (?parse_args@@YAHHQAPAD_at_Z)
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__mca_base_cmd_line_setup referenced in function "int __cdecl
> > > parse_args(int,char * * const)" (?parse_args@@YAHHQAPAD_at_Z)
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__mca_base_open referenced in function "int __cdecl
> > > parse_args(int,char * * const)" (?parse_args@@YAHHQAPAD_at_Z)
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_cmd_line_create referenced in function "int __cdecl
> > > parse_args(int,char * * const)" (?parse_args@@YAHHQAPAD_at_Z)
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_argv_free referenced in function "int __cdecl
> > > check_file(char *)" (?check_file@@YAHPAD_at_Z)
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_output referenced in function "int __cdecl
> > check_file(char
> > > *)" (?check_file@@YAHPAD_at_Z)
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_crs_base_metadata_read_token referenced in function
> "int
> > > __cdecl post_env_vars(int,char *)" (?post_env_vars@@YAHHPAD_at_Z)
> > > 3>opal-restart.obj : error LNK2019: unresolved external symbol
> > > __imp__opal_asprintf referenced in function "int __cdecl
> > > post_env_vars(int,char *)" (?post_env_vars@@YAHHPAD_at_Z)
> > > 3>C:\prog\mon\Debug\opal-restart.exe : fatal error LNK1120: 31
> > > unresolved externals
> > > 3>Build log was saved at
> > >
> "file://c:\prog\mon\opal\tools\opal-restart\opal-restart.dir\Debug\BuildLog.htm
> <file:///c:/prog/mon/opal/tools/opal-restart/opal-restart.dir/Debug/BuildLog.htm>
> > <file://c:%5Cprog%5Cmon%5Copal%5Ctools%5Copal-restart%5Copal-restart.dir%5CDebug%5CBuildLog.htm
> <file:///c:%255Cprog%255Cmon%255Copal%255Ctools%255Copal-restart%255Copal-restart.dir%255CDebug%255CBuildLog.htm>>"
> > > 3>opal-restart - 32 error(s), 0 warning(s)
> > >
> > > Now, these link errors may be from missing networking software and
> > > hardware, I was just following the instructions in
> > > openmpi-1.4.tar.gz:a/openmpi-1.4/README.WINDOWS:
> > >
> > > > First approach: Using CMake
> > > >
> > > > NOTE: CMake support is available in the Open MPI development
> > > > trunk and 1.3.3 release.
> > > >
> > > > 1. Download the latest version of CMake (at least v2.4).
> > > >
> > > > 2. In the CMake GUI, add the source path and build path of
> Open MPI
> > > > (out of source build is recommended).
> > > >
> > > > 3. Then configure, and after the first time configuration, all
> > > > available options will show up in the CMake GUI. Select the
> > > > options that you require.
> > > >
> > > > 4. Run configure again to generate all Windows solution
> files; they
> > > > will be generated in build path.
> > > >
> > > > 5. Go to the build directory, open the generated Windows solution
> > > > file, and compile.
> > > >
> > > > 6. To generate a installer, you should install NSIS, and
> build the
> > > > 'PACKAGE' project in the Open MPI sulotion.
> > > >
> > >
> > > These instructions did not mention any link libraries I had to
> > add to
> > > complete the build.
> > >
> > > Thanks in advance for any help !
> > >
> > > Charlie ...
> > >
> > >
> ------------------------------------------------------------------------
> > >
> > > _______________________________________________
> > > users mailing list
> > > users_at_[hidden]
> > > http://www.open-mpi.org/mailman/listinfo.cgi/users
> >
> >
> > --
> > --------------------------------------------------------------
> > Shiqing Fan http://www.hlrs.de/people/fan
> > High Performance Computing Tel.: +49 711 685 87234
> > Center Stuttgart (HLRS) Fax.: +49 711 685 65832
> > Address:Allmandring 30 email: fan_at_[hidden]
> > 70569 Stuttgart
> >
>
>
> --
> --------------------------------------------------------------
> Shiqing Fan http://www.hlrs.de/people/fan
> High Performance Computing Tel.: +49 711 685 87234
> Center Stuttgart (HLRS) Fax.: +49 711 685 65832
> Address:Allmandring 30 email: fan_at_[hidden]
> 70569 Stuttgart
>

-- 
--------------------------------------------------------------
Shiqing Fan                          http://www.hlrs.de/people/fan
High Performance Computing           Tel.: +49 711 685 87234
  Center Stuttgart (HLRS)            Fax.: +49 711 685 65832
Address:Allmandring 30               email: fan_at_[hidden]    
70569 Stuttgart