View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008758CMakeCMakepublic2009-03-18 10:192016-06-10 14:30
ReporterDenis Scherbakov 
Assigned ToBill Hoffman 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product VersionCMake-2-6 
Target VersionFixed in Version 
Summary0008758: CheckSymbolExists does not find a symbol although it exists
DescriptionThere is a symbol (#define) in math.h called fpclassify(x) which returns type of a floating point variable. CheckSymbolExists does not find it.

INCLUDE(CheckSymbolExists)
CHECK_SYMBOL_EXISTS(fpclassify math.h HAVE_FPCLASSIFY)

Below is a code which compiles

/* */
#include <math.h>

void cmakeRequireSymbol(int dummy,...){(void)dummy;}
int main()
{
#ifndef fpclassify
// cmakeRequireSymbol(0,&fpclassify);
#endif

#ifndef fpclassify
  fpclassify_function_does_not_exist();
#else
  puts("Exists.");
#endif

  return 0;
}
Additional InformationCMake 2.6.3
Gentoo Linux
Linux Kernel 2.6.28.x
TagsNo tags attached.
Attached Filestxt file icon CMakeLists.txt [^] (330 bytes) 2009-03-18 10:19 [Show Content]
? file icon math.h [^] (15,728 bytes) 2009-03-23 05:10

 Relationships

  Notes
(0015722)
Denis Scherbakov (reporter)
2009-03-18 10:47

Here is unmodified code from /usr/share/cmake/Modules/CheckSymbolExists.cmake which CMake saves as a "CheckSymbolExists.c" file and tries to compile.

/* */
#include <math.h>

void cmakeRequireSymbol(int dummy,...){(void)dummy;}
int main()
{
#ifndef fpclassify
  cmakeRequireSymbol(0,&fpclassify);
#endif
  return 0;
}
(0015723)
Denis Scherbakov (reporter)
2009-03-18 10:55

Originally I found the error on GCC 4.1, but 3.3 and 4.3 also fail.

Quick fix: everywhere in CheckSymbolExists.cmake replace CheckSymbolExists.c with CheckSymbolExists.cpp. I don't know what is the difference, GCC manual says that C and CPP are both preprocessed, but this fix worked for me.

Denis
(0015753)
Bill Hoffman (manager)
2009-03-22 22:04

.c is a C program and .cpp is a c++ program. So, I am guessing the symbol is not available in C?
(0015756)
Denis Scherbakov (reporter)
2009-03-23 05:11

I uploaded math.h from my linux box, where I see this problem.So far I understand it there is no dependency on C++ anywhere in this file except in one structure.
(0016195)
Denis Scherbakov (reporter)
2009-04-27 13:02

I also wanted to note that some symbols are defined in C, but not defined in C++. On HP-UX on IA64 I've seen:

#if defined(_PA_RISC) || !defined(__cplusplus)
#define fpclassify(x) _FPCLASSIFY(x)
#endif

So it is reasonable to add additional parameter to CHECK_SYMBOL_EXISTS, which defines a language to use (C or C++).
(0019280)
Mateusz Loskot (reporter)
2010-01-22 18:48

Recently, I started thread on the list directly related to this issue:

[CMake] Checking function or symbol in namespace

http://www.cmake.org/pipermail/cmake/2010-January/034718.html [^]

Responses are very informative. Hopefully it will clarify the problem a bit.
(0041517)
Kitware Robot (administrator)
2016-06-10 14:27

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2009-03-18 10:19 Denis Scherbakov New Issue
2009-03-18 10:19 Denis Scherbakov File Added: CMakeLists.txt
2009-03-18 10:47 Denis Scherbakov Note Added: 0015722
2009-03-18 10:55 Denis Scherbakov Note Added: 0015723
2009-03-22 22:04 Bill Hoffman Note Added: 0015753
2009-03-22 22:04 Bill Hoffman Status new => assigned
2009-03-22 22:04 Bill Hoffman Assigned To => Bill Hoffman
2009-03-23 05:10 Denis Scherbakov File Added: math.h
2009-03-23 05:11 Denis Scherbakov Note Added: 0015756
2009-04-27 13:02 Denis Scherbakov Note Added: 0016195
2010-01-22 18:48 Mateusz Loskot Note Added: 0019280
2016-06-10 14:27 Kitware Robot Note Added: 0041517
2016-06-10 14:27 Kitware Robot Status assigned => resolved
2016-06-10 14:27 Kitware Robot Resolution open => moved
2016-06-10 14:30 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team