Hi Chris, I have some patches that fix command execution on windows, as
there are functional issues (not only compilation issues). However we don't
have the resources to actively develop and support Windows at the current
time.

If you're interested I can try to dig up my branch and send you the code.

On Mon, Dec 7, 2020 at 9:44 AM Chris Holman <Chris.Holman@eu.medical.canon>
wrote:

> I managed to fix this with a pre-compiler conditional in
> mesos:\3rdparty\stout\include\stout\os\exec.hpp
> My C++ is extremely rusty, so not sure if this is the right fix to use,
> but it seems to work for me.
>
> $ git diff 3rdparty/stout/include/stout/os/exec.hpp
> --- BEGIN  GIT DIFF ---
> diff --git a/3rdparty/stout/include/stout/os/exec.hpp
> b/3rdparty/stout/include/stout/os/exec.hpp
> index 686e7a152..ea1b4b3fc 100644
> --- a/3rdparty/stout/include/stout/os/exec.hpp
> +++ b/3rdparty/stout/include/stout/os/exec.hpp
> @@ -75,7 +75,16 @@ inline Option<int> spawn(
>  // TODO(bmahler): Probably we shouldn't provide this windows
>  // emulation and should instead have the caller use windows
>  // subprocess functions directly?
> +#ifdef __WINDOWS__
> +inline int execvp(
> +    const std::string& file,
> +    const std::vector<std::string>& argv);
> +#else
>  inline int execvp(const char* file, char* const argv[]);
> +#endif // __WINDOWS__
> +
> +
> +
>
>
>  // This function is a portable version of execvpe ('p' means searching
> @@ -108,7 +117,15 @@ inline int execvp(const char* file, char* const
> argv[]);
>  // TODO(bmahler): Probably we shouldn't provide this windows
>  // emulation and should instead have the caller use windows
>  // subprocess functions directly?
> +#ifdef __WINDOWS__
> +inline int execvpe(
> +    const std::string& file,
> +    const std::vector<std::string>& argv,
> +    const std::map<std::string, std::string>& envp);
> +#else
>  inline int execvpe(const char* file, char** argv, char** envp);
> +#endif // __WINDOWS__
> +
>
>  } // namespace os {
>
> --- END  GIT DIFF ---
>
> -----Original Message-----
> From: Chris Holman <Chris.Holman@eu.medical.canon>
> Sent: 01 December 2020 18:42
> To: dev@mesos.apache.org
> Subject: Problems building HEAD of mesos 1.10.x branch
>
> Hi,
>
> I'm trying to build Windows Mesos Agent from the 1.10.x branch of the
> https://github.com/apache/mesos.git repo.
>
> My environment is as follows:
>
>   *   Windows Server 2019
>   *   Visual Studio 2017
>
> cd c:\temp
> git clone https://github.com/apache/mesos.git
> mkdir mesos\build
> cd mesos\build
> # Generate build scripts
> cmake .. -G "Visual Studio 15 2017" -A "x64"
> -DPATCHEXE_PATH="C:\ProgramData\chocolatey\lib\patch\tools\bin" -T host=x64
> # Build mesos agent cmake --build . --target mesos-agent --config Release
>
> This is the version I started from:
> C:\temp\mesos>git log -n 1
> commit 2c9e829067465f10bab22aba273e1e3a93f60770 (HEAD -> 1.10.x,
> origin/1.10.x)
> Author: Benjamin Mahler <bmah...@apache.org<mailto:bmah...@apache.org>>
> Date:   Mon Oct 26 16:58:35 2020 -0400
>
>     Updated Postgres URL in CentOS 6 Dockerfile.
>
>     The link was pointing to an rpm package that has since been
>     replaced on the upstream server.
>
> I encountered a couple of compile and linker errors which I fixed along
> the way, but his last issue has me stumped:
>
> c:\temp\mesos\3rdparty\stout\include\stout\exit.hpp(69): warning C4722:
> '__Exit::~__Exit': destructor never returns, potential memory leak
> [C:\temp\mesos\build\src\launcher\mesos-executor.vcxproj]
> mesos.lib(launch.obj) : error LNK2019: unresolved external symbol "int
> __cdecl os::execvp(char const *,char * const * const)" (?execvp@os
> @@YAHPEBDQEBQEAD@Z) referenced in function "protected: virtual int
> __cdecl mesos::internal::slave::
> MesosContainerizerLaunch::execute(void)" (?execute@MesosContainerizerLaunch
> @slave@internal@mesos@@MEAAHXZ)
> [C:\temp\mesos\build\src\launcher\mesos-executor.vcxproj]
> mesos.lib(launch.obj) : error LNK2019: unresolved external symbol "int
> __cdecl os::execvpe(char const *,char * *,char * *)" (?execvpe@os
> @@YAHPEBDPEAPEAD1@Z) referenced in function "protected: virtual int
> __cdecl mesos::internal::slave::
> MesosContainerizerLaunch::execute(void)" (?execute@MesosContainerizerLaunch
> @slave@internal@mesos@@MEAAHXZ)
> [C:\temp\mesos\build\src\launcher\mesos-executor.vcxproj]
> C:\temp\mesos\build\src\mesos-executor.exe : fatal error LNK1120: 2
> unresolved externals
> [C:\temp\mesos\build\src\launcher\mesos-executor.vcxproj]
>
> I can see that the Windows implementation of os::execvp and os::execvpe is
> different to the linux implementation:
>
> Windows: C:\temp\mesos\3rdparty\stout\include\stout\os\windows\exec.hpp
>
> inline int execvp(
>     const std::string& file,
>     const std::vector<std::string>& argv) {
>   exit(os::spawn(file, argv, None()).getOrElse(-1));
>   return -1;
> }
>
>
> inline int execvpe(
>     const std::string& file,
>     const std::vector<std::string>& argv,
>     const std::map<std::string, std::string>& envp) {
>   exit(os::spawn(file, argv, envp).getOrElse(-1));
>   return -1;
> }
>
> C:\temp\mesos\3rdparty\stout\include\stout\os\posix\exec.hpp (formatted to
> make it easier to compare.)
>
> inline int execvp(
>     const char* file,
>     char* const argv[])
> {
>   return ::execvp(file, argv);
> }
>
>
> inline int execvpe(
>     const char* file,
>     char** argv,
>     char** envp)
> {
>   char** saved = os::raw::environment();
>
>   *os::raw::environmentp() = envp;
>
>   int result = execvp(file, argv);
>
>   *os::raw::environmentp() = saved;
>
>   return result;
> }
>
>
> The calls being made to these functions use the posix version of the
> function.
> I'm not sure how this branch could ever have compiled/linked unless
> perhaps you are using VC2019 and it somehow magically resolves this for you?
>
> Q: Has anybody built branch 1.10.x for Windows Mesos Agent recently?
>
> Regards,
> Chris Holman
>

Reply via email to