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  <20192020  2021  2022  2023  2024  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  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: pscdrv fftwrap compile error for the Debian/ x64
From: "Ha, Kiman via Tech-talk" <[email protected]>
To: Michael Davidsaver <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Tue, 24 Dec 2019 00:36:18 +0000
Hi Michael,
Thank you for the update, now no compile errors from fftwarp.

Do you remember that your BOOSTER power supply version which is the pscApp module ?
Because my version included the pscApp  and found another error.


~/pscdrv/pscApp$ make
make -C ./src install
make[1]: Entering directory '/home/kha/pscdrv/pscApp/src'
make -C O.linux-x86_64 -f ../Makefile TOP=../../.. \
    T_A=linux-x86_64 install
make[2]: Entering directory '/home/kha/pscdrv/pscApp/src/O.linux-x86_64'
/usr/bin/g++  -D_GNU_SOURCE -D_DEFAULT_SOURCE         -Wdate-time -D_FORTIFY_SOURCE=2    -D_X86_64_  -DUNIX  -Dlinux     -O3 -g   -Wall    -fdebug-prefix-map=/build/epics-base-3.15.6=. -fstack-protector-strong -Wformat -Werror=format-security  -fno-operator-names -pedantic  -mtune=generic     -m64  -I. -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc -I../../../include/os/Linux -I../../../include -I/usr/lib/epics/include/compiler/gcc -I/usr/lib/epics/include/os/Linux -I/usr/lib/epics/include -I/usr/lib/epics/include/compiler/gcc -I/usr/lib/epics/include/os/Linux -I/usr/lib/epics/include -I/usr/lib/epics/include/compiler/gcc -I/usr/lib/epics/include/os/Linux -I/usr/lib/epics/include        -c ../psctbl.cpp
../psctbl.cpp:12:38: fatal error: gsl/gsl_statistics_float.h: No such file or directory
 #include <gsl/gsl_statistics_float.h>
                                      ^
compilation terminated.
/etc/epics/configure/RULES_BUILD:239: recipe for target 'psctbl.o' failed
make[2]: *** [psctbl.o] Error 1
make[2]: Leaving directory '/home/kha/pscdrv/pscApp/src/O.linux-x86_64'
/etc/epics/configure/RULES_ARCHS:58: recipe for target 'install.linux-x86_64' failed
make[1]: *** [install.linux-x86_64] Error 2
make[1]: Leaving directory '/home/kha/pscdrv/pscApp/src'
/etc/epics/configure/RULES_DIRS:84: recipe for target 'src.install' failed
make: *** [src.install] Error 2


Thanks,
Kiman





-----Original Message-----
From: Michael Davidsaver <[email protected]> 
Sent: Monday, December 23, 2019 6:34 PM
To: Ha, Kiman <[email protected]>
Cc: [email protected]
Subject: Re: pscdrv fftwrap compile error for the Debian/ x64

Hi Kiman,

It's been some time since I built the fftw part.  Trying now, I see the same error.  The issue arises from the different representations of complex numbers in c/c++.  Part is described in part in the FFTW docs:

https://urldefense.com/v3/__http://www.fftw.org/fftw3_doc/Complex-numbers.html*Complex-numbers__;Iw!!P4SdNyxKAPE!W66622Ie5V46cCewwHCcieEI9D7Y44C8eVWWUt80aIiUMS8qaYYtKpsLGm5c$ 

I'll discuss in depth as a similar issue recently came up with isnan() and friends from 'math.h' via 'epicsMath.h'.

The source of the problem is the "overlay" version of many of the C standard headers (<complex.h> among them) which GCC installs.  eg. "/usr/include/c++/8/complex.h"
which is earlier in the implied search path than "/usr/include/complex.h".

This has long been the case, and can work through the gcc specific "#include_next"
directive to also include the real header.  The recent (circa gcc 6) change is to skip the "#include_next" when compiling c++.  This hides the C99 standard complex types, and breaks the magic which FFTW uses to decide whether to use the C99 complex type, or the older 'double[2]' array type.

I originally wrote the pscdrv code to use C99 complex types on the assumption that was the future-proof way to go.  However, this is clearly not how things have turned out.
Thankfully, I don't seem to have used more than creal() and cimag(), so the simplest change is to avoid complex.h altogether.

https://github.com/mdavidsaver/pscdrv/commit/b6dcdf7deecee95499dfb9f03786f5297e123307

This compiles for me, however I have __not__ run tested the result.


