Hi Paul,

The build is made with cmake which generates the Makefiles for you. Are you not 
running cmake yourself? That’s where you’d add those compile time options, and 
then in cmake run “generate” again. If you don’t want to edit source code 
that’s probably your only option. You can edit the makefiles that cmake creates 
but if you run cmake’s generate it’ll just overwrite them (hence that warning 
in the file you mentioned)

OK, so Xcode8 still defaults to c++03, I know the date of __cplusplus is oddly 
set to 1997, this is the "build software by large committee effect" in action 
:-) c++03 was so similar to c++98 they didn’t change it (I guess), and weirdly 
c++98 was “blessed" in the spring of 1998 but the change of the define’s value 
was committed in the winter of 1997. Yuk.

Don’t think clang will support any lower values, it will however go into a 
gcc-from-sometime-ago mode with the following flag to the compile and link 
lines: -stdlib=libstdc++. This selects a completely different c/c++ runtime 
that was frozen in time when Apple switched to clang (from gcc). As odd as that 
sounds it’s still a viable runtime on 10.12. It’s been a long time since I 
compiled sigrok on a mac and I think that would have been when libstdc++ was 
the default (the default is clang’s own libc++ now) If I can find my notes on 
that I’ll post them

- James


> On May 17, 2017, at 11:28 AM, paulcrawfordgm <paulcrawfor...@gmail.com> wrote:
> 
> Hi James,
> 
> Thank you so much for your quick response.
> 
> This is all running on predefined scripts and I am not sure that I have the 
> ability to move or split headers. 
> 
> I looked at the “Makefile” for Pulseview but could not find in it any -W 
> options that I could add -Wno-undefined-var-template to to change the 
> compilation behaviour. Perhaps it is somewhere else that I am not looking at. 
> For my own project compilations it is obvious where to add the options, but 
> for Pulseview the Makefile is generated automatically and has the warning not 
> to edit it so the options presumably come from somewhere else. Perhaps you 
> can enlighten me on that...
> 
> I am using Xcode 8.3.2 and the command line tools for that version.
> 
> When I executed:
> sh-3.2# clang++ -dM -c -E -x c++ - </dev/null | grep cplusplus
> #define __cplusplus 199711L
> 
> it appears that __cplusplus is already defined to 199711L. I did also use the 
> -std flag to change that and got the same as you showed:
> 
> sh-3.2# clang++ -dM -c -E -x c++ -std=c++11 - </dev/null | grep cplusplus
> #define __cplusplus 201103L
> 
> but when I did “make" again the same error was there. I also found that using 
> -std=c++03 results in #define __cplusplus 199711L
> 
> What would the -std flag value be to go even lower in dates, or would that be 
> dangerous for other reasons?
> 
> Thanks again,
> 
> Paul
> 
> 
>> On May 17, 2017, at 12:55, James Burgess <jamesrburg...@me.com 
>> <mailto:jamesrburg...@me.com>> wrote:
>> 
>> Hi Paul,
>> 
>>  My guess would be that in modern C++ the rules about template definitions 
>> have been significantly tightened and clang is generally more strict than, 
>> say, gcc about most of the new rules. The rule in question (I think) is that 
>> you can no longer define a template whose parameter types are forward 
>> declared. Previously this was ok as long as you didn’t instantiate the 
>> template until the parameter types were fully defined.
>> 
>> Sometimes this can be resolved just be including the headers for the forward 
>> declared type ahead of the template definition (to make it fully defined). 
>> Sometimes this won’t work if the headers are structured in a way to take 
>> advantage of the old behavior. An example would be someone has used a 
>> forward declaration to reduce the header file dependency on some type, then 
>> it can get tricky. I’ve found I’ve had to split headers to resolve those 
>> kinds of problems.
>> 
>> The other thing you could try is adding -Wno-undefined-var-template to the 
>> compile line, most (all?) of the clang options have the negation by adding 
>> "no-“ in front of them.
>> 
>> Another is, you didn’t say which Xcode you are using, likely 8 given you’re 
>> on 10.12, the default I think is -std=c++11, you might try something lower. 
>> Xcode7 defaults to c++03, which you can determine with this command (this is 
>> Xcode7):
>> 
>> jrb# clang++ -dM -c -E -x c++ - </dev/null | grep cplusplus
>> #define __cplusplus 199711L
>> 
>> Here’s how you use the -std flag to change that:
>> 
>> jrb# clang++ -dM -c -E -x c++ -std=c++11 - </dev/null | grep cplusplus
>> #define __cplusplus 201103L
>> 
>> (c++03 decided to not change the date to 2003, who knows why ;-)
>> 
>> Hope that helps,
>> 
>> - James
>> 
>> 
>> 
>>> On May 17, 2017, at 9:04 AM, paulcrawfordgm <paulcrawfor...@gmail.com 
>>> <mailto:paulcrawfor...@gmail.com>> wrote:
>>> 
>>> Hi,
>>> 
>>> I am attempting to build Pulseview in MacOS 10.12.5. When I do “$ make” I 
>>> get an error:
>>> 
>>> [  2%] Building CXX object CMakeFiles/pulseview.dir/main.cpp.o
>>> In file included from /Users/paulcrawford/pulseview/main.cpp:25:
>>> /usr/local/Cellar/libsigrok/HEAD-64f628b/include/libsigrokcxx/libsigrokcxx.hpp:969:20:
>>>  error: instantiation of variable 'sigrok::EnumValue<sigrok::LogLevel, 
>>> sr_loglevel>::_values' required
>>>       here, but no definition is available 
>>> [-Werror,-Wundefined-var-template]
>>>                 const auto pos = _values.find(static_cast<Enum>(id));
>>>                                  ^
>>> /Users/paulcrawford/pulseview/main.cpp:118:45: note: in instantiation of 
>>> member function 'sigrok::EnumValue<sigrok::LogLevel, sr_loglevel>::get' 
>>> requested here
>>>                         
>>> context->set_log_level(sigrok::LogLevel::get(loglevel));
>>>                                                                  ^
>>> /usr/local/Cellar/libsigrok/HEAD-64f628b/include/libsigrokcxx/libsigrokcxx.hpp:990:57:
>>>  note: forward declaration of template entity is here
>>>         static const std::map<const Enum, const Class * const> _values;
>>>                                                                ^
>>> /usr/local/Cellar/libsigrok/HEAD-64f628b/include/libsigrokcxx/libsigrokcxx.hpp:969: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 error generated.
>>> make[2]: *** [CMakeFiles/pulseview.dir/main.cpp.o] Error 1
>>> make[1]: *** [CMakeFiles/pulseview.dir/all] Error 2
>>> make: *** [all] Error 2
>>> 
>>> Can anyone advise on how to correct this error.
>>> 
>>> Thanks for any help.
>>> 
>>> Paul Crawford
>>> ------------------------------------------------------------------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org <http://slashdot.org/>! 
>>> http://sdm.link/slashdot_______________________________________________ 
>>> <http://sdm.link/slashdot_______________________________________________>
>>> sigrok-devel mailing list
>>> sigrok-devel@lists.sourceforge.net 
>>> <mailto:sigrok-devel@lists.sourceforge.net>
>>> https://lists.sourceforge.net/lists/listinfo/sigrok-devel 
>>> <https://lists.sourceforge.net/lists/listinfo/sigrok-devel>
>> 
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! 
> http://sdm.link/slashdot_______________________________________________
> sigrok-devel mailing list
> sigrok-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sigrok-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to