krakenrf / gr-krakensdr

GNU General Public License v3.0
55 stars 15 forks source link

Difficulties building gr-krakensdr "Could NOT find MPIR (missing: MPIRXX_LIB..." #1

Closed dennishiding closed 1 year ago

dennishiding commented 1 year ago

Although this is in context of fc36 and gr-krackensdr, the various things I found along the way suggest it is common issue with building an SDR data block to install to gnu-radio.

The symptom:

(kraken) [dennis@fedora gr-krakensdr]$ mkdir build
(kraken) [dennis@fedora gr-krakensdr]$ cd build
(kraken) [dennis@fedora build]$ cmake ..
...
-- Could NOT find GMP (missing: GMPXX_LIBRARY GMP_LIBRARY GMP_INCLUDE_DIR) 
-- GMP not found; this is not a problem if MPIR can be found.
-- Checking for module 'mpir >= 3.0'
--   Found mpir , version 3.0.0-23
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find MPIR (missing: MPIRXX_LIBRARY MPIR_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /usr/lib64/cmake/gnuradio/FindMPIR.cmake:45 (find_package_handle_standard_args)
  /usr/lib64/cmake/gnuradio/FindMPLIB.cmake:14 (find_package)
  /usr/share/cmake/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /usr/lib64/cmake/gnuradio/GnuradioConfig.cmake:14 (find_dependency)
  CMakeLists.txt:30 (find_package)

The real problem is that sudo dnf install gnuradio-devel does not install gmp nor mpir. It does install /usr/lib64/cmake/gnuradio/FindMPIR.cmake which fails to find the library.

It is possible that dnf install gmp-devel might have allowed the build to complete. The initial reading of the messages I missed that gmp was an alternative, and by the time I recognized it I had already read enough that suggested mpir was newer and better answer.

The following steps seemed to get mpir installed (and I didn't find in one place elsewhere.)

sudo dnf install autoconf automake libtool yasm
git clone https://github.com/wbhart/mpir
cd mpir
./autogen.sh
./configure --prefix=/usr  --libdir=/usr/lib64 --enable-cxx
make
make check
sudo make install
sudo ldconfig

Since mpir does not install a pkg-config .pc file, the install needs to be moved from default of /usr/local to /usr in order for FindMPLIB.cmake to find it. I also tried hacking a custom mpir.pc file but backed out of that approach.

The complaint about missing: MPIRXX_LIBRARY is related to needed the c++ version of the library that is not built by default. The --enable-cxx resolves this issue.

After completing these steps, I was able to return to the steps in the README.md

mkdir build
cd build
cmake ..
make
sudo make install

and compile completed successfully.

krakenrf commented 1 year ago

Sorry can you clarify what is fc36? You're getting some odd errors that don't seem common, can we have a little more information about your computing device setup and OS?

dennishiding commented 1 year ago

Sorry can you clarify what is fc36? You're getting some odd errors that don't seem common, can we have a little more information about your computing device setup and OS?

[dennis@fedora heimdall_daq_fw]$ uname -a
Linux fedora 5.19.15-201.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Oct 13 18:58:38 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

[dennis@fedora 221226krakenrf]$ cat /proc/cpuinfo |grep -e "^model name" -e "^processor" 
processor   : 0
model name  : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
processor   : 1
model name  : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
processor   : 2
model name  : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
processor   : 3
model name  : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
processor   : 4
model name  : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
processor   : 5
model name  : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
processor   : 6
model name  : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
processor   : 7
model name  : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz

[dennis@fedora 221226krakenrf]$ cat /proc/cpuinfo |grep -m 1 -e "^flags"
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust sgx bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities

This particular error about MPIRXX library doesn't seem completely uncommon as I found evidence of others encountering it with other gnuradio sdr integrations. For example this gnuradio issue where the admins there decided it was better to hide the solution in a private forum.

Though the instructions from README.md in this repo indicate to install gnuradio-dev, gnuradio-dev installs files that require either GMP or MPIR, depite those packages not being tagged as dependencies of gnuradio-dev. This appears not to be unique to my fc36 system's packages, as my googling found ubuntu users experiencing the same issue.

No this doesn't seem like a krakensdr problem as much as a gnuradio-dev packaging problem. But some documentation changes might be able to work around it.