How does ginac compile in windows -- how does one use PKG-config in msys?

Source: Internet
Author: User
Tags gmp

 

To useGinacThe Win32 version provided by the official website is very old. ginac version 1.4.4, CLN version 1.2.2, and GMP version 4.2.4 are now available in ginac 1.5.7, CLN 1.3.1, and gmp5.0.1.

 

You have to download TDM/mingw, install msys, and specify the mingw path (that is, Mount ).

 

Then download the latest GMP, 5.0.1, and compile and install it:

./Configure -- prefix =/ginac -- enable-cxx -- disable-static -- enable-shared

Make

Make install

 

 

Because ginac installation depends on CLN, and its configure does not have the with-CLN option, PKG-config is required for automatic identification, while CLN also supports PKG-config, therefore, we should install PKG-config before CLN installation steps.

 

However, PKG-config compilation in msys is not easy. I am eager to directly use the binary version compiled by others. The official website does not provide the binary version,

So I searched the internet and found the compiled windows binary version on the gnome website.

Http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.23-3_win32.zip

 

Uncompress to msys's 1.0directory, that is equivalent to put pkg-config.exe in the msys/bin directory, run found that there is still a lack of libglib-2.0-0.dll files, huh, I often encounter this, previously installed GTK +, as shown in the following example, search someone else has compiled the libglib-2.0-0.dll file, coincidentally, someone on csdn also encountered the same problem, however, I use the version is not the same as the blogger:

Http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.24/glib_2.24.1-1_win32.zip

Extract, directly extract the libglib-2.0-0.dll file, put it in the/bin directory of msys

Run the command pkg-config.exe -- help to check whether the command is correct ~~, Then set pkg_config_path so that PKG-config can find the PC file. According to the software installation location, the PC file of the software I installed should be in/ginac/lib/pkgconfig. Therefore, open the/etc/profile file in msys and add the command at the end.

Export pkg_config_path =/mingw/lib/pkgconfig:/ginac/lib/pkgconfig

Export Path =/ginac/bin: $ path

 

Note: The/ginac/bin directory contains the DLL files of GMP and CLN, which can be added to the path to save copying to the msys system/bin directory.

 

 

Next, you can safely compile CLN, download cln1.3.1, and compile:

./Configure -- prefix =/ginac -- With-GMP =/ginac -- disable-static -- enable-shared

Make

Make install

 

 

 

Next, my ultimate goal is to compile ginac, which has been waiting for a long time,

 

 

./Configure -- prefix =/ginac -- disable-static -- enable-shared

Make

Make install

 

 

Check how many software can be identified by PKG-config:

$ Pkg-config.exe -- list-all
Ginac-C ++ library for symbolic calculations
GSL-GNU Scientific Library
CLN-class library for numbers
SDL-Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low
Level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.

 

OK, normal !!!

 

Below is the most thrilling thing. Compilation example:

 

Clntest. cpp:

# Include <iostream> <br/> # include <CLN/CLN. h> <br/> using namespace STD; <br/> using namespace CLN; <br/> int main (INT argc, char * argv []) {</P> <p> cl_f E = "0.27182818284590452353602874713526624977572470942596e + 000040"; <br/> cout <"E =" <e <Endl; <br/> cout <"e ^ 2 =" <E * E <Endl; <br/> return 0; <br/>}< br/>

 

Gsltest. C:

 

 

 

# Include <stdio. h> <br/> # include <GSL/gsl_math.h> <br/> # include <GSL/gsl_sf_bessel.h> <br/> # include <GSL/gsl_poly.h> <br/> int main (void) {<br/> double X = 5, roots [3]; gsl_complex Z [3]; <br/> printf ("%. 16f/T %. 16f/NIS 8 an odd number? % D/N ", m_pi, m_euler, gsl_is_odd (8); <br/> printf (" J0 (% G) = %. 16f/N ", X, gsl_sf_bessel_j0 (x); </P> <p> gsl_poly_solve_cubic (-5, 7,-2, roots, roots + 1, roots + 2 ); <br/> printf ("/NX ^ 3-5x ^ 2 + 7x-2 = 0 has roots:/N"); <br/> printf ("%. 16f/T %. 16f/T %. 16f/N ", room [0], room [1], room [2]); <br/> gsl_poly_complex_solve_cubic (0, 1,-2, Z, Z + 1, Z + 2); <br/> printf ("/NX ^ 3 + X-2 = 0 has roots:/N"); <br/> printf ("% +. 16f % +. 16f I/n % +. 16f % +. 16f I/n % +. 16f % +. 16f I/N ", gsl_real (Z [0]), gsl_imag (Z [0]), gsl_real (Z [1]), gsl_imag (Z [1]), gsl_real (Z [2]), gsl_imag (Z [2]); <br/> // getch (); <br/> return 0; <br/>}

 

 

Example of ginac:

 

 

# Include <iostream> <br/> # include <ginac/ginac. h> </P> <p> using namespace STD; <br/> using namespace ginac; </P> <p> int main (INT argc, char ** argv) <br/>{< br/> symbol A ("A"), B ("B"), C ("C "); <br/> symbol X ("X"), y ("Y"); </P> <p> ex F = x * sin (3 * a * X) -exp (-B * Y) + C * Tanh (C * x * y * Y); </P> <p> ex DFX = f. diff (x); <br/> ex dfy = f. diff (y); </P> <p> cout <"F =" <F <Endl; <br/> cout <"DF/dx =" <DFX <Endl; <br/> cout <"DF/dy =" <dfy <Endl; <br/>}

 

To compile the CLN example, you only need:

G ++ clntest. cpp 'pkg-config.exe -- Libs -- cflags cln'-O clntest

 

 

 

Paste a picture to commemorate it:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.