Hi,

While I was trying to fix FACT-1559[1], which is a trivial 2 lines fix,
I embarked in an endless and very frustrating journey of trying to build
facter.

I was able to rebuild facter in isolation on an ubuntu 16.04, once all
the dependencies were fulfilled correctly.

But when I tried to build in the context of the puppet-agent package so
that my facter build would:
* be able to replace the shipped facter
* use the /opt/puppetlabs embedded ruby
* use the various /opt/puppetlabs/puppet/lib shipped library

I encountered an endless stream of issues:
* impossibility to build with static boost and/or static yaml-cpp, I
kept getting link errors about: 
/usr/bin/ld: 
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libyaml-cpp.a(parse.cpp.o):
 relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a 
shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libyaml-cpp.a: error 
adding symbols: Bad value
or
/usr/bin/ld: 
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_locale.a(format.o):
 relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a 
shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_locale.a: 
error adding symbols: Bad value

* if building a full dynamic lib, I get numerous boost link issues like
those:
../CMakeFiles/libfactersrc.dir/src/ruby/module.cc.o: In function 
`std::_Function_handler<unsigned long (), 
facter::ruby::module::ruby_search_external(unsigned long, unsigned 
long)::{lambda()#1}>::_M_invoke(std::_Any_data const&)':
module.cc:(.text+0x6145): undefined reference to 
`boost::program_options::abstract_variables_map::operator[](std::string const&) 
const'
../CMakeFiles/libfactersrc.dir/src/ruby/module.cc.o: In function 
`facter::ruby::module::load_facts()':
module.cc:(.text+0x6a10): undefined reference to 
`boost::program_options::abstract_variables_map::operator[](std::string const&) 
const'
../CMakeFiles/libfactersrc.dir/src/ruby/module.cc.o: In function 
`facter::ruby::require_context::require_context()':
module.cc:(.text._ZN6facter4ruby15require_contextC2Ev[_ZN6facter4ruby15require_contextC5Ev]+0x31e):
 undefined reference to 
`boost::program_options::abstract_variables_map::operator[](std::string const&) 
const'
CMakeFiles/libfacter_test.dir/ruby/ruby_helper.cc.o: In function 
`boost::locale::basic_format<char>::format_output(std::ostream&, std::string 
const&) const':
ruby_helper.cc:(.text._ZNK5boost6locale12basic_formatIcE13format_outputERSoRKSs[_ZNK5boost6locale12basic_formatIcE13format_outputERSoRKSs]+0x1dc):
 undefined reference to 
`boost::locale::details::format_parser::set_one_flag(std::string const&, 
std::string const&)'
../CMakeFiles/libfactersrc.dir/src/util/config/config.cc.o: In function 
`facter::util::config::fact_config_options()':
config.cc:(.text+0x3a): undefined reference to 
`boost::program_options::options_description::options_description(std::string 
const&, unsigned int, unsigned int)'
...

It's like if boost libs weren't there, but they seem specified in the
linker command line arguments. Cmake found them correctly.

I haven't done any serious C++ programming in the last 15 years, so I'm
all rusty (no pun intended of course), and I might have missed something
essential.

That would be great to be able to rebuild facter with my fix (I'm not
sure what's the plan on facter release nowadays, but I don't expect to
see an updated puppet-agent with facter including this coreos fix in a
timeframe that would allow me to make progress on my side).

My cmake looks like this:
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 cmake
-DLEATHERMAN_GETTEXT=OFF \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_PREFIX_PATH=/opt/puppetlabs/puppet \
-DCMAKE_INSTALL_PREFIX=/opt/puppetlabs/puppet \
-DCMAKE_INSTALL_RPATH=/opt/puppetlabs/puppet \
-DRUBY_INCLUDE_DIR=/opt/puppetlabs/puppet/include/ruby-2.1.0/ \
-DBOOST_STATIC=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DYAMLCPP_STATIC=OFF \
-DAIO_AGENT_VERSION=1.8.0 \
-DINSTALL_BATCH_FILES=NO \
..

Any help is welcome :)

[1]: https://tickets.puppetlabs.com/browse/FACT-1559?jql=project%20%3D%
20FACT%20AND%20text%20~%20%22static%22
-- 
Brice Figureau
My Blog: http://www.masterzen.fr/

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/1484670441.32128.0.camel%40daysofwonder.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to