Re: static library linking issues


Jeremy Selan <jeremy...@...>
 

Great, let me know if you find anything.

By the way, this is the line that *should* be doing the static linking:
https://github.com/imageworks/OpenColorIO/blob/master/src/core/CMakeLists.txt#L69

and if I print the variable, it appears to be right:
message(STATUS "EXTERNAL_GENERAL_LIBRARIES: ${EXTERNAL_GENERAL_LIBRARIES}")

-- EXTERNAL_GENERAL_LIBRARIES: /net/homedirs/jeremys/git/ocio.js/build/ext/dist/lib/libtinyxml.a;/net/homedirs/jeremys/git/ocio.js/build/ext/dist/lib/libyaml-cpp.a

(whats going wrong is to be determined...)

-- Jeremy


On Fri, May 11, 2012 at 5:31 PM, Piotr Stanczyk <piotr.s...@...> wrote:
thanks for catching that one Jeremy; I'll pass it onto our build guys.

Alas, my cmake skills are well below par, though I may have a go at this one  ..

Piotr


On Fri, May 11, 2012 at 5:25 PM, Jeremy Selan <jeremy...@...> wrote:
> Ok, so I'm able to fully reproduce your error when using static linking with
> a simple test case.
>
> g++ main.cpp -Ibuild/dist/include -ostatictest
> build/dist/lib/libOpenColorIO.a
>
> I created a main.cpp, where all it does is print the name of linear.
> https://gist.github.com/2663280
>
> If I manually add the .a for yaml and tinyxml everything works!
>
> g++ main.cpp -Ibuild/dist/include -ostatictest
> build/dist/lib/libOpenColorIO.a build/ext/dist/lib/libyaml-cpp.a
> build/ext/dist/lib/libtinyxml.a
>
> So as you noted, the static symbols from these two dependencies are not
> making into ocio.  I'm not much of a cmake expert, but it doesnt seem like
> this would be too hard to patch up.
>
> -- Jeremy
>
>
> On Fri, May 11, 2012 at 1:08 PM, Jeremy Selan <jeremy...@...>
> wrote:
>>
>> Sorry, i'll try to look into this.
>>
>> Is anyone out there successfully statically building against OCIO?
>>
>> -- Jeremy
>>
>>
>> On Fri, May 11, 2012 at 10:25 AM, Piotr <piotr.s...@...> wrote:
>>>
>>> Just checking in to see if anyone has some magic voodoo for this -
>>> thanks
>>>
>>> Piotr
>>>
>>>
>>> On May 7, 4:51 pm, Piotr Stanczyk <piotr.s...@...> wrote:
>>> > Hi Jeremy,
>>> >
>>> > Sorry for the delay in getting this info back to you. This is what our
>>> > build people say:
>>> >
>>> > We're actually building verison 1.0.6.  This was a clean build, and
>>> > we're not using ocio elsewhere in our codebase.  The ocio build was
>>> > invoked via:
>>> >
>>> > cmake -D CMAKE_INSTALL_PREFIX=../dist -D CMAKE_SKIP_RPATH=YES -D
>>> > PYTHON=/usr/bin/python2.6 ../
>>> >
>>> > Could it be that the symbols from the the YAML and tinxml libs are
>>> > hidden in the ocio build?  Is there a way to disable that and make
>>> > them all publicly available?  Taking the first undefined reference,
>>> > for example:
>>> >
>>> > > objdump -tC libOpenColorIO.so.1.0.6 | grep "YAML::Emitter::Emitter"
>>> >
>>> > 00000000000cfb00 l     F .text  000000000000006c              .hidden
>>> > YAML::Emitter::Emitter()
>>> > 00000000000cfb70 l     F .text  000000000000006c              .hidden
>>> > YAML::Emitter::Emitter()
>>> >
>>> > And in the ocio code it's definitely referenced ( src/core/Config.cpp
>>> > ):
>>> >
>>> > void Config::serialize(std::ostream& os) const
>>> > {
>>> >     try
>>> >     {
>>> >         YAML::Emitter out;
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > On Tue, May 1, 2012 at 4:24 PM, Jeremy Selan <jeremy...@...>
>>> > wrote:
>>> > > Ugh!
>>> >
>>> > > Sorry to hear you've having trouble with static linking.
>>> >
>>> > > Can you post the shell command you're using to build OCIO with?
>>> >
>>> > > (At SPI we happen to only use OCIO in a dynamically linked context so
>>> > > we
>>> > > havent run into this error yet).
>>> >
>>> > > In the latest OCIO release (1.0.7) we bumped the internal yaml-cpp
>>> > > dependency to 0.3.0. I presume you're building 1.0.7?
>>> >
>>> > > A few ideas to test:
>>> > > - Can you confirm that you're using a clean build?  It's possible
>>> > > that if
>>> > > you have old .o files lying around-  built against a prior OCIO - it
>>> > > could
>>> > > cause weirdness.
>>> >
>>> > > - Is it possible that another part of your codebase is statically
>>> > > linking
>>> > > against a different OCIO version? (If you have another part of the
>>> > > code
>>> > > statically links to 0.2.X yaml-cpp, I could imagine a yaml-cpp symbol
>>> > > clash)
>>> >
>>> > > -- Jeremy
>>> >
>>> > > On Tue, May 1, 2012 at 11:35 AM, Piotr Stanczyk
>>> > > <piotr.s...@...>
>>> > > wrote:
>>> >
>>> > >> Hi All,
>>> >
>>> > >> So far I've been using the .so's to link against. However, I've run
>>> > >> into an issue with building a binary that links against the static
>>> > >> libs with a sleuth of errors (see below).
>>> > >> I don't think I did anything unusual in the building of this. I'll
>>> > >> start digging into what could be causing this, but if anyone has any
>>> > >> pointers that would be most welcome.
>>> >
>>> > >> Cheers
>>> >
>>> > >> Piotr
>>> >
>>> > >>
>>> > >> /var/tmp-ssd/doNotRemove/builds/zeno3_ssd/RHEL5_AMD64_OPT/lib/libOpenColorI
>>> > >> O.a(Config.cpp.o):
>>> > >> In function `OpenColorIO::v1::Config::serialize(std::basic_ostrea
>>> > >> m<char, std::char_traits<char> >&) const':
>>> >
>>> > >>
>>> > >> /home/ewimmer/ewimmer_importlibs/importlibs/src/OpenColorIO/imageworks-Open
>>> > >> ColorIO-a16d9ac/src/core/Config.cpp:1591:
>>> > >> undefined reference to `YAML::Emitter::Emi
>>> > >> tter()'
>>> >
>>> > >>
>>> > >> /var/tmp-ssd/doNotRemove/builds/zeno3_ssd/RHEL5_AMD64_OPT/lib/libOpenColorI
>>> > >> O.a(Config.cpp.o):
>>> > >> In function `operator<<':
>>> >
>>> > >>
>>> > >> /home/ewimmer/ewimmer_importlibs/importlibs/src/OpenColorIO/imageworks-Open
>>> > >> ColorIO-a16d9ac/build/ext/dist/include/yaml-cpp/emitter.h:152:
>>> > >> undefined reference t
>>> > >> o `YAML::Emitter::SetLocalValue(YAML::EMITTER_MANIP)'
>>> >
>>> > >>
>>> > >> /var/tmp-ssd/doNotRemove/builds/zeno3_ssd/RHEL5_AMD64_OPT/lib/libOpenColorI
>>> > >> O.a(Config.cpp.o):
>>> > >> In function `operator<<':
>>> >
>>> > >>
>>> > >> /home/ewimmer/ewimmer_importlibs/importlibs/src/OpenColorIO/imageworks-Open
>>> > >> ColorIO-a16d9ac/src/core/Config.cpp:1594:
>>> > >> undefined reference to `YAML::Emitter::Set
>>> > >> LocalValue(YAML::EMITTER_MANIP)'
>>> >
>>> > >>
>>> > >> /home/ewimmer/ewimmer_importlibs/importlibs/src/OpenColorIO/imageworks-Open
>>> > >> ColorIO-a16d9ac/src/core/Config.cpp:1594:
>>> > >> undefined reference to `YAML::Emitter::Set
>>> > >> LocalValue(YAML::EMITTER_MANIP)'
>>> >
>>> > >>
>>> > >> /var/tmp-ssd/doNotRemove/builds/zeno3_ssd/RHEL5_AMD64_OPT/lib/libOpenColorI
>>> > >> O.a(Config.cpp.o):
>>> > >> In function `operator<<':
>>> >
>>> > >>
>>> > >> /home/ewimmer/ewimmer_importlibs/importlibs/src/OpenColorIO/imageworks-Open
>>> > >> ColorIO-a16d9ac/build/ext/dist/include/yaml-cpp/emitter.h:152:
>>> > >> undefined reference t
>>> > >> o `YAML::Emitter::SetLocalValue(YAML::EMITTER_MANIP)'
>>> >
>>> > >>
>>> > >> /var/tmp-ssd/doNotRemove/builds/zeno3_ssd/RHEL5_AMD64_OPT/lib/libOpenColorI
>>> > >> O.a(Config.cpp.o):
>>> > >> In function `WriteIntegralType<int>':
>>> >
>>> > >>
>>> > >> /home/ewimmer/ewimmer_importlibs/importlibs/src/OpenColorIO/imageworks-Open
>>> > >> ColorIO-a16d9ac/build/ext/dist/include/yaml-cpp/emitter.h:104:
>>> > >> undefined reference t
>>> > >> o `YAML::Emitter::good() const'
>>> >
>>> > >>
>>> > >> /home/ewimmer/ewimmer_importlibs/importlibs/src/OpenColorIO/imageworks-Open
>>> > >> ColorIO-a16d9ac/build/ext/dist/include/yaml-cpp/emitter.h:108:
>>> > >> undefined reference t
>>> > >> o `YAML::Emitter::PreWriteIntegralType(std::basic_stringstream<char,
>>> > >> std::char_traits<char>, std::allocator<char> >&)'
>>> >
>>> > >>
>>> > >> /home/ewimmer/ewimmer_importlibs/importlibs/src/OpenColorIO/imageworks-Open
>>> > >> ColorIO-a16d9ac/build/ext/dist/include/yaml-cpp/emitter.h:110:
>>> > >> undefined reference t
>>> > >> o
>>> > >> `YAML::Emitter::PostWriteIntegralType(std::basic_stringstream<char,
>>> > >> std::char_traits<char>, std::allocator<char> > const&)'
>>> >
>>> > >>
>>> > >> /var/tmp-ssd/doNotRemove/builds/zeno3_ssd/RHEL5_AMD64_OPT/lib/libOpenColorI
>>> > >> O.a(Config.cpp.o):
>>> > >> In function `operator<<':
>>> >
>>> > >>
>>> > >> /home/ewimmer/ewimmer_importlibs/importlibs/src/OpenColorIO/imageworks-Open
>>> > >> ColorIO-a16d9ac/build/ext/dist/include/yaml-cpp/emitter.h:152:
>>> > >> undefined reference t
>>> > >> o `YAML::Emitter::SetLocalValue(YAML::EMITTER_MANIP)'
>>> > >> /home/ewimmer/ewimmer_importlibs/importlibs/src/OpenColorIO/ima
>>> > >> ....
>>
>>
>

Join ocio-dev@lists.aswf.io to automatically receive all group messages.