On 2021-10-26 "T. Modes" <thomas.mo...@gmx.de> wrote:
> Andreas Metzler schrieb am Dienstag, 26. Oktober 2021 um 08:21:25 UTC+2:

[...]
> > This check succeeds with gcc because of the gcc-builtin 
> > https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html 
> > https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#index-fno-builtin 
> > is used but fails later in the real build where the gcc-builtin is not 
> > used. (ansi or or std options set there.) 

> Sorry, but I don't understand. 
> According the the doc of CheckCSourceCompiles, it should take all flags 
> into consideration:

> CMAKE_REQUIRED_FLAGS

> Additional flags to pass to the compiler. Note that the contents of 
> CMAKE_C_FLAGS and its associated configuration-specific variable are 
> automatically added to the compiler command before the contents of 
> CMAKE_REQUIRED_FLAGS.

> So where do you add -fno-builtin?

Hello,

I do not add a -fno-builtin - it is something else like -ansi or a -std
setting.

Throwing in --trace-expand it looks like LDFLAGS are not passed
on, they differ between test and actual build.
==========================================
cd obj-x86_64-linux-gnu && cmake -DCMAKE_INSTALL_PREFIX=/usr 
-DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_SYSCONFDIR=/etc 
-DCMAKE_INSTALL_LOCALSTATEDIR=/var -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON 
-DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF 
-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON -DCMAKE_INSTALL_RUNSTATEDIR=/run 
-DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON "-GUnix Makefiles" 
-DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_LIBDIR=lib/x86_64-linux-gnu 
-DSUPPORT_JAVA_PROGRAMS=OFF --trace-expand ..
[...]
/dev/shm/PANO/libpano13-2.9.21/CMakeLists.txt(115):  set(LIBM_TEST_SRC #include 
<math.h>
int main() { float f=exp(2.0); } )
/dev/shm/PANO/libpano13-2.9.21/CMakeLists.txt(116):  
check_c_source_compiles(#include <math.h>
int main() { float f=exp(2.0); } HAVE_EXP )
/usr/share/cmake-3.21/Modules/CheckCSourceCompiles.cmake(76):  
cmake_check_source_compiles(C #include <math.h>
int main() { float f=exp(2.0); } HAVE_EXP  )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(11):  if(NOT 
DEFINED HAVE_EXP )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(13):  if(_lang 
STREQUAL C )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(14):  
set(_lang_textual C )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(15):  
set(_lang_ext c )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(42):  
get_property(_supported_languages GLOBAL PROPERTY ENABLED_LANGUAGES )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(43):  if(NOT 
_lang IN_LIST _supported_languages )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(48):  
set(_FAIL_REGEX )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(49):  
set(_SRC_EXT )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(50):  set(_key 
)
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(51):  
foreach(arg  )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(64):  if(NOT 
_SRC_EXT )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(65):  
set(_SRC_EXT c )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(68):  
if(CMAKE_REQUIRED_LINK_OPTIONS )
/usr/share/cmake-3.21/Modules/CheckCSourceCompiles.cmake(71):  else()
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(72):  
set(CHECK__SOURCE_COMPILES_ADD_LINK_OPTIONS )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(74):  
if(CMAKE_REQUIRED_LIBRARIES )
/usr/share/cmake-3.21/Modules/CheckCSourceCompiles.cmake(77):  else()
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(78):  
set(CHECK__SOURCE_COMPILES_ADD_LIBRARIES )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(80):  
if(CMAKE_REQUIRED_INCLUDES )
/usr/share/cmake-3.21/Modules/CheckCSourceCompiles.cmake(83):  else()
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(84):  
set(CHECK__SOURCE_COMPILES_ADD_INCLUDES )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(86):  
file(WRITE 
/dev/shm/PANO/libpano13-2.9.21/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp/src.c 
#include <math.h>
int main() { float f=exp(2.0); }
 )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(89):  if(NOT 
CMAKE_REQUIRED_QUIET )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(90):  
message(CHECK_START Performing Test HAVE_EXP )
-- Performing Test HAVE_EXP
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(92):  
try_compile(HAVE_EXP /dev/shm/PANO/libpano13-2.9.21/obj-x86_64-linux-gnu 
/dev/shm/PANO/libpano13-2.9.21/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp/src.c 
COMPILE_DEFINITIONS -DHAVE_EXP    CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=  
OUTPUT_VARIABLE OUTPUT )
CMake Warning (dev) at 
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake:92 
(try_compile):
  Policy CMP0066 is not set: Honor per-config flags in try_compile()
  source-file signature.  Run "cmake --help-policy CMP0066" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  For compatibility with older versions of CMake, try_compile is not honoring
  caller config-specific compiler flags (e.g.  CMAKE_C_FLAGS_DEBUG) in the
  test project.
