简体   繁体   中英

How to check the version of GMP, MPFR and CamlIDL?

My question is simple... How could I check the version of GMP installed on my machine? What about MPFR? And What about CamlIDL?

Thank you very much

To check for GMP(MPIR) version, access string __gmp_version(__mpir_version) in dynamic library called libgmp.so.XYZ(libmpir.so.XYZ). Your standard library directory might contain more than one such file (this happens if you install newer version of GMP or MPIR but your package manager chooses to keep old version because it is still needed).

Cutting off a small Python code fragment from benchmark_det_Dixon.py :

import ctypes
so_name='/usr/lib/libgmp.so'
var_name='__gmp_version'
L=ctypes.cdll.LoadLibrary(so_name)
v=ctypes.c_char_p.in_dll(L,var_name)
print v.value

The code above only works under Linux/Unix; it should be possible to port it to other OS supported by ctypes Python package.

To get MPFR version, call mpfr_get_version():

M=ctypes.cdll.LoadLibrary('/usr/lib/libmpfr.so')
M.mpfr_get_version.restype=ctypes.c_char_p
print M.mpfr_get_version()

The standard Autoconf way to do this is to pick some library function that's in required minimum version X and not in version X-1, then see if you can successfully compile a tiny program that calls that function. It's not as elegant as querying some oracle for a version string, but it has the advantage of demonstrating that the build environment is actually correct.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM