EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
<== Date ==> <== Thread ==>

Subject: RE: C++ std problem
From: "Pearson, Matthew via Tech-talk" <tech-talk at aps.anl.gov>
To: Mark Rivers <rivers at cars.uchicago.edu>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Wed, 14 Jun 2023 14:00:48 +0000

Thanks Mark. It’s probably best to not attempt to use c++1y anyway, since the gcc man page says “Support is highly experimental”.

 

Cheers,

Matt

 

From: Mark Rivers <rivers at cars.uchicago.edu>
Sent: Wednesday, June 14, 2023 9:57 AM
To: Pearson, Matthew <pearsonmr at ornl.gov>; tech-talk at aps.anl.gov
Subject: [EXTERNAL] Re: C++ std problem

 

 Hi Matt,

 

·         Using enum for the hash was fixed in C++14, so for gcc 4.8.5 can you try this and see if it works?

·          USR_CXXFLAGS_Linux += -std=c++1y

 

Thanks for the suggestion.  I tried using -std=c++1y, but the results are the same as -std=c++11.  It looks like ADPICam requires a newer version of gcc than 4.8.5.  CentOS 8 with gcc 8.5.0 works fine.

 

Mark

 

 

 


From: Pearson, Matthew <pearsonmr at ornl.gov>
Sent: Tuesday, June 13, 2023 2:05 PM
To: Mark Rivers <rivers at cars.uchicago.edu>; tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
Subject: RE: C++ std problem

 

Hi Mark,

 

Using std::hash with enum types (and PicamParameter is an enum) might be the issue:

https://stackoverflow.com/questions/18837857/cant-use-enum-class-as-unordered-map-key

 

The Galil driver declares a map like:

std::unordered_map<std::string, Source> map

 

And std::string was already supported as a hash type in C++11.

 

Using enum for the hash was fixed in C++14, so for gcc 4.8.5 can you try this and see if it works?

 

USR_CXXFLAGS_Linux += -std=c++1y

 

C++14 is the default for gcc 8.5.0, which might explain why it works on Centos 8.

Cheers,

Matt

 

From: Tech-talk <tech-talk-bounces at aps.anl.gov> On Behalf Of Mark Rivers via Tech-talk
Sent: Tuesday, June 13, 2023 1:55 PM
To: Mark Rivers <rivers at cars.uchicago.edu>; tech-talk at aps.anl.gov
Subject: [EXTERNAL] RE: C++ std problem

 

I should add that ADPICam.cpp compiles fine on Centos 8 Stream (gcc 8.5.0). 

 

I have compiled other files that use std::unordered_map on gcc 4.8.5 without problems, for example the EPICS Galil motor controller.

 

Thanks,

Mark

 

 

From: Tech-talk <tech-talk-bounces at aps.anl.gov> On Behalf Of Mark Rivers via Tech-talk
Sent: Tuesday, June 13, 2023 12:47 PM
To: tech-talk at aps.anl.gov
Subject: C++ std problem

 

I am trying to build areaDetector/ADPICam on Centos 7 (gcc 4.8.5).  It uses std::unordered_map which I believe was added in C++11.

 

If I compile without this line in the Makefile

USR_CXXFLAGS_Linux += -std=c++11

 

then I get this error, which is expected because it is not using C++11.

 

/usr/bin/g++  -D_GNU_SOURCE -D_DEFAULT_SOURCE           -D_X86_64_  -DUNIX  -Dlinux      -O3 -g   -Wall      -mtune=generic      -m64  -fPIC -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include      -I/corvette/home/epics/devel/asyn-4-43/include     -I/corvette/home/epics/devel/areaDetector-3-12-1/ADSupport/include/os/Linux -I/corvette/home/epics/devel/areaDetector-3-12-1/ADSupport/include   -I/corvette/home/epics/devel/areaDetector-3-12-1/ADCore/include -I/corvette/usr/local/epics-devel/base-7.0.7/include/compiler/gcc -I/corvette/usr/local/epics-devel/base-7.0.7/include/os/Linux -I/corvette/usr/local/epics-devel/base-7.0.7/include        -c ../ADPICam.cpp

In file included from /usr/include/c++/4.8.2/unordered_map:35:0,

                 from ../ADPICam.h:16,

                 from ../ADPICam.cpp:19:

/usr/include/c++/4.8.2/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

#error This file requires compiler and library support for the \

  ^

In file included from ../ADPICam.cpp:19:0:

../ADPICam.h:546:33: warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]

     bool imageThreadKeepAlive = true;

                                 ^

../ADPICam.h:553:5: error: 'unordered_map' in namespace 'std' does not name a type

     std::unordered_map<PicamParameter, int> parameterExistsMap;

 

 

If I use the c++11 flag then I get this error:

 

