Bug 999 - Pulseview: sigrok-native-macosx won't compile: no member named 'parse_string' in 'sigrok::Option'
Summary: Pulseview: sigrok-native-macosx won't compile: no member named 'parse_string'...
Status: RESOLVED WORKSFORME
Alias: None
Product: PulseView
Classification: Unclassified
Component: Other (show other bugs)
Version: 0.4.0
Hardware: All Mac OS X
: Normal normal
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-22 19:02 CEST by simon.guilliams
Modified: 2018-04-07 19:49 CEST (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description simon.guilliams 2017-07-22 19:02:07 CEST
Hello,

Sigrok pulseview does not compile because of C++ compiling errors.

I followed the instructions on this page step by step:
https://sigrok.org/wiki/Mac_OS_X#Building_using_Homebrew

$ brew install stuff for 3 hours
$ git clone git://sigrok.org/sigrok-util
$ cd sigrok-util/cross-compile/macosx
$ ./sigrok-native-macosx

Script crashes with error message:





=======================

[  7%] Building CXX object CMakeFiles/pulseview.dir/pv/session.cpp.o
/Users/labelec/Applications/sigrok-util/cross-compile/macosx/build/pulseview/pv/session.cpp:472:22: error: no member named 'parse_string' in 'sigrok::Option'
                result[key] = opt->parse_string(val);
                              ~~~  ^
/Users/labelec/Applications/sigrok-util/cross-compile/macosx/build/pulseview/pv/session.cpp:1041:10: error: no member named 'get_data_as_float' in 'sigrok::Analog'
        analog->get_data_as_float(data.get());
        ~~~~~~  ^
/Users/labelec/Applications/sigrok-util/cross-compile/macosx/build/pulseview/pv/session.cpp:472:22: error: no member named 'parse_string' in 'sigrok::Option'
                result[key] = opt->parse_string(val);
                              ~~~  ^
2 errors generated.
/Users/labelec/Applications/sigrok-util/cross-compile/macosx/build/pulseview/pv/session.cpp:1041:10: error: no member named 'get_data_as_float' in 'sigrok::Analog'
        analog->get_data_as_float(data.get());
        ~~~~~~  ^
make[2]: *** [test/CMakeFiles/pulseview-test.dir/__/pv/session.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[  8%] Building CXX object CMakeFiles/pulseview.dir/pv/storesession.cpp.o
make[1]: *** [test/CMakeFiles/pulseview-test.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[  9%] Building CXX object CMakeFiles/pulseview.dir/pv/util.cpp.o
[  9%] Building CXX object CMakeFiles/pulseview.dir/pv/binding/binding.cpp.o
2 errors generated.
make[2]: *** [CMakeFiles/pulseview.dir/pv/session.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/pulseview.dir/all] Error 2
make: *** [all] Error 2


=======================



There is also a warning before:


=======================

[  6%] Building CXX object CMakeFiles/pulseview.dir/pv/mainwindow.cpp.o
In file included from /Users/labelec/Applications/sigrok-util/cross-compile/macosx/build/pulseview/main.cpp:25:
/Users/labelec/.brew/include/libsigrokcxx/libsigrokcxx.hpp:968:20: warning: instantiation of variable 'sigrok::EnumValue<sigrok::LogLevel, sr_loglevel>::_values' required here, but
      no definition is available [-Wundefined-var-template]
                const auto pos = _values.find(static_cast<Enum>(id));
                                 ^
/Users/labelec/Applications/sigrok-util/cross-compile/macosx/build/pulseview/main.cpp:124:45: note: in instantiation of member function
      'sigrok::EnumValue<sigrok::LogLevel, sr_loglevel>::get' requested here
                        context->set_log_level(sigrok::LogLevel::get(loglevel));
                                                                 ^
/Users/labelec/.brew/include/libsigrokcxx/libsigrokcxx.hpp:989:57: note: forward declaration of template entity is here
        static const std::map<const Enum, const Class * const> _values;
                                                               ^
/Users/labelec/.brew/include/libsigrokcxx/libsigrokcxx.hpp:968:20: note: add an explicit instantiation declaration to suppress this warning if
      'sigrok::EnumValue<sigrok::LogLevel, sr_loglevel>::_values' is explicitly instantiated in another translation unit
                const auto pos = _values.find(static_cast<Enum>(id));
                                 ^
1 warning generated.

=======================


I'm on OSX Sierra 10.12.3


I have 4 questions :

- Could you fix the problem please ?

- How could I run pulseview on OSX ? Isn't there an 'AppImage' or already-compiled standalone package of Pulseview and co ?

- For the bug report I've chosen a random version number. How am I supposed to know the version since the script does handle it ?

- Don't you guys test if code compiles before pushing into production ?


Thanks a lot. Will contribute once I'll have time and cpp knowledge.
Comment 1 Soeren Apel 2017-07-22 22:04:46 CEST
Hi,

> - Could you fix the problem please ?

The problem is an outdated libsigrok on your system. I do not know where it comes from but it's there and it's used by CMake when trying to build PulseView. 

Option::parse_string() was introduced by http://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff;h=61a6d983bd37fcd035439dc5f2671a290ef46057 on 11 Jun 2017

Analog::get_data_as_float() was introduced by http://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff;h=c5d081f721a0d99e726596d4f8afe72cf803a576 on 27 May 2017

If a libsigrokcxx was used that was built from libsigrok git head, these methods wouldn't be missing.


> - How could I run pulseview on OSX ? Isn't there an 'AppImage' or already-compiled standalone package of Pulseview and co ?

We're currently in the process of providing those, you may try an experimental build if you so desire: http://sigrok.org/jenkins/job/sigrok-native-appimage/platform=native-amd64/


> - For the bug report I've chosen a random version number. How am I supposed to know the version since the script does handle it ?

To be honest, it doesn't really matter. If it matters to us, we'll either confirm or adjust it ourselves. In most cases where bugs are reported, PV can successfully start up and the about dialog gives the version currently being run.


> - Don't you guys test if code compiles before pushing into production ?

I respectfully reject the notion that we are careless.
Comment 2 simon.guilliams 2017-07-23 14:04:24 CEST
Hi,

Indeed, there was an outdated libsigrok package on my computer.

Before trying the cross-copmile script, I tried:
$ brew install sigrok-cli

Which brilliantly crashed with error message:



=======================

==> ./configure --prefix=/Users/labelec/.brew/Cellar/sigrok-cli/0.5.0
==> make install
Last 15 lines from /Users/labelec/Library/Logs/Homebrew/sigrok-cli/02.make:
/Users/labelec/.brew/Cellar/libsigrok/0.4.0/include/libsigrok/libsigrok.h:603:9: note: forward declaration of 'struct sr_dev_inst'
        struct sr_dev_inst *sdi;
               ^
session.c:520:23: error: too few arguments to function call, single argument 'session' was not specified
                        sr_session_destroy();
                        ~~~~~~~~~~~~~~~~~~ ^
/Users/labelec/.brew/Cellar/libsigrok/0.4.0/include/libsigrok/proto.h:115:1: note: 'sr_session_destroy' declared here
SR_API int sr_session_destroy(struct sr_session *session);
^
/Users/labelec/.brew/Cellar/libsigrok/0.4.0/include/libsigrok/libsigrok.h:121:16: note: expanded from macro 'SR_API'
#define SR_API __attribute__((visibility("default")))
               ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [session.o] Error 1
/Users/labelec/.brew/Library/Homebrew/build.rb:191:in `dump': can't dump anonymous class #<Class:0x007ff3f4167c78> (TypeError)
	from /Users/labelec/.brew/Library/Homebrew/build.rb:191:in `rescue in <main>'
	from /Users/labelec/.brew/Library/Homebrew/build.rb:180:in `<main>'
Error: marshal data too short
/Users/labelec/.brew/Library/Homebrew/utils/fork.rb:39:in `load'
/Users/labelec/.brew/Library/Homebrew/utils/fork.rb:39:in `block (3 levels) in safe_fork'
/Users/labelec/.brew/Library/Homebrew/utils.rb:396:in `ignore_interrupts'
/Users/labelec/.brew/Library/Homebrew/utils/fork.rb:26:in `block (2 levels) in safe_fork'
/Users/labelec/.brew/Library/Homebrew/utils/fork.rb:7:in `open'
/Users/labelec/.brew/Library/Homebrew/utils/fork.rb:7:in `block in safe_fork'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tmpdir.rb:88:in `mktmpdir'
/Users/labelec/.brew/Library/Homebrew/utils/fork.rb:6:in `safe_fork'
/Users/labelec/.brew/Library/Homebrew/formula_installer.rb:675:in `build'
/Users/labelec/.brew/Library/Homebrew/formula_installer.rb:306:in `install'
/Users/labelec/.brew/Library/Homebrew/cmd/install.rb:338:in `install_formula'
/Users/labelec/.brew/Library/Homebrew/cmd/install.rb:223:in `block in install'
/Users/labelec/.brew/Library/Homebrew/cmd/install.rb:221:in `each'
/Users/labelec/.brew/Library/Homebrew/cmd/install.rb:221:in `install'
/Users/labelec/.brew/Library/Homebrew/brew.rb:93:in `<main>'

=======================




At that time I didn't try "brew install Pulseview" which completed correctly.

I didn't notice brew had installed an older version of a dependency of sigrok-cli.

This fixed the problem:
$ brew uninstall libsigrokdecode
$ brew uninstall libsigrok


Before finding out about brew I tried to download everything manually, putting the right PATH, LD_LIBRARY_PATH, CPATH, etc in the environment, getting tons of bugs (like LD_LIBRARY_PATH is ignore by busybox binaries because of setuid or something like that), ...

Now I am able to open pulseview.

But I still have to find the firmware files (*.fw) for my logic analyzers, this took a while too

I tried the AppImage (on linux this time) but it doesn't load because:

./PulseView-NIGHTLY.glibc2.14-x86_64.AppImage: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by ./PulseView-NIGHTLY.glibc2.14-x86_64.AppImage)

Googled for 10 minutes and didn't find out solution

So now I have 3 questions / comments:

- Is the "brew install sigrok-cli" failure a problem on my computer or is it a bug ?

- Is the AppImage crash a problem on my side or is it a bug ? What could I do about it ?

- I find my overall experience with sigrok / pulseview painful. Making pulseview run (either on OSX and on linux) is a nightmare. Do I really have bad luck ? I got errors everywhere.

I'm sorry - I didn't mean you are careless. I am just questioning the intuitiveness of the software and I was wondering if you do test software / have unit test / do continuous integration etc. I would love the install process to be more easy.

Thanks a lot for your answers
Comment 3 Uwe Hermann 2017-07-23 15:23:12 CEST
Hi,

> - Is the "brew install sigrok-cli" failure a problem on my computer or is it a bug ?

Not sure, but anything you install via "brew install ..." is not maintained by us. Please file bug reports to the respective Homebrew maintainers for those.


> - Is the AppImage crash a problem on my side or is it a bug ? What could I do about it ?

That's work in progress, but should work on somewhat recent Linux distros. Will have a look at this later.


> - I find my overall experience with sigrok / pulseview painful. Making pulseview run (either on OSX and on linux) is a nightmare. Do I really have bad luck ? I got errors everywhere.

You probably did. I just ran ./sigrok-cross-macosx yesterday and it built everything just fine out of the box.

The same works fine with ./sigrok-cross-linux as well on Linux.


Please feel free to join us on IRC (#sigrok of Freenode), that's probably easier and quicker to debug your problems.
Comment 4 Uwe Hermann 2018-04-07 19:49:48 CEST
Closing this bug for now, no further info, and I'm reasonably sure this should all work fine. Please feel free to open with more info for reproducing this, in case it's still a problem.

Btw, the Linux AppImages we now provide should work fine by now on somewhat recent-ish distros (anything newer than Ubuntu 14.04 might work in theory). There are also Mac OS X DMG images available for PulseView now, which should also work fine.

  https://sigrok.org/wiki/Downloads

Cheers!