[CMake] help with shared-lib make failure

Andreas Naumann Andreas-Naumann at gmx.net
Mon Jun 18 14:34:48 EDT 2012


Am 18.06.2012 08:34, schrieb luxInteg:
> On Sunday 17 June 2012 14:13:00 Andreas Naumann wrote:
>
>    
>>> #----------build2: gs_test/results.c.  build  disabled   near beginning
>>> but comes in ~65%   of build
>>> [ 65%] Building C object Lib/CMakeFiles/gsl.dir/__/test/results.c.o
>>> cd /home/TESTS/BUILDgsl/Lib&&   /usr/bin/gcc  -Dgsl_EXPORTS
>>> -DHAVE_CONFIG_H - DPIC -m64 -fPIC  -msse2 -fPIC -I~SRS/blas -I~SRS/block
>>> -I~SRS/bspline - I~SRS/cblas -I~SRS/cdf -I~SRS/cheb -I~SRS/deriv
>>> -I~SRS/dht -I~SRS/eigen - I~SRS/err -I~SRS/fit -I~SRS/gsl
>>> -I~SRS/histogram -I~SRS/iee-utils - I~SRS/integration
>>> -I~SRS/interpolation -I~SRS/linalg -I~SRS/matrix -I~SRS/min -I~SRS/monte
>>> -I~SRS/multifit -I~SRS/multimin -I~SRS/multiroots -I~SRS/multiset
>>> -I~SRS/ntuple -I~SRS/ode-initval -I~SRS/permuation -I~SRS/poly
>>> -I~SRS/qrng - I~SRS/randist -I~SRS/rng -I~SRS/roots -I~SRS/siman
>>> -I~SRS/sort -I~SRS/specfunc -I~SRS/statistics -I~SRS/sum -I~SRS/sys
>>> -I~SRS/test -I~SRS/utils -I~SRS/vector -I~SRS/wavelet
>>> -I/home/TESTS/BUILDgsl -I~SRS   -msse2 -mfpmath=sse -msse3 - mfpmath=sse
>>> -Wall -o CMakeFiles/gsl.dir/__/test/results.c.o   -c ~SRS/test/results.c
>>> ~SRS/test/results.c: In function 'gsl_test':
>>> ~SRS/test/results.c:89: error: 'va_list' undeclared (first use in this
>>> function)
>>> ~SRS/test/results.c:89: error: (Each undeclared identifier is reported
>>> only once
>>> ~SRS/test/results.c:89: error: for each function it appears in.)
>>> ~SRS/test/results.c:89: error: expected ';' before 'ap'
>>> ~SRS/test/results.c:93: warning: implicit declaration of function
>>> 'va_start' ~SRS/test/results.c:93: error: 'ap' undeclared (first use in
>>> this function) ~SRS/test/results.c:96: warning: implicit declaration of
>>> function 'va_end' ~SRS/test/results.c: In function 'gsl_test_rel':
>>> ~SRS/test/results.c:149: error: 'va_list' undeclared (first use in this
>>> function)
>>> ~SRS/test/results.c:149: error: expected ';' before 'ap'
>>> ~SRS/test/results.c:153: error: 'ap' undeclared (first use in this
>>> function) ~SRS/test/results.c: In function 'gsl_test_abs':
>>> ~SRS/test/results.c:225: error: 'va_list' undeclared (first use in this
>>> function)
>>> ~SRS/test/results.c:225: error: expected ';' before 'ap'
>>> ~SRS/test/results.c:230: error: 'ap' undeclared (first use in this
>>> function) ~SRS/test/results.c: In function 'gsl_test_factor':
>>> ~SRS/test/results.c:302: error: 'va_list' undeclared (first use in this
>>> function)
>>> ~SRS/test/results.c:302: error: expected ';' before 'ap'
>>> ~SRS/test/results.c:307: error: 'ap' undeclared (first use in this
>>> function) ~SRS/test/results.c: In function 'gsl_test_int':
>>> ~SRS/test/results.c:357: error: 'va_list' undeclared (first use in this
>>> function)
>>> ~SRS/test/results.c:357: error: expected ';' before 'ap'
>>> ~SRS/test/results.c:362: error: 'ap' undeclared (first use in this
>>> function) ~SRS/test/results.c: In function 'gsl_test_str':
>>> ~SRS/test/results.c:401: error: 'va_list' undeclared (first use in this
>>> function)
>>> ~SRS/test/results.c:401: error: expected ';' before 'ap'
>>> ~SRS/test/results.c:406: error: 'ap' undeclared (first use in this
>>> function) make[2]: *** [Lib/CMakeFiles/gsl.dir/__/test/results.c.o]
>>> Error 1 make[2]: Leaving directory `/home/TESTS/BUILDgsl'
>>> make[1]: *** [Lib/CMakeFiles/gsl.dir/all] Error 2
>>> make[1]: Leaving directory `/home/TESTS/BUILDgsl'
>>> make: *** [all] Error 2
>>>
>>>
>>>
>>> suggestions welcome
>>>
>>> sincerely
>>> luxInteg
>>>        
>> The comp misses the declaration of the type "va_list". if those errors
>> are the first ones, then this type is simply never declared. If it works
>> with the static library, you should have look which preprocessor flags
>> are used for the static libraries and compare them with the shared ones.
>>
>>      
> The  preprocessor flag appears to be -M.  When this is sumstituted  a 'patched
> version of results.c does indeed compile and the build progresses to  ~70%
> where   th results.c is again compiled  with a load of other files  into a
> large library and there   are no obvius ways   to isolate its  compilation to
> add the -M definition.  I tried set_source_file_properties(PROPERTIES compile
> definitions "-M")  but this adds a -D-M  which does not seem to be the same -
> M.
>
> Anyway the problem seems to be a troublesome test/results.c file.
> (It is attached for your info )
>    the unpatched version gives this response at the start of the build :-
>
> #----------------
> In file included from ~/TESTS/gsl-1.15/test/results.c:32:
> /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/include/varargs.h:4:2: error:
> #error "GCC no longer implements<varargs.h>."
> /usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/include/varargs.h:5:2: error:
> #error "Revise your code to use<stdarg.h>."
> make[2]: *** [test/CMakeFiles/gsltest-static.dir/results.c.o] Error 1
> #------------
>
> the file seems to need  updating   (extensively patched ) for newer compilers
> so any suggestiions  you have  will be gratefully received.
>
>
> sincerely
> luxInteg
>    
I think it is a bad idea to rely on the -M flag, because cmake tries to 
figure out the dependencies..

You could start with defining STDC_HEADERS, or let cmake look for the 
needed headers and set the flag appropriatly.

I start to send the conversation to the list again. Possibly some others 
had similiar trouble when switching from the autotools suite to cmake.

Andreas


More information about the CMake mailing list