Call Stack (most recent call first):
  /usr/share/cmake-3.21/Modules/CheckCSourceCompiles.cmake:76 
(cmake_check_source_compiles)
  CMakeLists.txt:116 (check_c_source_compiles)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at 
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake:92 
(try_compile):
  Policy CMP0056 is not set: Honor link flags in try_compile() source-file
  signature.  Run "cmake --help-policy CMP0056" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  For compatibility with older versions of CMake, try_compile is not honoring
  caller link flags (e.g.  CMAKE_EXE_LINKER_FLAGS) in the test project.
Call Stack (most recent call first):
  /usr/share/cmake-3.21/Modules/CheckCSourceCompiles.cmake:76 
(cmake_check_source_compiles)
  CMakeLists.txt:116 (check_c_source_compiles)
This warning is for project developers.  Use -Wno-dev to suppress it.

/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(102):  
foreach(_regex  )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(108):  
if(HAVE_EXP )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(109):  
set(HAVE_EXP 1 CACHE INTERNAL Test HAVE_EXP )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(110):  if(NOT 
CMAKE_REQUIRED_QUIET )
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(111):  
message(CHECK_PASS Success )
-- Performing Test HAVE_EXP - Success
/usr/share/cmake-3.21/Modules/Internal/CheckSourceCompiles.cmake(113):  
file(APPEND 
/dev/shm/PANO/libpano13-2.9.21/obj-x86_64-linux-gnu/CMakeFiles/CMakeOutput.log 
Performing C SOURCE FILE Test HAVE_EXP succeeded with the following output:
 Change Dir: 
/dev/shm/PANO/libpano13-2.9.21/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_bc036/fast && gmake[2]: 
Entering directory 
'/dev/shm/PANO/libpano13-2.9.21/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp'
/usr/bin/gmake  -f CMakeFiles/cmTC_bc036.dir/build.make 
CMakeFiles/cmTC_bc036.dir/build
gmake[3]: Entering directory 
'/dev/shm/PANO/libpano13-2.9.21/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_bc036.dir/src.c.o
/usr/lib/ccache/cc -DHAVE_EXP  -g -O2 
-ffile-prefix-map=/dev/shm/PANO/libpano13-2.9.21=. -fstack-protector-strong 
-Wformat -Werror=format-security -Wall -Wdate-time -D_FORTIFY_SOURCE=2  -o 
CMakeFiles/cmTC_bc036.dir/src.c.o -c 
/dev/shm/PANO/libpano13-2.9.21/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp/src.c
/dev/shm/PANO/libpano13-2.9.21/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp/src.c: 
In function 'main':
/dev/shm/PANO/libpano13-2.9.21/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp/src.c:2:20:
 warning: unused variable 'f' [-Wunused-variable]
    2 | int main() { float f=exp(2.0); }
      |                    ^
Linking C executable cmTC_bc036
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_bc036.dir/link.txt 
--verbose=1
/usr/lib/ccache/cc -g -O2 -ffile-prefix-map=/dev/shm/PANO/libpano13-2.9.21=. 
-fstack-protector-strong -Wformat -Werror=format-security -Wall -Wdate-time 
-D_FORTIFY_SOURCE=2  -Wl,-z,relro -Wl,-z,now -Wl,-z,defs -Wl,--as-needed  
-rdynamic CMakeFiles/cmTC_bc036.dir/src.c.o -o cmTC_bc036
gmake[3]: Leaving directory 
'/dev/shm/PANO/libpano13-2.9.21/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp'
gmake[2]: Leaving directory 
'/dev/shm/PANO/libpano13-2.9.21/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp'


 Source file was:
#include <math.h>
int main() { float f=exp(2.0); }
 )
