[ 
https://issues.apache.org/jira/browse/MESOS-6959?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16124344#comment-16124344
 ] 

Andrew Schwartzmeyer commented on MESOS-6959:
---------------------------------------------

I attempted this. I can get it compiling with the following:

{noformat}
add_executable(mesos-containerizer
  main.cpp
  containerizer.cpp
  )
target_include_directories(mesos-containerizer PRIVATE
  ${CMAKE_SOURCE_DIR}/3rdparty/libprocess/include
  ${MESOS_PUBLIC_INCLUDE_DIR}
  ${MESOS_BIN_INCLUDE_DIR}
  ${MESOS_BIN_INCLUDE_DIR}/mesos
  ${MESOS_BIN_SRC_DIR}
  ${MESOS_SRC_DIR})
target_link_libraries(mesos-containerizer PRIVATE stout nvml)
{noformat}

There are obviously more sources that go into this binary, but this enough to 
demonstrate the dependency on {{libprocess}}.

Snippet of errors:

{noformat}
containerizer.cpp:(.text._ZNK5mesos5slave11ContainerIO2IOcvN7process10Subprocess2IOEEv[_ZNK5mesos5slave11ContainerIO2IOcvN7process10Subprocess2IOEEv]+0x52):
 undefined reference to `process::Subprocess::FD(int, process::Subprocess
::IO::FDType)'
containerizer.cpp:(.text._ZNK5mesos5slave11ContainerIO2IOcvN7process10Subprocess2IOEEv[_ZNK5mesos5slave11ContainerIO2IOcvN7process10Subprocess2IOEEv]+0x76):
 undefined reference to `process::Subprocess::PATH(std::string const&)'
src/slave/containerizer/mesos/CMakeFiles/mesos-containerizer.dir/containerizer.cpp.o:
 In function `process::terminate(process::ProcessBase const*, bool)':
containerizer.cpp:(.text._ZN7process9terminateEPKNS_11ProcessBaseEb[_ZN7process9terminateEPKNS_11ProcessBaseEb]+0x28):
 undefined reference to `process::terminate(process::UPID const&, bool)'
src/slave/containerizer/mesos/CMakeFiles/mesos-containerizer.dir/containerizer.cpp.o:
 In function `process::wait(process::ProcessBase const*, Duration const&)':
containerizer.cpp:(.text._ZN7process4waitEPKNS_11ProcessBaseERK8Duration[_ZN7process4waitEPKNS_11ProcessBaseERK8Duration]+0x27):
 undefined reference to `process::wait(process::UPID const&, Duration const&)'
src/slave/containerizer/mesos/CMakeFiles/mesos-containerizer.dir/containerizer.cpp.o:
 In function `process::metrics::Metric::push(double)':
containerizer.cpp:(.text._ZN7process7metrics6Metric4pushEd[_ZN7process7metrics6Metric4pushEd]+0x37):
 undefined reference to `process::Clock::now()'
src/slave/containerizer/mesos/CMakeFiles/mesos-containerizer.dir/containerizer.cpp.o:
 In function `process::metrics::Metric::Data::Data(std::string const&, 
Option<Duration> const&)':
containerizer.cpp:(.text._ZN7process7metrics6Metric4DataC2ERKSsRK6OptionI8DurationE[_ZN7process7metrics6Metric4DataC5ERKSsRK6OptionI8DurationE]+0x89):
 undefined reference to `process::TIME_SERIES_CAPACITY'
src/slave/containerizer/mesos/CMakeFiles/mesos-containerizer.dir/containerizer.cpp.o:
 In function `process::metrics::remove(process::metrics::Metric const&)':
containerizer.cpp:(.text._ZN7process7metrics6removeERKNS0_6MetricE[_ZN7process7metrics6removeERKNS0_6MetricE]+0x67):
 undefined reference to `process::initialize(Option<std::string> const&, 
Option<std::string> const&, Option<std::
string> const&)'
containerizer.cpp:(.text._ZN7process7metrics6removeERKNS0_6MetricE[_ZN7process7metrics6removeERKNS0_6MetricE]+0xa4):
 undefined reference to 
`process::metrics::internal::MetricsProcess::remove(std::string const&)'
containerizer.cpp:(.text._ZN7process7metrics6removeERKNS0_6MetricE[_ZN7process7metrics6removeERKNS0_6MetricE]+0xc4):
 undefined reference to `process::metrics::internal::metrics'
{noformat}

So I will leave this as-is (linking to {{libmesos}}.)

> Separate the mesos-containerizer binary into a static binary, which only 
> depends on stout
> -----------------------------------------------------------------------------------------
>
>                 Key: MESOS-6959
>                 URL: https://issues.apache.org/jira/browse/MESOS-6959
>             Project: Mesos
>          Issue Type: Task
>          Components: cmake
>            Reporter: Joseph Wu
>            Assignee: Andrew Schwartzmeyer
>              Labels: cmake, mesosphere, microsoft
>
> The {{mesos-containerizer}} binary currently has [three 
> commands|https://github.com/apache/mesos/blob/6cf3a94a52e87a593c9cba373bf433cfc4178639/src/slave/containerizer/mesos/main.cpp#L46-L48]:
> * 
> [MesosContainerizerLaunch|https://github.com/apache/mesos/blob/6cf3a94a52e87a593c9cba373bf433cfc4178639/src/slave/containerizer/mesos/launch.cpp]
> * 
> [MesosContainerizerMount|https://github.com/apache/mesos/blob/6cf3a94a52e87a593c9cba373bf433cfc4178639/src/slave/containerizer/mesos/mount.cpp]
> * 
> [NetworkCniIsolatorSetup|https://github.com/apache/mesos/blob/6cf3a94a52e87a593c9cba373bf433cfc4178639/src/slave/containerizer/mesos/isolators/network/cni/cni.cpp#L1776-L1997]
> These commands are all heavily dependent on stout, and have no need to be 
> linked to libprocess.  In fact, adding an erroneous call to 
> {{process::initialize}} (either explicitly, or by accidentally using a 
> libprocess method) will break {{mesos-containerizer}} can cause several Mesos 
> containerizer tests to fail.  (The tasks fail to launch, saying {{Failed to 
> synchronize with agent (it's probably exited)}}).
> Because this binary only depends on stout, we can separate it from the other 
> source files and make this a static binary.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to