Hi,

Follow up: regarding the pulseview link problems using clang/clang++

The problem seems to be related to the use of option -fvisibility=hidden 
and the "SR_API" visibility attributes.

The problem seems to occour because of references from outside the 
libsigrokxx library to some of the classes (inside libsigrokxx) that use 
static initialization through explicit template specialization.

Modifying the autogenerated bindings/cxx/enums.cpp by hand (see diff 
below) - adding "SR_API" to the explicit template specialization fixes 
the problem and pulseview is able to compile,link and execute.

One problem is that bindings/cxx/enums.cpp is autogenerated.

The puzzle, that I'm too tired to solve right now, is why the problem 
only relates to classes "LogLevel" and "TriggerMatchType" ?
There are lots of other classes based on the EnumValue template that 
does not have this problem - and they all use the same approach for 
(static) initialization through explicit template specialization...

I need to sleep now :-)

/Uffe

--- bindings/cxx/enums.cpp.orig 2015-01-04 06:11:07.623170506 +0100
+++ bindings/cxx/enums.cpp      2015-01-04 06:11:47.577080031 +0100
@@ -11,7 +11,7 @@
  const LogLevel * const LogLevel::INFO = &LogLevel::_INFO;
  const LogLevel * const LogLevel::DBG = &LogLevel::_DBG;
  const LogLevel * const LogLevel::SPEW = &LogLevel::_SPEW;
-template<> const std::map<const enum sr_loglevel, const LogLevel * 
const> EnumValue<LogLevel, enum sr_loglevel>::_values = {
+template<> SR_API const std::map<const enum sr_loglevel, const LogLevel 
* const> EnumValue<LogLevel, enum sr_loglevel>::_values = {
        {SR_LOG_NONE, LogLevel::NONE},
        {SR_LOG_ERR, LogLevel::ERR},
        {SR_LOG_WARN, LogLevel::WARN},
@@ -344,7 +344,7 @@
  const TriggerMatchType * const TriggerMatchType::EDGE = 
&TriggerMatchType::_EDGE;
  const TriggerMatchType * const TriggerMatchType::OVER = 
&TriggerMatchType::_OVER;
  const TriggerMatchType * const TriggerMatchType::UNDER = 
&TriggerMatchType::_UNDER;
-template<> const std::map<const enum sr_trigger_matches, const 
TriggerMatchType * const> EnumValue<TriggerMatchType, enum 
sr_trigger_matches>::_values = {
+template<> SR_API const std::map<const enum sr_trigger_matches, const 
TriggerMatchType * const> EnumValue<TriggerMatchType, enum 
sr_trigger_matches>::_values = {
        {SR_TRIGGER_ZERO, TriggerMatchType::ZERO},
        {SR_TRIGGER_ONE, TriggerMatchType::ONE},
        {SR_TRIGGER_RISING, TriggerMatchType::RISING},

/Uffe

On 2015-01-02 04:18, Uffe Jakobsen wrote:
>
> On 2014-12-31 09:06, Joel Holdsworth wrote:
>> Is your problem related to the std::isnan issue? If so, this has now
>> been fixed
>>
>
> No, I'm stuck with a linking issue with pulseview HEAD on FreeBSD - see
> below:
>
> Question: have anyone tried to build sigrok and pulseview on FreeBSD
> recently ? sigrok libs and cli compiles and links - with no problems -
> but pulseview does not link
>
>
> Linking CXX executable pulseview
> CMakeFiles/pulseview.dir/main.cpp.o: In function
> `std::__1::__tree<std::__1::__value_type<sr_loglevel const,
> sigrok::LogLevel const* const>,
> std::__1::__map_value_compare<sr_loglevel const,
> std::__1::__value_type<sr_loglevel const, sigrok::LogLevel const*
> const>, std::__1::less<sr_loglevel const>, true>,
> std::__1::allocator<std::__1::__value_type<sr_loglevel const,
> sigrok::LogLevel const* const> > >::__root() const':
> /usr/include/c++/v1/__tree:878: undefined reference to
> `sigrok::EnumValue<sigrok::LogLevel, sr_loglevel>::_values'
> CMakeFiles/pulseview.dir/main.cpp.o: In function
> `sigrok::EnumValue<sigrok::LogLevel, sr_loglevel>::get(int)':
> /home/wuffe/local/prj/sigrok_trunk_build/libsigrok.git/bindings/cxx/include/libsigrok/libsigrok.hpp:1001:
> undefined reference to `sigrok::EnumValue<sigrok::LogLevel,
> sr_loglevel>::_values'
> CMakeFiles/pulseview.dir/pv/view/logicsignal.cpp.o: In function
> `std::__1::__tree<std::__1::__value_type<sr_trigger_matches const,
> sigrok::TriggerMatchType const* const>,
> std::__1::__map_value_compare<sr_trigger_matches const,
> std::__1::__value_type<sr_trigger_matches const,
> sigrok::TriggerMatchType const* const>,
> std::__1::less<sr_trigger_matches const>, true>,
> std::__1::allocator<std::__1::__value_type<sr_trigger_matches const,
> sigrok::TriggerMatchType const* const> > >::__root() const':
> /usr/include/c++/v1/__tree:878: undefined reference to
> `sigrok::EnumValue<sigrok::TriggerMatchType, sr_trigger_matches>::_values'
> CMakeFiles/pulseview.dir/pv/view/logicsignal.cpp.o: In function
> `sigrok::EnumValue<sigrok::TriggerMatchType,
> sr_trigger_matches>::get(int)':
> /home/wuffe/local/prj/sigrok_trunk_build/libsigrok.git/bindings/cxx/include/libsigrok/libsigrok.hpp:1001:
> undefined reference to `sigrok::EnumValue<sigrok::TriggerMatchType,
> sr_trigger_matches>::_values'
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> CMakeFiles/pulseview.dir/build.make:3022: recipe for target 'pulseview'
> failed
> gmake[4]: *** [pulseview] Error 1
>
> /Uffe
>



------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to