/dev/shm/PANO/libpano13-2.9.21/CMakeLists.txt(117):  if(HAVE_EXP )
/dev/shm/PANO/libpano13-2.9.21/CMakeLists.txt(118):  unset(LIBM_LIB )
[...]
[ 55%] Building C object CMakeFiles/pano13.dir/resample.c.o
/usr/lib/ccache/cc -D__Ansi__ -Dpano13_EXPORTS -I/dev/shm/PANO/libpano13-2.9.21 
-g -O2 -ffile-prefix-map=/dev/shm/PANO/libpano13-2.9.21=. 
-fstack-protector-strong -Wformat -Werror=format-security -Wall -Wdate-time 
-D_FORTIFY_SOURCE=2 -fPIC -MD -MT CMakeFiles/pano13.dir/resample.c.o -MF 
CMakeFiles/pano13.dir/resample.c.o.d -o CMakeFiles/pano13.dir/resample.c.o -c 
/dev/shm/PANO/libpano13-2.9.21/resample.c
[...]
[ 62%] Linking C shared library libpano13.so
/usr/bin/cmake -E cmake_link_script CMakeFiles/pano13.dir/link.txt --verbose=1
/usr/lib/ccache/cc -fPIC -g -O2 
-ffile-prefix-map=/dev/shm/PANO/libpano13-2.9.21=. -fstack-protector-strong 
-Wformat -Werror=format-security -Wall -Wdate-time -D_FORTIFY_SOURCE=2 
-Wl,-z,relro -Wl,-z,now -Wl,-z,defs -Wl,--as-needed -shared 
-Wl,-soname,libpano13.so.3 -o libpano13.so.3.0.0 
CMakeFiles/pano13.dir/javastub.c.o CMakeFiles/pano13.dir/adjust.c.o 
CMakeFiles/pano13.dir/bmp.c.o CMakeFiles/pano13.dir/ColourBrightness.c.o 
CMakeFiles/pano13.dir/correct.c.o CMakeFiles/pano13.dir/dump.c.o 
CMakeFiles/pano13.dir/fftn.c.o CMakeFiles/pano13.dir/file.c.o 
CMakeFiles/pano13.dir/filter.c.o CMakeFiles/pano13.dir/fourier.c.o 
CMakeFiles/pano13.dir/hdrfile.c.o CMakeFiles/pano13.dir/jpeg.c.o 
CMakeFiles/pano13.dir/jpegicc.c.o CMakeFiles/pano13.dir/math.c.o 
CMakeFiles/pano13.dir/metadata.c.o CMakeFiles/pano13.dir/morpher.c.o 
CMakeFiles/pano13.dir/multilayer.c.o CMakeFiles/pano13.dir/optimize.c.o 
CMakeFiles/pano13.dir/pan.c.o CMakeFiles/pano13.dir/parser.c.o 
CMakeFiles/pano13.dir/perspect.c.o CMakeFiles/pano13.dir/png.c.o 
CMakeFiles/pano13.dir/ppm.c.o CMakeFiles/pano13.dir/PTcommon.c.o 
CMakeFiles/pano13.dir/PTDialogs.c.o CMakeFiles/pano13.dir/ptfeather.c.o 
CMakeFiles/pano13.dir/ptstitch.c.o CMakeFiles/pano13.dir/queryfeature.c.o 
CMakeFiles/pano13.dir/remap.c.o CMakeFiles/pano13.dir/resample.c.o 
CMakeFiles/pano13.dir/rgbe.c.o CMakeFiles/pano13.dir/seamer.c.o 
CMakeFiles/pano13.dir/sys_ansi.c.o CMakeFiles/pano13.dir/sys_compat_unix.c.o 
CMakeFiles/pano13.dir/sys_common.c.o CMakeFiles/pano13.dir/tiff.c.o 
CMakeFiles/pano13.dir/Triangulate.c.o CMakeFiles/pano13.dir/ZComb.c.o 
CMakeFiles/pano13.dir/PaniniGeneral.c.o CMakeFiles/pano13.dir/lmdif.c.o  -ltiff 
-lz -ljpeg -lpng -lz -ljpeg -lpng 
/usr/bin/ld: CMakeFiles/pano13.dir/resample.c.o: in function `Gaussian_2':
./obj-x86_64-linux-gnu/./resample.c:1772: undefined reference to `exp'
==========================================

Minimal testcase:
(sid)ametzler@argenau:/tmp/PANO/libpano13-2.9.21$ rm -rf build ; mkdir build ; 
cd build ; LDFLAGS='-Wl,-z,defs -Wl,--as-needed' cmake 
-DCMAKE_VERBOSE_MAKEFILE=ON .. && make

cu Andreas

-- 
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
--- 
You received this message because you are subscribed to the Google Groups 
"hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to hugin-ptx+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/hugin-ptx/YXgvH776LlvTNvBc%40argenau.bebt.de.

Reply via email to