On 12/23/19 10:13 AM, Ha, Kiman wrote:
> Hi Michael,
> 
>  
> 
> The psdrv softIOC module is running stably since 2015 with Debian-7/32-bit for the NSLS-II BPMs.
> 
>  
> 
> Now it is time to update Debian9 and 64 bit OS.
> 
> https://github.com/mdavidsaver/pscdrv
> 
> https://urldefense.com/v3/__http://irfu.cea.fr/Meetings/epics/presenta
> tions/Thursday/pscdrv-201410.pdf__;!!P4SdNyxKAPE!W66622Ie5V46cCewwHCci
> eEI9D7Y44C8eVWWUt80aIiUMS8qaYYtKsHQS4Fb$
> 
>  
> 
>  
> 
> I was trying to compile the pscdrv module for the Debian-9 x64 environment and found some errors from the fftwrap module.
> 
> Can you advice what happened?
> 
>  
> 
>  
> 
> Environment:
> 
> Debian GNU/Linux 9
> 
> gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)
> 
>  
> 
>  
> 
> ~/pscdrv/sigApp$ make
> 
> make -C ./src install
> 
> make[1]: Entering directory '/home/kha/pscdrv/sigApp/src'
> 
> make -C O.linux-x86_64 -f ../Makefile TOP=../../.. \
> 
>     T_A=linux-x86_64 install
> 
> make[2]: Entering directory '/home/kha/pscdrv/sigApp/src/O.linux-x86_64'
> 
> /usr/bin/g++  -D_GNU_SOURCE -D_DEFAULT_SOURCE         -Wdate-time 
> -D_FORTIFY_SOURCE=2    -D_X86_64_  -DUNIX  -Dlinux     -O3 -g   -Wall    
> -fdebug-prefix-map=/build/epics-base-3.15.6=. -fstack-protector-strong 
> -Wformat -Werror=format-security   -mtune=generic     -m64 -fPIC -I. 
> -I../O.Common -I. -I. -I.. -I../../../include/compiler/gcc 
> -I../../../include/os/Linux -I../../../include 
> -I/usr/lib/epics/include/compiler/gcc 
> -I/usr/lib/epics/include/os/Linux -I/usr/lib/epics/include 
> -I/usr/lib/epics/include/compiler/gcc 
> -I/usr/lib/epics/include/os/Linux -I/usr/lib/epics/include 
> -I/usr/lib/epics/include/compiler/gcc 
> -I/usr/lib/epics/include/os/Linux -I/usr/lib/epics/include        -c 
> ../fftwrap.cpp
> 
> ../fftwrap.cpp: In member function 'void PSDCalc::calculate()':
> 
> ../fftwrap.cpp:182:42: error: array must be initialized with a 
> brace-enclosed initializer
> 
>                  fftw_complex temp = mid[j];
> 
>                                           ^
> 
> ../fftwrap.cpp:184:39: error: cannot convert 'double*' to '__complex__ double' for argument '1' to 'double creal(__complex__ double)'
> 
>                  out[j-1] += creal(temp)*creal(temp) + 
> cimag(temp)*cimag(temp);
> 
>                                        ^
> 
> ../fftwrap.cpp:184:51: error: cannot convert 'double*' to '__complex__ double' for argument '1' to 'double creal(__complex__ double)'
> 
>                  out[j-1] += creal(temp)*creal(temp) + 
> cimag(temp)*cimag(temp);
> 
>                                                    ^
> 
> ../fftwrap.cpp:184:65: error: cannot convert 'double*' to '__complex__ double' for argument '1' to 'double cimag(__complex__ double)'
> 
>                  out[j-1] += creal(temp)*creal(temp) + 
> cimag(temp)*cimag(temp);
> 
>                                                                  ^
> 
> ../fftwrap.cpp:184:77: error: cannot convert 'double*' to '__complex__ double' for argument '1' to 'double cimag(__complex__ double)'
> 
>                  out[j-1] += creal(temp)*creal(temp) + 
> cimag(temp)*cimag(temp);
> 
>                                                                              
> ^
> 
> In file included from ../fftwrap.cpp:17:0:
> 
> ../fftwrap.h: In instantiation of 'void FFTWAllocator<T>::destroy(FFTWAllocator<T>::pointer) [with T = double [2]; FFTWAllocator<T>::pointer = double (*)[2]]':
> 
> /usr/include/c++/6/bits/alloc_traits.h:256:4:   required from 'static decltype (__a.destroy(__p)) std::allocator_traits<_Alloc>::_S_destroy(_Alloc2&, _Tp*, int) [with _Alloc2 = FFTWAllocator<double [2]>; _Tp = double [2]; _Alloc = FFTWAllocator<double [2]>; decltype (__a.destroy(__p)) = void]'
> 
> /usr/include/c++/6/bits/alloc_traits.h:356:14:   required from 'static void std::allocator_traits<_Alloc>::destroy(_Alloc&, _Tp*) [with _Tp = double [2]; _Alloc = FFTWAllocator<double [2]>]'
> 
> /usr/include/c++/6/bits/stl_construct.h:143:19:   required from 'void std::_Destroy(_ForwardIterator, _ForwardIterator, _Allocator&) [with _ForwardIterator = double (*)[2]; _Allocator = FFTWAllocator<double [2]>]'
> 
> /usr/include/c++/6/bits/vector.tcc:571:18:   required from 'void std::vector<_Tp, _Alloc>::_M_default_append(std::vector<_Tp, _Alloc>::size_type) [with _Tp = double [2]; _Alloc = FFTWAllocator<double [2]>; std::vector<_Tp, _Alloc>::size_type = long unsigned int]'
> 
> /usr/include/c++/6/bits/stl_vector.h:677:21:   required from 'void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type) [with _Tp = double [2]; _Alloc = FFTWAllocator<double [2]>; std::vector<_Tp, _Alloc>::size_type = long unsigned int]'
> 
> ../fftwrap.cpp:143:35:   required from here
> 
> ../fftwrap.h:72:10: error: request for member '~double [2]' in '* p', which is of non-class type 'double [2]'
> 
>      {p->~T();}
> 
>       ~~~~^
> 
> ../fftwrap.h: In instantiation of 'void FFTWAllocator<T>::construct(FFTWAllocator<T>::pointer, FFTWAllocator<T>::const_reference&) [with T = double [2]; FFTWAllocator<T>::pointer = double (*)[2]; FFTWAllocator<T>::const_reference = const double (&)[2]]':
> 
> /usr/include/c++/6/bits/alloc_traits.h:243:4:   required from 'static std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = double [2]; _Args = {double [2]}; _Alloc = FFTWAllocator<double [2]>; std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> = void]'
> 
> /usr/include/c++/6/bits/alloc_traits.h:344:16:   required from 'static decltype (std::allocator_traits<_Alloc>::_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) std::allocator_traits<_Alloc>::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = double [2]; _Args = {double [2]}; _Alloc = FFTWAllocator<double [2]>; decltype (std::allocator_traits<_Alloc>::_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) = void]'
> 
> /usr/include/c++/6/bits/stl_uninitialized.h:267:25:   required from '_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator = std::move_iterator<double (*)[2]>; _ForwardIterator = double (*)[2]; _Allocator = FFTWAllocator<double [2]>]'
> 
> /usr/include/c++/6/bits/stl_uninitialized.h:303:2:   required from '_ForwardIterator std::__uninitialized_move_if_noexcept_a(_InputIterator, _InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator = double (*)[2]; _ForwardIterator = double (*)[2]; _Allocator = FFTWAllocator<double [2]>]'
> 
> /usr/include/c++/6/bits/vector.tcc:563:7:   required from 'void std::vector<_Tp, _Alloc>::_M_default_append(std::vector<_Tp, _Alloc>::size_type) [with _Tp = double [2]; _Alloc = FFTWAllocator<double [2]>; std::vector<_Tp, _Alloc>::size_type = long unsigned int]'
> 
> /usr/include/c++/6/bits/stl_vector.h:677:21:   required from 'void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type) [with _Tp = double [2]; _Alloc = FFTWAllocator<double [2]>; std::vector<_Tp, _Alloc>::size_type = long unsigned int]'
> 
> ../fftwrap.cpp:143:35:   required from here
> 
> ../fftwrap.h:69:6: error: parenthesized initializer in array new 
> [-fpermissive]
> 
>      {::new((void*)p) T(val);}
> 
>       ^~~~~~~~~~~~~~~~~~~~~~
> 
> /etc/epics/configure/RULES_BUILD:239: recipe for target 'fftwrap.o' 
> failed
> 
> make[2]: *** [fftwrap.o] Error 1
> 
> make[2]: Leaving directory '/home/kha/pscdrv/sigApp/src/O.linux-x86_64'
> 
> /etc/epics/configure/RULES_ARCHS:58: recipe for target 
> 'install.linux-x86_64' failed
> 
> make[1]: *** [install.linux-x86_64] Error 2
> 
> make[1]: Leaving directory '/home/kha/pscdrv/sigApp/src'
> 
> /etc/epics/configure/RULES_DIRS:84: recipe for target 'src.install' 
> failed
> 
> make: *** [src.install] Error 2
> 
>  
> 


Replies:
Re: pscdrv fftwrap compile error for the Debian/ x64 Michael Davidsaver via Tech-talk
References:
pscdrv fftwrap compile error for the Debian/ x64 Ha, Kiman via Tech-talk
Re: pscdrv fftwrap compile error for the Debian/ x64 Michael Davidsaver via Tech-talk

Navigate by Date:
Prev: Ethernet to RS-232 Danfysik supply connection issues Marissa Kranz via Tech-talk
Next: subArray record [SEC=UNOFFICIAL] STARRITT, Andrew 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  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: pscdrv fftwrap compile error for the Debian/ x64 Michael Davidsaver via Tech-talk
Next: Re: pscdrv fftwrap compile error for the Debian/ x64 Michael Davidsaver 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  <20192020  2021  2022  2023  2024 
ANJ, 24 Dec 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·