make[1]: Entering directory `/home/epics/devel/areaDetector-3-12-1/ADPICam/PICamApp/src/O.linux-x86_64'
/usr/bin/g++  -D_GNU_SOURCE -D_DEFAULT_SOURCE           -D_X86_64_  -DUNIX  -Dlinux      -O3 -g   -Wall     -std=c++11  -mtune=generic      -m64  -fPIC -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include      -I/corvette/home/epics/devel/asyn-4-43/include     -I/corvette/home/epics/devel/areaDetector-3-12-1/ADSupport/include/os/Linux -I/corvette/home/epics/devel/areaDetector-3-12-1/ADSupport/include   -I/corvette/home/epics/devel/areaDetector-3-12-1/ADCore/include -I/corvette/usr/local/epics-devel/base-7.0.7/include/compiler/gcc -I/corvette/usr/local/epics-devel/base-7.0.7/include/os/Linux -I/corvette/usr/local/epics-devel/base-7.0.7/include        -c ../ADPICam.cpp
In file included from /usr/include/c++/4.8.2/bits/hashtable.h:35:0,
                 from /usr/include/c++/4.8.2/unordered_map:47,
                 from ../ADPICam.h:16,
                 from ../ADPICam.cpp:19:
/usr/include/c++/4.8.2/bits/hashtable_policy.h: In instantiation of 'struct std::__detail::_Hash_code_base<PicamParameter, std::pair<const PicamParameter, int>, std::__detail::_Select1st, std::hash<PicamParameter>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>':
/usr/include/c++/4.8.2/bits/hashtable_policy.h:1402:10:   required from 'struct std::__detail::_Hashtable_base<PicamParameter, std::pair<const PicamParameter, int>, std::__detail::_Select1st, std::equal_to<PicamParameter>, std::hash<PicamParameter>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Hashtable_traits<true, false, true> >'
/usr/include/c++/4.8.2/bits/hashtable.h:174:11:   required from 'class std::_Hashtable<PicamParameter, std::pair<const PicamParameter, int>, std::allocator<std::pair<const PicamParameter, int> >, std::__detail::_Select1st, std::equal_to<PicamParameter>, std::hash<PicamParameter>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >'
/usr/include/c++/4.8.2/bits/unordered_map.h:100:18:   required from 'class std::unordered_map<PicamParameter, int>'
../ADPICam.h:553:45:   required from here
/usr/include/c++/4.8.2/bits/hashtable_policy.h:1070:12: error: invalid use of incomplete type 'struct std::hash<PicamParameter>'
     struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2,
            ^
In file included from /usr/include/c++/4.8.2/bits/basic_string.h:3033:0,
                 from /usr/include/c++/4.8.2/string:52,
                 from /usr/include/c++/4.8.2/random:41,
                 from /usr/include/c++/4.8.2/bits/stl_algo.h:65,
                 from /usr/include/c++/4.8.2/algorithm:62,
                 from ../ADPICam.cpp:11:
/usr/include/c++/4.8.2/bits/functional_hash.h:58:12: error: declaration of 'struct std::hash<PicamParameter>'
     struct hash;
            ^
In file included from /usr/include/c++/4.8.2/bits/hashtable.h:35:0,
                 from /usr/include/c++/4.8.2/unordered_map:47,
                 from ../ADPICam.h:16,
                 from ../ADPICam.cpp:19:
/usr/include/c++/4.8.2/bits/hashtable_policy.h:1070:12: error: invalid use of incomplete type 'struct std::hash<PicamParameter>'
     struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2,
            ^
In file included from /usr/include/c++/4.8.2/bits/basic_string.h:3033:0,
                 from /usr/include/c++/4.8.2/string:52,
                 from /usr/include/c++/4.8.2/random:41,
                 from /usr/include/c++/4.8.2/bits/stl_algo.h:65,
                 from /usr/include/c++/4.8.2/algorithm:62,
                 from ../ADPICam.cpp:11:
/usr/include/c++/4.8.2/bits/functional_hash.h:58:12: error: declaration of 'struct std::hash<PicamParameter>'
     struct hash;

 

Can anyone explain what that error means, and is it possible to use gcc 4.8.5 to compile this file?

 

Mark

 

 

 


References:
C++ std problem Mark Rivers via Tech-talk
RE: C++ std problem Mark Rivers via Tech-talk
RE: C++ std problem Pearson, Matthew via Tech-talk
Re: C++ std problem Mark Rivers via Tech-talk

Navigate by Date:
Prev: Re: C++ std problem Mark Rivers via Tech-talk
Next: Re: C++ std problem Wlodek, Jakub via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
Navigate by Thread:
Prev: Re: C++ std problem Mark Rivers via Tech-talk
Next: Re: C++ std problem Wlodek, Jakub via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024 
ANJ, 14 Jun 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·