Closed hyOzd closed 10 years ago
Wait, I know what is the problem. The problem is not the HAVE_CXX_COMPLEX_POLAR_COMPLEX failed, but the line above.
-- Checking whether system has ANSI C header files
-- ANSI C header files - not found
I think you didn't install build-essential package or someting (maybe google "linux mint c header" will help you). Sorry I didn't use Ubuntu/Mint for a long time. You have to install the C headers to build program.
I was able to build qucs-core successfully with automake. So this is not a missing dependency on my system. It's probably something missing/incompatible in cmake files.
I think the problem is the first line:
CMake Error at CMakeLists.txt:45 (cmake_policy):
Policy "CMP0048" is not known to this version of CMake.
The policy is only supported in CMake version 3 or above
You were right.
Replacing cmake_policy(SET CMP0048 OLD)
with:
IF(POLICY CMP0048)
CMAKE_POLICY(SET CMP0048 OLD)
ENDIF(POLICY CMP0048)
solved it.
But now I'm running into this strange problem. When I run make
I get this linker error:
Linking CXX shared library libqucs.so
/usr/bin/ld: math/CMakeFiles/coreMath.dir/precision.c.o: relocation R_X86_64_PC32 against symbol `nr_inf' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [src/libqucs.so] Error 1
make[1]: *** [src/CMakeFiles/libqucs.dir/all] Error 2
make: *** [all] Error 2
But if I run cmake twice before running make, it builds successfully. I do this exactly:
mkdir build && cd build
cmake .. -DADMSXML=../../../ADMS/build/admsXml/admsXml
cmake .. -DADMSXML=../../../ADMS/build/admsXml/admsXml
make
Output from 1st cmake run:
-- The CXX compiler identification is GNU 4.8.2
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring qucs-core: VERSION 0.0.19
-- Found Git: /usr/bin/git (found version "1.8.5.1")
-- Found Git repository, last commit hash: 6d8a7a9
-- Found FLEX: /usr/bin/flex (found version "2.5.35")
-- Found flex: /usr/bin/flex / Version: 2.5.35
-- Found BISON: /usr/bin/bison (found version "2.7.12-4996")
-- Found bison: /usr/bin/bison / Version: 2.7.12-4996
-- Found sed: /bin/sed
-- Found gperf: /usr/bin/gperf
-- Found admsXml: /home/heyyo/Working/ADMS/build/admsXml/admsXml
-- The C compiler identification is GNU 4.8.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Math lib found at: /usr/lib/x86_64-linux-gnu/libm.so
-- Checking whether system has ANSI C header files
-- Looking for 8 include files dlfcn.h, ..., float.h
-- Looking for 8 include files dlfcn.h, ..., float.h - found
-- Performing Test memchrExists
-- Performing Test memchrExists - Failed
-- ANSI C header files - not found
-- Looking for include file unistd.h
-- Looking for include file unistd.h - found
-- Looking for DIR in sys/stat.h;sys/types.h;dirent.h
-- Looking for DIR in sys/stat.h;sys/types.h;dirent.h - found
-- Looking for ieeefp.h
-- Looking for ieeefp.h - not found
-- Looking for memory.h
-- Looking for memory.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Check size of short
-- Check size of short - done
-- Check size of int
-- Check size of int - done
-- Check size of long
-- Check size of long - done
-- Check size of double
-- Check size of double - done
-- Check size of long double
-- Check size of long double - done
-- Check size of double
-- Check size of double - done
-- using double type: double; size: 8
-- Looking for floor
-- Looking for floor - not found
-- Looking for pow
-- Looking for pow - not found
-- Looking for exp
-- Looking for exp - not found
-- Looking for sqrt
-- Looking for sqrt - not found
-- Looking for log10
-- Looking for log10 - not found
-- Looking for log
-- Looking for log - not found
-- Looking for cos
-- Looking for cos - not found
-- Looking for sin
-- Looking for sin - not found
-- Looking for acos
-- Looking for acos - not found
-- Looking for asin
-- Looking for asin - not found
-- Looking for tan
-- Looking for tan - not found
-- Looking for atan
-- Looking for atan - not found
-- Looking for sinh
-- Looking for sinh - not found
-- Looking for cosh
-- Looking for cosh - not found
-- Looking for tanh
-- Looking for tanh - not found
-- Looking for fabs
-- Looking for fabs - not found
-- Looking for modf
-- Looking for modf - found
-- Looking for atan2
-- Looking for atan2 - not found
-- Looking for jn
-- Looking for jn - not found
-- Looking for yn
-- Looking for yn - not found
-- Looking for erf
-- Looking for erf - not found
-- Looking for erfc
-- Looking for erfc - not found
-- Looking for round
-- Looking for round - not found
-- Looking for trunc
-- Looking for trunc - not found
-- Looking for acosh
-- Looking for acosh - not found
-- Looking for asinh
-- Looking for asinh - not found
-- Looking for strdup
-- Looking for strdup - found
-- Looking for strerror
-- Looking for strerror - found
-- Looking for strchr
-- Looking for strchr - found
-- Checking HAVE_CXX_COMPLEX_ACOS
-- Checking HAVE_CXX_COMPLEX_ACOSH
-- Checking HAVE_CXX_COMPLEX_ASIN
-- Checking HAVE_CXX_COMPLEX_ASINH
-- Checking HAVE_CXX_COMPLEX_ATAN
-- Checking HAVE_CXX_COMPLEX_ATANH
-- Checking HAVE_CXX_COMPLEX_COS
-- Checking HAVE_CXX_COMPLEX_COSH
-- Checking HAVE_CXX_COMPLEX_EXP
-- Checking HAVE_CXX_COMPLEX_LOG
-- Checking HAVE_CXX_COMPLEX_LOG10
-- Checking HAVE_CXX_COMPLEX_SIN
-- Checking HAVE_CXX_COMPLEX_SINH
-- Checking HAVE_CXX_COMPLEX_SQRT
-- Checking HAVE_CXX_COMPLEX_TAN
-- Checking HAVE_CXX_COMPLEX_TANH
-- Checking HAVE_CXX_COMPLEX_LOG2
-- HAVE_CXX_COMPLEX_LOG2 failed
-- Checking HAVE_CXX_COMPLEX_NORM
-- HAVE_CXX_COMPLEX_ATAN2 failed
-- HAVE_CXX_COMPLEX_FMOD failed
-- HAVE_CXX_COMPLEX_POLAR_COMPLEX failed
-- Configuring done
-- Generating done
-- Build files have been written to: /home/heyyo/Working/qucs/qucs-core/build4
Output from 2nd cmake run:
-- Configuring qucs-core: VERSION 0.0.19
-- Found Git repository, last commit hash: 6d8a7a9
-- Found flex: /usr/bin/flex / Version: 2.5.35
-- Found bison: /usr/bin/bison / Version: 2.7.12-4996
-- Found sed: /bin/sed
-- Found gperf: /usr/bin/gperf
-- Found admsXml: /home/heyyo/Working/ADMS/build/admsXml/admsXml
-- Math lib found at: /usr/lib/x86_64-linux-gnu/libm.so
-- Checking whether system has ANSI C header files
-- ANSI C header files - not found
-- using double type: double; size: 8
-- Checking HAVE_CXX_COMPLEX_ACOS
-- Checking HAVE_CXX_COMPLEX_ACOSH
-- Checking HAVE_CXX_COMPLEX_ASIN
-- Checking HAVE_CXX_COMPLEX_ASINH
-- Checking HAVE_CXX_COMPLEX_ATAN
-- Checking HAVE_CXX_COMPLEX_ATANH
-- Checking HAVE_CXX_COMPLEX_COS
-- Checking HAVE_CXX_COMPLEX_COSH
-- Checking HAVE_CXX_COMPLEX_EXP
-- Checking HAVE_CXX_COMPLEX_LOG
-- Checking HAVE_CXX_COMPLEX_LOG10
-- Checking HAVE_CXX_COMPLEX_SIN
-- Checking HAVE_CXX_COMPLEX_SINH
-- Checking HAVE_CXX_COMPLEX_SQRT
-- Checking HAVE_CXX_COMPLEX_TAN
-- Checking HAVE_CXX_COMPLEX_TANH
-- Checking HAVE_CXX_COMPLEX_LOG2
-- HAVE_CXX_COMPLEX_LOG2 failed
-- Checking HAVE_CXX_COMPLEX_NORM
-- HAVE_CXX_COMPLEX_ATAN2 failed
-- HAVE_CXX_COMPLEX_FMOD failed
-- HAVE_CXX_COMPLEX_POLAR_COMPLEX failed
-- Configuring done
-- Generating done
-- Build files have been written to: /home/heyyo/Working/qucs/qucs-core/build4
Maybe this should be another issue?
It looks like libqucs.so
and its objects are missing the -fPIC
flag.
Try with make VERBOSE=1
to see what is the commands used to compile precision.c
and the link step on libqucs.so
.
Build command of precision.c
for failed run:
[ 2%] Building C object src/math/CMakeFiles/coreMath.dir/precision.c.o
cd /home/heyyo/Working/qucs/qucs-core/build5/src/math && /usr/bin/cc -DDEBUG -DHAVE_CONFIG_H -I/home/heyyo/Working/qucs/qucs-core -I/home/heyyo/Working/qucs/qucs-core/src/math -I/home/heyyo/Working/qucs/qucs-core/src -I/home/heyyo/Working/qucs/qucs-core/src/components -I/home/heyyo/Working/qucs/qucs-core/src/interface -o CMakeFiles/coreMath.dir/precision.c.o -c /home/heyyo/Working/qucs/qucs-core/src/math/precision.c
Build command for successful run:
[ 73%] Building C object src/math/CMakeFiles/coreMath.dir/precision.c.o
cd /home/heyyo/Working/qucs/qucs-core/build5/src/math && /usr/bin/cc -DDEBUG -DHAVE_CONFIG_H -fPIC -I/home/heyyo/Working/qucs/qucs-core -I/home/heyyo/Working/qucs/qucs-core/src/math -I/home/heyyo/Working/qucs/qucs-core/src -I/home/heyyo/Working/qucs/qucs-core/src/components -I/home/heyyo/Working/qucs/qucs-core/src/interface -o CMakeFiles/coreMath.dir/precision.c.o -c /home/heyyo/Working/qucs/qucs-core/src/math/precision.c
Only difference between these lines is -fPIC
flag.
I don't get why it works on the second run.
Can you please try to replace these 2 lines: https://github.com/Qucs/qucs/blob/master/qucs-core/CMakeLists.txt#L286-L287
by:
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
That worked!
I'm trying to build qucs from git sources with cmake. But it fails when running cmake for qucs-core. Here is my log:
My system is Linux Mint Debian. gcc version: gcc (Debian 4.8.2-1) 4.8.2 cmake version: 2.8.12.1
I have been following instructions from this page, except that I have downloaded the sources from this repository. By the way, I have been able to build GUI.