Qalculate / libqalculate

Qalculate! library and CLI
https://qalculate.github.io/
GNU General Public License v2.0
1.79k stars 144 forks source link

fatal error: 'gmp.h' file not found #569

Open ManuelSchneid3r opened 1 year ago

ManuelSchneid3r commented 1 year ago

Importing like this in cmake

find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBQALCULATE REQUIRED libqalculate)
target_include_directories(${PROJECT_NAME} PRIVATE ${LIBQALCULATE_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBQALCULATE_LIBRARIES})

i get an error while compiling

/usr/bin/clang++ -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_GUI_LIB -DQT_WIDGETS_LIB -Dcalculator_qalculate_EXPORTS -I/Users/manuel/Documents/projects/build-albert-Debug/plugins/calculator_qalculate -I/Users/manuel/Documents/projects/albert/plugins/calculator_qalculate -I/Users/manuel/Documents/projects/build-albert-Debug/plugins/calculator_qalculate/calculator_qalculate_autogen/include -I/Users/manuel/Documents/projects/albert/plugins/calculator_qalculate/src -I/opt/homebrew/Cellar/libqalculate/4.7.0/include -I/Users/manuel/Documents/projects/build-albert-Debug/include -I/Users/manuel/Documents/projects/albert/include -iframework /Users/manuel/Qt/6.2.4/macos/lib -isystem /Users/manuel/Qt/6.2.4/macos/lib/QtCore.framework/Headers -isystem /Users/manuel/Qt/6.2.4/macos/mkspecs/macx-clang -isystem /Users/manuel/Qt/6.2.4/macos/include -isystem /Users/manuel/Qt/6.2.4/macos/lib/QtWidgets.framework/Headers -isystem /Users/manuel/Qt/6.2.4/macos/lib/QtGui.framework/Headers -isystem /Users/manuel/Qt/6.2.4/macos/lib/QtConcurrent.framework/Headers -DQT_QML_DEBUG     -Winline     -Wextra     -Wshadow     -Wstrict-aliasing     -pedantic     -Wall     -Wno-inline     -Werror=return-type  -g -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -std=c++20 -MD -MT plugins/calculator_qalculate/CMakeFiles/calculator_qalculate.dir/src/plugin.cpp.o -MF plugins/calculator_qalculate/CMakeFiles/calculator_qalculate.dir/src/plugin.cpp.o.d -o plugins/calculator_qalculate/CMakeFiles/calculator_qalculate.dir/src/plugin.cpp.o -c /Users/manuel/Documents/projects/albert/plugins/calculator_qalculate/src/plugin.cpp
In file included from /Users/manuel/Documents/projects/albert/plugins/calculator_qalculate/src/plugin.cpp:6:
In file included from /Users/manuel/Documents/projects/albert/plugins/calculator_qalculate/src/plugin.h:7:
In file included from /opt/homebrew/Cellar/libqalculate/4.7.0/include/libqalculate/Calculator.h:192:
In file included from /opt/homebrew/Cellar/libqalculate/4.7.0/include/libqalculate/MathStructure.h:16:
/opt/homebrew/Cellar/libqalculate/4.7.0/include/libqalculate/Number.h:17:10: fatal error: 'gmp.h' file not found
#include <gmp.h>
         ^~~~~~~
1 error generated.

I am not familiar with packageConfig but shouldnt the gmp include directories propagate since the gmp headers are used in the public headers of libqalculate?

i saw this

cat /opt/homebrew/Cellar/libqalculate/4.7.0/lib/pkgconfig/libqalculate.pc
prefix=/opt/homebrew/Cellar/libqalculate/4.7.0
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: libqalculate
Description: libqalculate
Version: 4.7.0
Libs.private: -lcurl  -lintl -Wl,-framework -Wl,CoreFoundation -liconv -lgmp -lmpfr -lpthread      <<<<<< really private?
Requires.private: libxml-2.0 >= 2.3.8
Libs: -L${libdir} -lqalculate
Cflags:   -I${includedir}

maybe thats a starting point

idamir commented 11 months ago

libqalculate.pc is generated file from a template and is not used during libqalculate compilation. It should not include any info about libgmp-dev.

The ./configure script is used for build deps collection: these strings in configure.ac AC_CHECK_HEADER(gmp.h, [], [AC_MSG_ERROR([gmp.h can't be found, or is unusable.])]) AC_CHECK_LIB(gmp, __gmpz_init, [LIBS="-lgmp $LIBS"], [AC_MSG_ERROR([libgmp not found or uses a different ABI.])]) give output like checking for gmp.h... yes checking for __gmpz_init in -lgmp... yes

Check your config logs.

ManuelSchneid3r commented 11 months ago

gmp is in the public headers: https://github.com/Qalculate/libqalculate/blob/master/libqalculate/Number.h#L17