1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781
|
Quantum GIS (QGIS)
Building QGIS from source - step by step
------------------------------------------------------------------------
1. Introduction
2. General Build Notes
2.1. An overview of the dependencies required for building
3. Building under windows using msys
3.1. MSYS:
3.2. Qt4.3
3.3. Flex and Bison
3.4. Python stuff: (optional)
3.4.1. Download and install Python - use Windows installer
3.4.2. Download SIP and PyQt4 sources
3.4.3. Compile SIP
3.4.4. Compile PyQt
3.4.5. Final python notes
3.5. Subversion:
3.6. CMake:
3.7. QGIS:
3.8. Compiling:
3.9. Configuration
3.10. Compilation and installation
3.11. Run qgis.exe from the directory where it's installed (CMAKE_INSTALL_PREFIX)
3.12. Create the installation package: (optional)
4. Building on Mac OSX using frameworks and cmake (QGIS > 0.8)
4.1. Install XCODE
4.2. Install Qt4 from .dmg
4.3. Install development frameworks for QGIS dependencies
4.3.1. Additional Dependencies : General compatibility note
4.3.2. Additional Dependencies : GSL
4.3.3. Additional Dependencies : Expat
4.3.4. Additional Dependencies : SIP
4.3.5. Additional Dependencies : PyQt
4.3.6. Additional Dependencies : Bison
4.4. Install CMAKE for OSX
4.5. Install subversion for OSX
4.6. Check out QGIS from SVN
4.7. Configure the build
4.7.1. Configure the Cmake build
4.7.2. Configure the Xcode build
4.8. Building
4.8.1. Building with Cmake
4.8.2. Building with Xcode
5. Building on GNU/Linux
5.1. Building QGIS with Qt4.x
5.2. Prepare apt
5.3. Install Qt4
5.4. Install additional software dependencies required by QGIS
5.5. GRASS Specific Steps
5.6. Setup ccache (Optional)
5.7. Prepare your development environment
5.8. Check out the QGIS Source Code
5.9. Starting the compile
5.10. Building Debian packages
5.11. Running QGIS
5.12. A practical case: Building QGIS and GRASS from source on Ubuntu with ECW and MrSID formats support
5.12.1. Step 1: install base packages
5.12.2. Step 2: compile and install the ecw libraries
5.12.3. Step 3: download the MrSID binaries
5.12.4. Step 4: compile and install the gdal libraries
5.12.5. Step 5: compile and install GRASS
5.12.6. Step 6: compile and install the GDAL-GRASS libraries
5.12.7. Step 6: compile and install QGIS
6. Creation of MSYS environment for compilation of Quantum GIS
6.1. Initial setup
6.1.1. MSYS
6.1.2. MinGW
6.1.3. Flex and Bison
6.2. Installing dependencies
6.2.1. Getting ready
6.2.2. GDAL level one
6.2.3. GRASS
6.2.4. GDAL level two
6.2.5. GEOS
6.2.6. SQLITE
6.2.7. GSL
6.2.8. EXPAT
6.2.9. POSTGRES
6.3. Cleanup
7. Building with MS Visual Studio
7.1. Setup Visual Studio
7.1.1. Express Edition
7.1.2. All Editions
7.2. Download/Install Dependencies
7.2.1. Flex and Bison
7.2.2. To include PostgreSQL support in Qt
7.2.3. Qt
7.2.4. Proj.4
7.2.5. GSL
7.2.6. GEOS
7.2.7. GDAL
7.2.8. PostGIS
7.2.9. Expat
7.2.10. CMake
7.3. Building QGIS with CMAKE
8. Building under Windows using MSVC Express
8.1. System preparation
8.2. Install the libraries archive
8.3. Install Visual Studio Express 2005
8.4. Install Microsoft Platform SDK2
8.5. Edit your vsvars
8.6. Environment Variables
8.7. Building Qt4.3.2
8.7.1. Compile Qt
8.7.2. Configure Visual C++ to use Qt
8.8. Install Python
8.9. Install SIP
8.10. Install PyQt4
8.11. Install CMake
8.12. Install Subversion
8.13. Initial SVN Check out
8.14. Create Makefiles using cmakesetup.exe
8.15. Running and packaging
9. Authors and Acknowledgments
------------------------------------------------------------------------
1. Introduction
===============
This document is the original installation guide of the described software
Quantum GIS. The software and hardware descriptions named in this
document are in most cases registered trademarks and are therefore subject
to the legal requirements. Quantum GIS is subject to the GNU General Public
License. Find more information on the Quantum GIS Homepage:
http://www.qgis.org
The details, that are given in this document have been written and verified
to the best of knowledge and responsibility of the editors. Nevertheless,
mistakes concerning the content are possible. Therefore, all data are not
liable to any duties or guarantees. The editors and publishers do not take
any responsibility or liability for failures and their consequences. You are
always welcome for indicating possible mistakes.
You can download this document as part of the Quantum GIS 'User and
Installation Guide' in HTML and PDF format via http://www.qgis.org. A current
version is also available at the wiki, see:
http://wiki.qgis.org/qgiswiki/BuildingFromSource
Translations of this document can also be downloaded at the documentation area
of the Quantum GIS project at http://www.qgis.org. More information is
available via http://wiki.qgis.org/qgiswiki/DocumentationWritersCorner.
Please visit http://qgis.org for information on joining our mailing lists
and getting involved in the project further.
/!\ *Note to document writers:* Please use this document as the central
place for describing build procedures. Please do not remove this notice.
/!\ *Note to document writers:* This documented is generated from
doc/INSTALL.t2t - if you need to edit this document, be sure to edit that
file rather than the generated INSTALL document found in the root of the
source directory.
/!\ *Note:* This is a 'cut and paste' tutorial - in most cases you can
simply copy the commands listed in codeblocks that look like this:
somecommand to be pasted
2. General Build Notes
======================
Since version 0.8.1 QGIS no longer uses the autotools for building. QGIS, like a
number of major projects (eg. KDE 4.0), now uses CMake (http://www.cmake.org)
for building from source. The configure script in this directory simply checks
for the existence of cmake and provides some clues to build QGIS.
For complete information, see the wiki at:
http://wiki.qgis.org/qgiswiki/Building_with_CMake
2.1. An overview of the dependencies required for building
==========================================================
'''Required build deps:'''
* CMake >= 2.4.3
* Flex, Bison
'''Required runtime deps:'''
* Qt >= 4.3.0
* Proj >= ? (known to work with 4.4.x)
* GEOS >= 2.2 (3.0 is supported, maybe 2.1.x works too)
* Sqlite3 >= ? (probably 3.0.0)
* GDAL/OGR >= 1.4.x
'''Optional dependencies:'''
* for GRASS plugin - GRASS >= 6.0.0
* for georeferencer - GSL >= ? (works with 1.8)
* for postgis support and SPIT plugin - PostgreSQL >= 8.0.x
* for gps plugin - expat >= ? (1.95 is OK)
* for mapserver export and PyQGIS - Python >= 2.3 (2.5+ preferred)
* for PyQGIS - SIP >= 4.5, PyQt >= must match Qt version
'''Recommended runtime deps:'''
* for gps plugin - gpsbabel
3. Building under windows using msys
====================================
Note: For a detailed account of building all the dependencies yourself you
can visit Marco Pasetti's website here:
http://www.webalice.it/marco.pasetti/qgis+grass/BuildFromSource.html
Read on to use the simplified approach with pre-built libraries...
3.1. MSYS:
==========
MSYS provides a unix style build environment under windows. We have created a
zip archive that contains just about all dependencies.
Get this:
http://download.osgeo.org/qgis/win32/msys.zip
and unpack to c:\msys
If you wish to prepare your msys environment yourself rather than using
our pre-made one, detailed instructions are provided elsewhere in this
document.
3.2. Qt4.3
==========
Download qt4.3 opensource precompiled edition exe and install (including the
download and install of mingw) from here:
http://www.trolltech.com/developer/downloads/qt/windows
When the installer will ask for MinGW, you don't need to download and install
it, just point the installer to c:\msys\mingw
When Qt installation is complete:
Edit C:\Qt\4.3.0\bin\qtvars.bat and add the following lines:
set PATH=%PATH%;C:\msys\local\bin;c:\msys\local\lib
set PATH=%PATH%;"C:\Program Files\Subversion\bin"
I suggest you also add C:\Qt\4.3.0\bin\ to your Environment Variables Path in
the windows system preferences.
If you plan to do some debugging, you'll need to compile debug version of Qt:
C:\Qt\4.3.0\bin\qtvars.bat compile_debug
Note: there is a problem when compiling debug version of Qt 4.3, the script ends with
this message "mingw32-make: *** No rule to make target `debug'. Stop.". To
compile the debug version you have to go out of src directory and execute the
following command:
c:\Qt\4.3.0 make
3.3. Flex and Bison
===================
*** Note I think this section can be removed as it should be installed int the
msys image already. TS
Get Flex
http://sourceforge.net/project/showfiles.php?group_id=23617&package_id=16424
(the zip bin) and extract it into c:\msys\mingw\bin
3.4. Python stuff: (optional)
=============================
Follow this section in case you would like to use Python bindings for QGIS. To
be able to compile bindings, you need to compile SIP and PyQt4 from sources as
their installer doesn't include some development files which are necessary.
3.4.1. Download and install Python - use Windows installer
==========================================================
(It doesn't matter to what folder you'll install it)
http://python.org/download/
3.4.2. Download SIP and PyQt4 sources
=====================================
http://www.riverbankcomputing.com/software/sip/download
http://www.riverbankcomputing.com/software/pyqt/download
Extract each of the above zip files in a temporary directory. Make sure
to get versions that match your current Qt installed version.
3.4.3. Compile SIP
==================
c:\Qt\4.3.0\bin\qtvars.bat
python configure.py -p win32-g++
make
make install
3.4.4. Compile PyQt
===================
c:\Qt\4.3.0\bin\qtvars.bat
python configure.py
make
make install
3.4.5. Final python notes
=========================
/!\ You can delete the directories with unpacked SIP and PyQt4 sources after a
successfull install, they're not needed anymore.
3.5. Subversion:
================
In order to check out QGIS sources from the repository, you need Subversion
client. This installer should work fine:
http://subversion.tigris.org/files/documents/15/36797/svn-1.4.3-setup.exe
3.6. CMake:
===========
CMake is build system used by Quantum GIS. Download it from here:
http://www.cmake.org/files/v2.4/cmake-2.4.6-win32-x86.exe
3.7. QGIS:
==========
Start a cmd.exe window ( Start -> Run -> cmd.exe ) Create development
directory and move into it
md c:\dev\cpp
cd c:\dev\cpp
Check out sources from SVN For svn head:
svn co https://svn.osgeo.org/qgis/trunk/qgis
For svn 0.8 branch
svn co https://svn.osgeo.org/qgis/branches/Release-0_8_0 qgis0.8
3.8. Compiling:
===============
As a background read the generic building with CMake notes at the end of
this document.
Start a cmd.exe window ( Start -> Run -> cmd.exe ) if you don't have one
already. Add paths to compiler and our MSYS environment:
c:\Qt\4.3.0\bin\qtvars.bat
For ease of use add c:\Qt\4.3.0\bin\ to your system path in system
properties so you can just type qtvars.bat when you open the cmd console.
Create build directory and set it as current directory:
cd c:\dev\cpp\qgis
md build
cd build
3.9. Configuration
==================
cmakesetup ..
/!\ NOTE: You must include the '..' above.
Click 'Configure' button. When asked, you should choose 'MinGW Makefiles'
as generator.
There's a problem with MinGW Makefiles on Win2K. If you're compiling on this
platform, use 'MSYS Makefiles' generator instead.
All dependencies should be picked up automatically, if you have set up the
Paths correctly. The only thing you need to change is the installation
destination (CMAKE_INSTALL_PREFIX) and/or set 'Debug'.
For compatibility with NSIS packaging cripts I recommend to leave the
install prefix to its default c:\program files\
When configuration is done, click 'OK' to exit the setup utility.
3.10. Compilation and installation
==================================
make make install
3.11. Run qgis.exe from the directory where it's installed (CMAKE_INSTALL_PREFIX)
=================================================================================
Make sure to copy all .dll:s needed to the same directory as the qgis.exe
binary is installed to, if not already done so, otherwise QGIS will complain
about missing libraries when started.
The best way to do this is to download both the QGIS current release installer
package from http://qgis.org/uploadfiles/testbuilds/ and install it. Now copy
the installation dir from C:\Program Files\Quantum GIS into c:\Program
Files\qgis-0.8.1 (or whatever the current version is. The name should strictly
match the version no.) After making this copy you can uninstall the release
version of QGIS from your c:\Program Files directory using the provided
uninstaller. Double check that the Quantum GIS dir is completely gone under
program files afterwards.
Another possibility is to run qgis.exe when your path contains
c:\msys\local\bin and c:\msys\local\lib directories, so the DLLs will be
used from that place.
3.12. Create the installation package: (optional)
=================================================
Downlad and install NSIS from (http://nsis.sourceforge.net/Main_Page)
Now using windows explorer, enter the win_build directory in your QGIS source
tree. Read the READMEfile there and follow the instructions. Next right click
on qgis.nsi and choose the option 'Compile NSIS Script'.
4. Building on Mac OSX using frameworks and cmake (QGIS > 0.8)
==============================================================
In this approach I will try to avoid as much as possible building dependencies
from source and rather use frameworks wherever possible.
Included are a few notes for building on Mac OS X 10.5 (Leopard) and 10.6
(Snow Leopard).
Snow Leopard note: A cmake/qt/sip bug currently exists where a 32-bit
cmake build fails to provide python bindings. This means that python plugin support
is currently lacking for 32-bit builds using cmake in Snow Leopard. See the Xcode
build method to if you require python support.
4.1. Install XCODE
==================
I recommend to get the latest xcode dmg from the Apple XDC Web site. Install
XCODE after the ~1gb download is complete.
/!\ Note: It may be that you need to create some symlinks after installing
the XCODE SDK (in particular if you are using XCODE 2.5 on tiger):
cd /Developer/SDKs/MacOSX10.4u.sdk/usr/
sudo mv local/ local_
sudo ln -s /usr/local/ local
4.2. Install Qt4 from .dmg
==========================
You need a minimum of Qt-4.3.0. I suggest getting the latest (at time of writing).
Snow Leopard note: If you are building on Snow Leopard, you will need to
decide between 32-bit support in the older, Qt Carbon branch, or 64-bit
support in the Qt Cocoa branch. Appropriate installers are available for both
as of Qt-4.6.0, but the beta version of Qt-4.6.0 has proven to introduce numerous
bugs in Qgis. Unfortunately, the 32-bit branch of Qt currently does not build with
python bindings (see notes below). You can achieve support for python in Qgis with
the Xcode build method noted below.
ftp://ftp.trolltech.com/qt/source/
Mac versions are named as:
qt-mac-opensource-x.y.z.dmg
x, y, z being the major, minor and revision version.
If you want debug frameworks, Qt also provide a dmg with these. These are in
addition to the non-debug frameworks.
Once downloaded open the dmg and run the installer. Note you need admin
privileges to install.
After installing you need to make two small changes:
First edit /Library/Frameworks/QtCore.framework/Headers/qconfig.h and
change
/!\ Note: this isn't needed since version 4.2.3
QT_EDITION_Unknown to QT_EDITION_OPENSOURCE
Second change the default mkspec symlink so that it points to macx-g++:
cd /usr/local/Qt4.3/mkspecs/
sudo rm default
sudo ln -sf macx-g++ default
/!\ Note: this doesn't seem to be needed since version 4.4.
4.3. Install development frameworks for QGIS dependencies
=========================================================
Download William Kyngesburye's excellent all in one framework that includes
proj, gdal, sqlite3, etc.
http://www.kyngchaos.com/wiki/software:frameworks
Once downloaded, open and install the frameworks.
William provides an additional installer package for Postgresql/PostGIS. It's
available here:
http://www.kyngchaos.com/wiki/software:postgres
Also available is a GRASS application:
http://www.kyngchaos.com/wiki/software:grass
4.3.1. Additional Dependencies : General compatibility note
===========================================================
There are some additional dependencies that, at the time of writing, are not
provided as frameworks or installers so we will need to build these from source.
If you are wanting to build Qgis as a 64-bit application, you will need to
provide the appropriate build commands to produce 64-bit support in dependencies.
Likewise, for 32-bit support on Snow Leopard, you will need to override the
default system architecture, which is 64-bit according to instructions for
individual dependency packages.
4.3.2. Additional Dependencies : GSL
====================================
Retrieve the current version of the Gnu Scientific Library from:
ftp://ftp.gnu.org/gnu/gsl/
Then extract it and build it to a prefix of /usr/local. Double-click the source
tarball to unpack it, then cd to the source folder and:
./configure
make
sudo make install
Snow Leopard note: For explicit 32-bit support in gsl, substitute the standard
configure line with:
./configure --build=i386
And for 64-bit gsl:
./configure --build=x86_64
4.3.3. Additional Dependencies : Expat
======================================
Snow Leopard note: Snow Leopard includes a usable expat, so this step is
not necessary.
Get the expat sources:
http://sourceforge.net/project/showfiles.php?group_id=10127
Double-click the source tarball to unpack, then cd to the source folder and:
./configure
make
sudo make install
4.3.4. Additional Dependencies : SIP
====================================
Leopard and Snow Leopard note: Leopard and Snow Leopard include a usable Python
2.5 or 2.6, respectively. You can install Python from python.org if preferred.
Make sure you have the latest Python 2.5 from
http://www.python.org/download/mac/
Retrieve the python bindings toolkit SIP from
http://www.riverbankcomputing.com/software/sip/download
Double-click the source tarball to unpack it, then cd to the source folder
and (this installs by default into the Python framework):
python configure.py
make
sudo make install
Leopard notes
If building on Leopard, using Leopard's bundled Python, SIP wants to install in the
system path -- this is not a good idea. Use this configure command instead of the
basic configure above:
python configure.py -d /Library/Python/2.5/site-packages -b /usr/local/bin -e /usr/local/include -v /usr/local/share/sip
Snow Leopard notes
If building on Snow Leopard, you need to use one of the following configure lines
based on your installed version of Qt. If you are using 32-bit Qt (Qt Carbon):
python configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin -e /usr/local/include -v /usr/local/share/sip --arch i386
For 64-bit Qt (Qt Cocoa), use this configure line:
python configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin -e /usr/local/include -v /usr/local/share/sip --arch x86_64
4.3.5. Additional Dependencies : PyQt
=====================================
If you encounter problems compiling PyQt using the instructions
below you can also try adding python from your frameworks dir
explicitly to your path e.g.
export PATH=/Library/Frameworks/Python.framework/Versions/Current/bin:$PATH
Retrieve the python bindings toolkit for Qt from
http://www.riverbankcomputing.com/software/pyqt/download
Double-click the source tarball to unpack it, then cd to the source folder
and (this installs by default into the Python framework):
export QTDIR=/Developer/Applications/Qt
python configure.py
yes
make
sudo make install
Leopard notes
If building on Leopard, using Leopard's bundled Python, PyQt wants to install in the system path -- this is not a good idea. Use this configure command instead of the basic configure above:
python configure.py -d /Library/Python/2.5/site-packages -b /usr/local/bin
If there is a problem with undefined symbols in QtOpenGL on Leopard, edit
QtOpenGL/makefile and add -undefined dynamic_lookup to LFLAGS.
Then make again.
Snow Leopard notes
If building on Snow Leopard, you need to use one of the following configure lines based on your installed version of Qt. If you are using 32-bit Qt (Qt Carbon):
python configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin --use-arch i386
For 64-bit Qt (Qt Cocoa), use this configure line:
python configure.py -d /Library/Python/2.6/site-packages -b /usr/local/bin --use-arch x86_64
4.3.6. Additional Dependencies : Bison
======================================
Leopard and Snow Leopard note: Leopard and Snow Leopard includes Bison 2.3, so this step can be skipped on Leopard and Snow Leopard.
The version of bison available by default on Mac OS X 10.4 and older is too old so you need to
get a more recent one on your system. Download at least version 2.3 from:
ftp.gnu.org/gnu/bison/
Now build and install it to a prefix of /usr/local. Double-click the source
tarball to unpack it, then cd to the source folder and:
./configure --prefix=/usr/local
make
sudo make install
4.4. Install CMAKE for OSX
==========================
Get the latest source release from here:
http://www.cmake.org/cmake/resources/software.html
Binary installers are available for OS X, but they are not recommended
(2.4 versions install in /usr instead of /usr/local, and 2.6 versions are a
strange application). Instead, download the source, double-click the source tarball,
then cd to the source folder and:
./bootstrap --docdir=/share/doc/CMake --mandir=/share/man
make
sudo make install
4.5. Install subversion for OSX
===============================
Leopard and Snow Leopard note: Leopard and Snow Leopard include SVN, so this step can be skipped on these Operating Systems.
The http://sourceforge.net/projects/macsvn/ (MacSVN) project has a downloadable
build of svn. If you are a GUI inclined person you may want to grab their gui
client too. Get the command line client here:
curl -O http://ufpr.dl.sourceforge.net/sourceforge/macsvn/Subversion_1.4.2.zip
Once downloaded open the zip file and run the installer.
You also need to install BerkleyDB available from the same
http://sourceforge.net/projects/macsvn/ (website). At the time of writing the
file was here:
curl -O http://ufpr.dl.sourceforge.net/sourceforge/macsvn/Berkeley_DB_4.5.20.zip
Once again unzip this and run the installer therein.
Lastly we need to ensure that the svn commandline executeable is in the path.
Add the following line to the end of /etc/bashrc using sudo:
sudo vim /etc/bashrc
And add this line to the bottom before saving and quiting:
export PATH=/usr/local/bin:$PATH:/usr/local/pgsql/bin
/usr/local/bin needs to be first in the path so that the newer bison (that will
be built from source further down) is found before the bison (which is very
old) that is installed by MacOSX
Now close and reopen your shell to get the updated vars.
4.6. Check out QGIS from SVN
============================
Now we are going to check out the sources for QGIS. First we will create a
directory for working in:
mkdir -p ~/dev/cpp cd ~/dev/cpp
Now we check out the sources:
Trunk:
svn co https://svn.osgeo.org/qgis/trunk/qgis qgis
For a release branch version x.y.z:
svn co https://svn.qgis.org/qgis/branches/Release-x_y_z qgis-x.y.z
The first time you check out QGIS sources you will probably get a message like
this:
Error validating server certificate for 'https://svn.qgis.org:443':
- The certificate is not issued by a trusted authority. Use the fingerprint to
validate the certificate manually! Certificate information:
- Hostname: svn.qgis.org
- Valid: from Apr 1 00:30:47 2006 GMT until Mar 21 00:30:47 2008 GMT
- Issuer: Developer Team, Quantum GIS, Anchorage, Alaska, US
- Fingerprint: 2f:cd:f1:5a:c7:64:da:2b:d1:34:a5:20:c6:15:67:28:33:ea:7a:9b
(R)eject, accept (t)emporarily or accept (p)ermanently?
I suggest you press 'p' to accept the key permanently.
4.7. Configure the build
========================
There are 2 different methods to build QGIS: the traditional Cmake method,
and the new Xcode project (starting with QGIS 1.1). The Xcode project has
additional bundling steps, though some optional Qgis features must be explicitly
stated in a user configuration file. The Cmake build handles optional features,
and some bundling steps are available with scripts in the mac directory.
4.7.1. Configure the Cmake build
================================
CMake supports out of source build so we will create a 'build' dir for the
build process. By convention I build my software into a dir called 'apps' in
my home directory. If you have the correct permissions you may want to build
straight into your /Applications folder. The instructions below assume you are
building into a pre-existing ${HOME}/apps directory ...
cd qgis
mkdir build
cd build
cmake -D CMAKE_INSTALL_PREFIX=$HOME/apps/ -D CMAKE_BUILD_TYPE=Release ..
Leopard note: To find the custom install of SIP on Leopard, add ""-
D SIP_BINARY_PATH=/usr/local/bin/sip"" to the cmake command above,
before the .. at the end, ie:
cmake -D CMAKE_INSTALL_PREFIX=$HOME/apps/ \
-D CMAKE_BUILD_TYPE=Release \
-D SIP_BINARY_PATH=/usr/local/bin/sip \
..
To use the application build of GRASS on OSX, you can optionally use the
following cmake invocation (minimum GRASS 6.3 required, substitute the GRASS
version as required):
cmake -D CMAKE_INSTALL_PREFIX=${HOME}/apps/ \
-D GRASS_INCLUDE_DIR=/Applications/GRASS-6.4.app/Contents/MacOS/
include \
-D GRASS_PREFIX=/Applications/GRASS-6.4.app/Contents/MacOS \
-D CMAKE_BUILD_TYPE=Release \
..
Or, to use a Unix-style build of GRASS, use the following cmake invocation
(minimum GRASS version as stated in the Qgis requirements, substitute the GRASS
path and version as required):
cmake -D CMAKE_INSTALL_PREFIX=${HOME}/apps/ \
-D GRASS_INCLUDE_DIR=/user/local/grass-6.4.0/include \
-D GRASS_PREFIX=/user/local/grass-6.4.0 \
-D CMAKE_BUILD_TYPE=Release \
..
Snow Leopard note: To handle the appropriate version of Qt (32-bit or 64-bit), you will need to invoke cmake based on which version of Qt you installed.
For 32-bit Qt (Carbon) with GRASS-6.4:
cmake -D CMAKE_INSTALL_PREFIX=$HOME/apps/ \
-D CMAKE_BUILD_TYPE=Release \
-D SIP_BINARY_PATH=/usr/local/bin/sip
-D CMAKE_C_FLAGS=-m32 \
-D CMAKE_CXX_FLAGS=-m32
-D CMAKE_OSX_ARCHITECTURES=i386
-D GRASS_PREFIX=/Applications/GRASS-6.4.app/Contents/MacOS \
-D GRASS_INCLUDE_DIR=/Applications/GRASS-6.4.app/Contents/MacOS/include\
..
For 64-bit Qt (Cocoa) with GRASS-6.4:
cmake -D CMAKE_INSTALL_PREFIX=$HOME/apps/ \
-D CMAKE_BUILD_TYPE=Release \
-D SIP_BINARY_PATH=/usr/local/bin/sip
-D CMAKE_C_FLAGS=-m64 \
-D CMAKE_CXX_FLAGS=-m64
-D CMAKE_OSX_ARCHITECTURES=x86_64
-D GRASS_PREFIX=/Applications/GRASS-6.4.app/Contents/MacOS \
-D GRASS_INCLUDE_DIR=/Applications/GRASS-6.4.app/Contents/MacOS/include\
..
4.7.2. Configure the Xcode build
================================
In the mac/xcode folder in the source, duplicate the 'qgis_user-template.xcconfig'
file and name it 'qgis_user.xcconfig'. A default build will use the KyngChaos
frameworks, Postgres, GRASS 6.4, the python.org Python 2.5 and extra dependencies
as described above, and compile for the current OSX architecture and version, so no
extra configuration is necessary. If building on Leopard or newer, you may want to
use the system Python, which requires editing qgis_user.xcconfig.
See the mac/xcode/readme.rtf for details, if you need to customize the build.
The default build will also bundle the Qt frameworks, Postgres library, and
other dependency libraries to create a self-contained package. The KyngChaos
frameworks and GRASS application are not bundled.
4.8. Building
=============
4.8.1. Building with Cmake
==========================
Now we can start the build process:
make
If all built without errors you can then install it:
make install
or, for a Unix-style build
sudo make install
4.8.2. Building with Xcode
==========================
Open the Xcode project file in the mac/xcode directory. Select 'Release' build
configuration and select the 'Full Qgis' target, then build. If you use ccache,
there have been compilation problems reported, so it is suggested that you disable
ccache support.
Alternatively, from within the mac/xcode directory, build with the command:
xcodebuild
Snow Leopard note: You can also build Qgis using the new llvm compilers supplied
with Xcode 3.2.x. To do this, you first need to export the proper compiler settings:
export CC=/Developer/usr/bin/llvm-gcc
export CXX=/Developer/usr/bin/llvm-g++
xcodebuild
The Qgis application will be found in the 'build/$SYSTEM/Release' folder in the xcode folder.
Copy this to whereever you like.
5. Building on GNU/Linux
========================
5.1. Building QGIS with Qt4.x
=============================
Requires: Ubuntu Hardy / Debian derived distro
These notes are current for Ubuntu 7.10 - other versions and Debian derived
distros may require slight variations in package names.
These notes are for if you want to build QGIS from source. One of the major
aims here is to show how this can be done using binary packages for *all*
dependencies - building only the core QGIS stuff from source. I prefer this
approach because it means we can leave the business of managing system packages
to apt and only concern ourselves with coding QGIS!
This document assumes you have made a fresh install and have a 'clean' system.
These instructions should work fine if this is a system that has already been
in use for a while, you may need to just skip those steps which are irrelevant
to you.
5.2. Prepare apt
================
The packages qgis depends on to build are available in the "universe" component
of Ubuntu. This is not activated by default, so you need to activate it:
1. Edit your /etc/apt/sources.list file.
2. Uncomment the all the lines starting with "deb"
Also you will need to be running (K)Ubuntu 'edgy' or higher in order for
all dependencies to be met.
Now update your local sources database:
sudo apt-get update
5.3. Install Qt4
================
sudo apt-get install libqt4-core libqt4-debug \
libqt4-dev libqt4-gui libqt4-qt3support libqt4-sql lsb-qt4 qt4-designer \
qt4-dev-tools qt4-doc qt4-qtconfig uim-qt gcc libapt-pkg-perl resolvconf
/!\ *A Special Note:* If you are following this set of instructions on
a system where you already have Qt3 development tools installed, there will
be a conflict between Qt3 tools and Qt4 tools. For example, qmake will
point to the Qt3 version not the Qt4. Ubuntu Qt4 and Qt3 packages are
designed to live alongside each other. This means that for example if you
have them both installed you will have three qmake exe's:
/usr/bin/qmake -> /etc/alternatives/qmake
/usr/bin/qmake-qt3
/usr/bin/qmake-qt4
The same applies to all other Qt binaries. You will notice above that the
canonical 'qmake' is managed by apt alternatives, so before we start to
build QGIS, we need to make Qt4 the default. To return Qt3 to default later
you can use this same process.
You can use apt alternatives to correct this so that the Qt4 version of
applications is used in all cases:
sudo update-alternatives --config qmake
sudo update-alternatives --config uic
sudo update-alternatives --config designer
sudo update-alternatives --config assistant
sudo update-alternatives --config qtconfig
sudo update-alternatives --config moc
sudo update-alternatives --config lupdate
sudo update-alternatives --config lrelease
sudo update-alternatives --config linguist
Use the simple command line dialog that appears after running each of the
above commands to select the Qt4 version of the relevant applications.
5.4. Install additional software dependencies required by QGIS
==============================================================
sudo apt-get install gdal-bin libgdal1-dev libgeos-dev proj \
libgdal-doc libhdf4g-dev libhdf4g-run python-dev \
libgsl0-dev g++ libjasper-dev libtiff4-dev subversion \
libsqlite3-dev sqlite3 ccache make libpq-dev flex bison cmake txt2tags \
python-qt4 python-qt4-dev python-sip4 sip4 python-sip4-dev
/!\ Debian users should use libgdal-dev above rather
/!\ *Note:* For python language bindings SIP >= 4.5 and PyQt4 >= 4.1 is required! Some stable GNU/Linux
distributions (e.g. Debian or SuSE) only provide SIP < 4.5 and PyQt4 < 4.1. To include support for python
language bindings you may need to build and install those packages from source.
If you do not have cmake installed already:
sudo apt-get install cmake
5.5. GRASS Specific Steps
=========================
/!\ *Note:* If you don't need to build with GRASS support, you can
skip this section.
Now you can install grass from dapper:
sudo apt-get install grass libgrass-dev libgdal1-1.4.0-grass
/!\ You may need to explicitly state your grass version e.g. libgdal1-1.3.2-grass
5.6. Setup ccache (Optional)
============================
You should also setup ccache to speed up compile times:
cd /usr/local/bin
sudo ln -s /usr/bin/ccache gcc
sudo ln -s /usr/bin/ccache g++
5.7. Prepare your development environment
=========================================
As a convention I do all my development work in $HOME/dev/<language>, so in
this case we will create a work environment for C++ development work like
this:
mkdir -p ${HOME}/dev/cpp
cd ${HOME}/dev/cpp
This directory path will be assumed for all instructions that follow.
5.8. Check out the QGIS Source Code
===================================
There are two ways the source can be checked out. Use the anonymous method
if you do not have edit privaleges for the QGIS source repository, or use
the developer checkout if you have permissions to commit source code
changes.
1. Anonymous Checkout
cd ${HOME}/dev/cpp
svn co https://svn.osgeo.org/qgis/trunk/qgis qgis
2. Developer Checkout
cd ${HOME}/dev/cpp
svn co --username <yourusername> https://svn.osgeo.org/qgis/trunk/qgis qgis
The first time you check out the source you will be prompted to accept the
qgis.org certificate. Press 'p' to accept it permanently:
Error validating server certificate for 'https://svn.qgis.org:443':
- The certificate is not issued by a trusted authority. Use the
fingerprint to validate the certificate manually! Certificate
information:
- Hostname: svn.qgis.org
- Valid: from Apr 1 00:30:47 2006 GMT until Mar 21 00:30:47 2008 GMT
- Issuer: Developer Team, Quantum GIS, Anchorage, Alaska, US
- Fingerprint:
2f:cd:f1:5a:c7:64:da:2b:d1:34:a5:20:c6:15:67:28:33:ea:7a:9b (R)eject,
accept (t)emporarily or accept (p)ermanently?
5.9. Starting the compile
=========================
/!\ *Note:* The next section describes howto build debian packages
I compile my development version of QGIS into my ~/apps directory to avoid
conflicts with Ubuntu packages that may be under /usr. This way for example
you can use the binary packages of QGIS on your system along side with your
development version. I suggest you do something similar:
mkdir -p ${HOME}/apps
Now we create a build directory and run ccmake:
cd qgis
mkdir build
cd build
ccmake ..
When you run ccmake (note the .. is required!), a menu will appear where
you can configure various aspects of the build. If you do not have root
access or do not want to overwrite existing QGIS installs (by your
packagemanager for example), set the CMAKE_BUILD_PREFIX to somewhere you
have write access to (I usually use /home/timlinux/apps). Now press
'c' to configure, 'e' to dismiss any error messages that may appear.
and 'g' to generate the make files. Note that sometimes 'c' needs to
be pressed several times before the 'g' option becomes available.
After the 'g' generation is complete, press 'q' to exit the ccmake
interactive dialog.
Now on with the build:
make
make install
It may take a little while to build depending on your platform.
5.10. Building Debian packages
==============================
Instead of creating a personal installation as in the previous step you can
also create debian package. This is done from the qgis root directory, where
you'll find a debian directory.
First you need to install the debian packaging tools once:
apt-get install build-essential
The QGIS packages will be created with:
dpkg-buildpackage -us -uc -b
/!\ *Note:* If dpkg-buildpackage complains about unmet build dependencies
you can install them using apt-get and re-run the command.
/!\ *Note:* If you have libqgis1-dev installed, you need to remove it first
using dpkg -r libqgis1-dev. Otherwise dpkg-buildpackage will complain about a
build conflict.
The the packages are created in the parent directory (ie. one level up).
Install them using dpkg. E.g.:
sudo dpkg -i \
../qgis_1.0preview16_amd64.deb \
../libqgis-gui1_1.0preview16_amd64.deb \
../libqgis-core1_1.0preview16_amd64.deb \
../qgis-plugin-grass_1.0preview16_amd64.deb \
../python-qgis_1.0preview16_amd64.deb
5.11. Running QGIS
==================
Now you can try to run QGIS:
$HOME/apps/bin/qgis
If all has worked properly the QGIS application should start up and appear
on your screen.
5.12. A practical case: Building QGIS and GRASS from source on Ubuntu with ECW and MrSID formats support
========================================================================================================
The following procedure has been tested on Ubuntu 8.04, 8.10 and 9.04 32bit. If you want
to use different versions of the software (gdal, grass, qgis), just make the
necessary adjustments to the following code. This guide assumes that you don't have
installed any previous version of gdal, grass and qgis.
5.12.1. Step 1: install base packages
=====================================
First you need to install the necessary packages required to download the source
code and compile it. Open the terminal and issue the following command:
sudo apt-get install build-essential g++ subversion
5.12.2. Step 2: compile and install the ecw libraries
=====================================================
Go to the ERDAS web site http://www.erdas.com/ and follow the links
"'''products --> ECW JPEG2000 Codec SDK --> downloads'''"
then download the "'''Image Compression SDK Source Code 3.3'''" (you'll need to make a registration
and accept a license).
Uncompress the arquive in a proper location (this guide assumes
that all the downloaded source code will be placed in the user home)
and the enter the newly created folder
cd /libecwj2-3.3
Compile the code with the standard commands
./configure
then
make
then
sudo make install
leave the folder
cd ..
5.12.3. Step 3: download the MrSID binaries
===========================================
Go to the LIZARDTECH web site http://www.lizardtech.com/ and follow the links
"'''download --> Developer SDKs'''",
then download the "'''GeoExpress SDK for Linux (x86) - gcc 4.1 32-bit'''"
(you'll need to make a registration and accept a license).
Uncompress the downloaded file. The resulting directory name should be similar to "Geo_DSDK-7.0.0.2167"
5.12.4. Step 4: compile and install the gdal libraries
======================================================
Download the latest gdal source code
svn checkout https://svn.osgeo.org/gdal/trunk/gdal gdal
then copy a few files from the MrSID binaries folder to the folder with the gdal source code
('''replace "USERNAME" with your actual account username''')
cp /home/USERNAME/Geo_DSDK-7.0.0.2167/include/*.* /home/USERNAME/gdal/frmts/mrsid/
enter the gdal source code folder
cd /gdal
and run configure with a few specific parameters
./configure --without-grass --with-mrsid=../Geo_DSDK-7.0.0.2167 --without-jp2mrsid
at the end of the configuration process you should read something like
...
GRASS support: no
...
...
...
ECW support: yes
MrSID support yes
...
then compile normally
make
and
sudo make install
finish the process by creating the necessary links to the most recent shared libraries
sudo ldconfig
at this point you may want to check if gdal was compiled correctly with MrSID and ECW
support by issuing one (or both) of the following commands
gdalinfo --formats | grep 'ECW'
gdalinfo --formats | grep 'SID'
leave the folder
cd ..
5.12.5. Step 5: compile and install GRASS
=========================================
Before downloading and compile GRASS source code you need to install a few
other libraries and programs. We can do this trough apt
sudo apt-get install flex bison libreadline5-dev libncurses5-dev lesstif2-dev debhelper dpatch libtiff4-dev \
tcl8.4-dev tk8.4-dev fftw-dev xlibmesa-gl-dev libfreetype6-dev autoconf2.13 autotools-dev \
libgdal1-dev proj libjpeg62-dev libpng12-dev libpq-dev unixodbc-dev doxygen fakeroot cmake \
python-dev python-qt4-common python-qt4-dev python-sip4 python2.5-dev sip4 libglew1.5-dev libxmu6 \
libqt4-dev libgsl0-dev python-qt4 swig python-wxversion python-wxgtk2.8 libwxgtk2.8-0 libwxbase2.8-0 tcl8.4-dev \
tk8.4-dev tk8.4 libfftw3-dev libfftw3-3
At this point we can get the GRASS source code: you may want to download it
trough svn or maybe you want just to download the latest available source code arquive.
For example the GRASS 6.4rc4 is available at http://grass.itc.it/grass64/source/grass-6.4.0RC4.tar.gz
Uncompress the arquive, enter the newly created folder and run configure with a few specific parameters
./configure --with-tcltk-includes=/usr/include/tcl8.4 --with-proj-share=/usr/share/proj --with-gdal=/usr/local/bin/gdal-config --with-python=/usr/bin/python2.5-config
then as usual (it will take a while)
make
and
sudo make install
leave the folder
cd ..
you have now compiled and installed GRASS (also with the new wxpyhton interface) so you
may want to give it a try
grass64 -wxpython
5.12.6. Step 6: compile and install the GDAL-GRASS libraries
============================================================
Create a plain text file named "grass.conf" inside the folder "/etc/ld.so.conf.d"
sudo gedit /etc/ld.so.conf.d/grass.conf
and add the following line
/usr/local/grass-6.4.0RC4/lib/
save and exit.
Download the latest version of the gdal-grass library (gdal-grass-1.4.3.tar.gz) from
http://download.osgeo.org/gdal/
uncompress the arquive and enter the newly created folder
cd /gdal-grass-1.4.3
run configure
./configure --with-grass=/usr/local/grass-6.4.0RC4
then as usual
make
and
sudo make install
and finish the process by creating the necessary links to the most recent shared libraries
sudo ldconfig
leave the folder
cd ..
5.12.7. Step 6: compile and install QGIS
========================================
As for GRASS you can obtain the QGIS source code from different sources,
for instance from svn or just by downloading one of the source code arquives available
at http://www.qgis.org/download/sources.html
For example download the QGIS 1.1.0 source code here http://download.osgeo.org/qgis/src/qgis_1.1.0.tar.gz
uncompress the arquive and enter the newly created folder
cd /qgis_1.1.0
then run ccmake
ccmake .
press the "c" key, then when the option list will appear we need to manually
configure the "GRASS_PREFIX" parameter. Scroll down until the "GRASS_PREFIX" will appear,
press enter and manually set it to
/usr/local/grass-6.4.0RC4
then press enter again.
Press the "c" again and the option "Press [g] to generate and exit" will appear.
Press the "g" key to generate and exit.
then as usual (it will take a while)
make
and
sudo make install
At the end of the process you should have QGIS and GRASS working with MrSID and ECW
raster format support.
To run QGIS just use this command
qgis
6. Creation of MSYS environment for compilation of Quantum GIS
==============================================================
6.1. Initial setup
==================
6.1.1. MSYS
===========
This is the environment that supplies many utilities from UNIX world in Windows and is needed
by many dependencies to be able to compile.
Download from here:
http://puzzle.dl.sourceforge.net/sourceforge/mingw/MSYS-1.0.11-2004.04.30-1.exe
Install to c:\msys
All stuff we're going to compile is going to get to this directory (resp. its subdirs).
6.1.2. MinGW
============
Download from here:
http://puzzle.dl.sourceforge.net/sourceforge/mingw/MinGW-5.1.3.exe
Install to c:\msys\mingw
It suffices to download and install only g++ and mingw-make components.
6.1.3. Flex and Bison
=====================
Flex and Bison are tools for generation of parsers, they're needed for GRASS and also QGIS compilation.
Download the following packages:
http://gnuwin32.sourceforge.net/downlinks/flex-bin-zip.php
http://gnuwin32.sourceforge.net/downlinks/bison-bin-zip.php
http://gnuwin32.sourceforge.net/downlinks/bison-dep-zip.php
Unpack them all to c:\msys\local
6.2. Installing dependencies
============================
6.2.1. Getting ready
====================
Paul Kelly did a great job and prepared a package of precompiled libraries for GRASS.
The package currently includes:
- zlib-1.2.3
- libpng-1.2.16-noconfig
- xdr-4.0-mingw2
- freetype-2.3.4
- fftw-2.1.5
- PDCurses-3.1
- proj-4.5.0
- gdal-1.4.1
It's available for download here:
http://www.stjohnspoint.co.uk/grass/wingrass-extralibs.tar.gz
Moreover he also left the notes how to compile it (for those interested):
http://www.stjohnspoint.co.uk/grass/README.extralibs
Unpack the whole package to c:\msys\local
6.2.2. GDAL level one
=====================
Since Quantum GIS needs GDAL with GRASS support, we need to compile GDAL
from source - Paul Kelly's package doesn't include GRASS support in GDAL.
The idea is following:
1. compile GDAL without GRASS
2. compile GRASS
3. compile GDAL with GRASS
So, start with downloading GDAL sources:
http://download.osgeo.org/gdal/gdal141.zip
Unpack it to some directory, preferably c:\msys\local\src.
Start MSYS console, go to gdal-1.4.1 directory and run the commands below.
You can put them all to a script, e.g. build-gdal.sh and run them at once.
The recipe is taken from Paul Kelly's instructions - basically they
just make sure that the library will be created as DLL and the utility
programs will be dynamically linked to it...
CFLAGS="-O2 -s" CXXFLAGS="-O2 -s" LDFLAGS=-s ./configure --without-libtool --prefix=/usr/local --enable-shared --disable-static --with-libz=/usr/local --with-png=/usr/local
make
make install
rm /usr/local/lib/libgdal.a
g++ -s -shared -o ./libgdal.dll -L/usr/local/lib -lz -lpng ./frmts/o/*.o ./gcore/*.o ./port/*.o ./alg/*.o ./ogr/ogrsf_frmts/o/*.o ./ogr/ogrgeometryfactory.o ./ogr/ogrpoint.o ./ogr/ogrcurve.o ./ogr/ogrlinestring.o ./ogr/ogrlinearring.o ./ogr/ogrpolygon.o ./ogr/ogrutils.o ./ogr/ogrgeometry.o ./ogr/ogrgeometrycollection.o ./ogr/ogrmultipolygon.o ./ogr/ogrsurface.o ./ogr/ogrmultipoint.o ./ogr/ogrmultilinestring.o ./ogr/ogr_api.o ./ogr/ogrfeature.o ./ogr/ogrfeaturedefn.o ./ogr/ogrfeaturequery.o ./ogr/ogrfeaturestyle.o ./ogr/ogrfielddefn.o ./ogr/ogrspatialreference.o ./ogr/ogr_srsnode.o ./ogr/ogr_srs_proj4.o ./ogr/ogr_fromepsg.o ./ogr/ogrct.o ./ogr/ogr_opt.o ./ogr/ogr_srs_esri.o ./ogr/ogr_srs_pci.o ./ogr/ogr_srs_usgs.o ./ogr/ogr_srs_dict.o ./ogr/ogr_srs_panorama.o ./ogr/swq.o ./ogr/ogr_srs_validate.o ./ogr/ogr_srs_xml.o ./ogr/ograssemblepolygon.o ./ogr/ogr2gmlgeometry.o ./ogr/gml2ogrgeometry.o
install libgdal.dll /usr/local/lib
cd ogr
g++ -s ogrinfo.o -o ogrinfo.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s ogr2ogr.o -o ogr2ogr.exe -lgdal -L/usr/local/lib -lpng -lz -lgdal
g++ -s ogrtindex.o -o ogrtindex.exe -lgdal -L/usr/local/lib -lpng -lz -lgdal
install ogrinfo.exe ogr2ogr.exe ogrtindex.exe /usr/local/bin
cd ../apps
g++ -s gdalinfo.o -o gdalinfo.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdal_translate.o -o gdal_translate.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdaladdo.o -o gdaladdo.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdalwarp.o -o gdalwarp.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdal_contour.o -o gdal_contour.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdaltindex.o -o gdaltindex.exe -L/usr/local/lib -lpng -lz -lgdal
g++ -s gdal_rasterize.o -o gdal_rasterize.exe -L/usr/local/lib -lpng -lz -lgdal
install gdalinfo.exe gdal_translate.exe gdaladdo.exe gdalwarp.exe gdal_contour.exe gdaltindex.exe gdal_rasterize.exe /usr/local/bin
Finally, manually edit gdal-config in c:\msys\local\bin to replace the static library reference with -lgdal:
CONFIG_LIBS="-L/usr/local/lib -lpng -lz -lgdal"
GDAL build procedure can be greatly simplified to use libtool with a libtool line patch:
configure gdal as below:
./configure --with-ngpython --with-xerces=/local/ --with-jasper=/local/ --with-grass=/local/grass-6.3.cvs/ --with-pg=/local/pgsql/bin/pg_config.exe
Then fix libtool with:
mv libtool libtool.orig
cat libtool.orig | sed 's/max_cmd_len=8192/max_cmd_len=32768/g' > libtool
Libtool on windows assumes a line length limit of 8192 for some reason and tries to page the linking and fails miserably. This is a work around.
Make and make install should be hassle free after this.
6.2.3. GRASS
============
Grab sources from CVS or use a weekly snapshot, see:
http://grass.itc.it/devel/cvs.php
In MSYS console go to the directory where you've unpacked or checked out sources
(e.g. c:\msys\local\src\grass-6.3.cvs)
Run these commands:
export PATH="/usr/local/bin:/usr/local/lib:$PATH"
./configure --prefix=/usr/local --bindir=/usr/local --with-includes=/usr/local/include --with-libs=/usr/local/lib --with-cxx --without-jpeg --without-tiff --with-postgres=yes --with-postgres-includes=/local/pgsql/include --with-pgsql-libs=/local/pgsql/lib --with-opengl=windows --with-fftw --with-freetype --with-freetype-includes=/mingw/include/freetype2 --without-x --without-tcltk --enable-x11=no --enable-shared=yes --with-proj-share=/usr/local/share/proj
make
make install
It should get installed to c:\msys\local\grass-6.3.cvs
By the way, these pages might be useful:
- http://grass.gdf-hannover.de/wiki/WinGRASS_Current_Status
- http://geni.ath.cx/grass.html
6.2.4. GDAL level two
=====================
At this stage, we'll use GDAL sources we've used before, only the compilation will be a bit different.
But first in order to be able to compile GDAL sources with current GRASS CVS, you need to patch them, here's what you need to change:
http://trac.osgeo.org/gdal/attachment/ticket/1587/plugin_patch_grass63.diff
(you can patch it by hand or use patch.exe in c:\msys\bin)
Now in MSYS console go to the GDAL sources directory and run the same commands as in level one, only with these differences:
1. when running ./configure add this argument: --with-grass=/usr/local/grass-6.3.cvs
2. when calling g++ on line 5 (which creates libgdal.dll), add these arguments: -L/usr/local/grass-6.3.cvs/lib -lgrass_vect -lgrass_dig2 -lgrass_dgl -lgrass_rtree -lgrass_linkm -lgrass_dbmiclient -lgrass_dbmibase -lgrass_I -lgrass_gproj -lgrass_vask -lgrass_gmath -lgrass_gis -lgrass_datetime
Then again, edit gdal-config and change line with CONFIG_LIBS
CONFIG_LIBS="-L/usr/local/lib -lpng -L/usr/local/grass-6.3.cvs/lib -lgrass_vect -lgrass_dig2 -lgrass_dgl -lgrass_rtree -lgrass_linkm -lgrass_dbmiclient -lgrass_dbmibase -lgrass_I -lgrass_gproj -lgrass_vask -lgrass_gmath -lgrass_gis -lgrass_datetime -lz -L/usr/local/lib -lgdal"
Now, GDAL should be able to work also with GRASS raster layers.
6.2.5. GEOS
===========
Download the sources:
http://geos.refractions.net/geos-2.2.3.tar.bz2
Unpack to e.g. c:\msys\local\src
To compile, I had to patch the sources: in file source/headers/timeval.h line 13.
Change it from:
#ifdef _WIN32
to:
#if defined(_WIN32) && defined(_MSC_VER)
Now, in MSYS console, go to the source directory and run:
./configure --prefix=/usr/local
make
make install
6.2.6. SQLITE
=============
You can use precompiled DLL, no need to compile from source:
Download this archive:
http://www.sqlite.org/sqlitedll-3_3_17.zip
and copy sqlite3.dll from it to c:\msys\local\lib
Then download this archive:
http://www.sqlite.org/sqlite-source-3_3_17.zip
and copy sqlite3.h to c:\msys\local\include
6.2.7. GSL
==========
Download sources:
ftp://ftp.gnu.org/gnu/gsl/gsl-1.9.tar.gz
Unpack to c:\msys\local\src
Run from MSYS console in the source directory:
./configure
make
make install
6.2.8. EXPAT
============
Download sources:
http://dfn.dl.sourceforge.net/sourceforge/expat/expat-2.0.0.tar.gz
Unpack to c:\msys\local\src
Run from MSYS console in the source directory:
./configure
make
make install
6.2.9. POSTGRES
===============
We're going to use precompiled binaries. Use the link below for download:
http://wwwmaster.postgresql.org/download/mirrors-ftp?file=%2Fbinary%2Fv8.2.4%2Fwin32%2Fpostgresql-8.2.4-1-binaries-no-installer.zip
copy contents of pgsql directory from the archive to c:\msys\local
6.3. Cleanup
============
We're done with preparation of MSYS environment. Now you can delete all stuff in c:\msys\local\src - it takes quite a lot
of space and it's not necessary at all.
7. Building with MS Visual Studio
=================================
/!\ This section describes a process where you build all dependencies yourself. See the section
after this for a simpler procedure where we have all the dependencies you need pre-packaged
and we focus just on getting Visual Studio Express set up and building QGIS.
Note that this does not currently include GRASS or Python plugins.
7.1. Setup Visual Studio
========================
This section describes the setup required to allow Visual Studio to be used to build QGIS.
7.1.1. Express Edition
======================
The free Express Edition lacks the platform SDK which contains headers and so on that are needed when building QGIS. The platform SDK can be installed as described here:
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
Once this is done, you will need to edit the <vsinstalldir>\Common7\Tools\vsvars file as follows:
Add %PlatformSDKDir%\Include\atl and %PlatformSDKDir%\Include\mfc to the @set INCLUDE entry.
This will add more headers to the system INCLUDE path. Note that this will only work when you use the Visual Studio command prompt when building. Most of the dependencies will be built with this.
You will also need to perform the edits described here to remove the need for a library that Visual Studio Express lacks:
http://www.codeproject.com/wtl/WTLExpress.asp
7.1.2. All Editions
===================
You will need stdint.h and unistd.h. unistd.h comes with GnuWin32 version of flex & bison binaries (see later). stdint.h can be found here:
http://www.azillionmonkeys.com/qed/pstdint.h.
Copy both of these to <vsinstalldir>\VC\include.
7.2. Download/Install Dependencies
==================================
This section describes the downloading and installation of the various QGIS dependencies.
7.2.1. Flex and Bison
=====================
Flex and Bison are tools for generation of parsers, they're needed for GRASS and also QGIS compilation.
Download the following packages and run the installers:
http://gnuwin32.sourceforge.net/downlinks/flex.php
http://gnuwin32.sourceforge.net/downlinks/bison.php
7.2.2. To include PostgreSQL support in Qt
===========================================
If you want to build Qt with PostgreSQL support you need to download
PostgreSQL, install it and create a library you can later link with Qt.
Download from .../binary/v8.2.5/win32/postgresql-8.2.5-1.zip from an
PostgreSQL.org Mirror and install.
PostgreSQL is currently build with MinGW and comes with headers and libraries
for MinGW. The headers can be used with Visual C++ out of the box, but the library
is only shipped in DLL and archive (.a) form and therefore cannot be used with
Visual C++ directly.
To create a library copy following sed script to the file mkdef.sed in
PostgreSQL lib directory:
/Dump of file / {
s/Dump of file \([^ ]*\)$/LIBRARY \1/p
a\
EXPORTS
}
/[ ]*ordinal hint/,/^[ ]*Summary/ {
/^[ ]\+[0-9]\+/ {
s/^[ ]\+[0-9]\+[ ]\+[0-9A-Fa-f]\+[ ]\+[0-9A-Fa-f]\+[ ]\+\([^ =]\+\).*$/ \1/p
}
}
and process execute in the Visual Studio C++ command line (from Programs menu):
cd c:\Program Files\PostgreSQL\8.2\bin
dumpbin /exports ..\bin\libpq.dll | sed -nf ../lib/mkdef.sed >..\lib\libpq.def
cd ..\lib
lib /def:libpq.def /machine:x86
You'll need an sed for that to work in your path (e.g. from cygwin or msys).
That's almost it. You only need to the include and lib path to INCLUDE and LIB
in vcvars.bat respectively.
7.2.3. Qt
=========
Build Qt following the instructions here:
http://wiki.qgis.org/qgiswiki/Building_QT_4_with_Visual_C%2B%2B_2005
7.2.4. Proj.4
=============
Get proj.4 source from here:
http://proj.maptools.org/
Using the Visual Studio command prompt (ensures the environment is setup properly), run the following in the src directory:
nmake -f makefile.vc
Install by running the following in the top level directory setting PROJ_DIR as appropriate:
set PROJ_DIR=c:\lib\proj
mkdir %PROJ_DIR%\bin
mkdir %PROJ_DIR%\include
mkdir %PROJ_DIR%\lib
copy src\*.dll %PROJ_DIR%\bin
copy src\*.exe %PROJ_DIR%\bin
copy src\*.h %PROJ_DIR%\include
copy src\*.lib %PROJ_DIR%\lib
This can also be added to a batch file.
7.2.5. GSL
==========
Get gsl source from here:
http://david.geldreich.free.fr/downloads/gsl-1.9-windows-sources.zip
Build using the gsl.sln file
7.2.6. GEOS
===========
Get geos from svn (svn checkout http://svn.refractions.net/geos/trunk geos).
Edit geos\source\makefile.vc as follows:
Uncomment lines 333 and 334 to allow the copying of version.h.vc to version.h.
Uncomment lines 338 and 339.
Rename geos_c.h.vc to geos_c.h.in on lines 338 and 339 to allow the copying of geos_c.h.in to geos_c.h.
Using the Visual Studio command prompt (ensures the environment is setup properly), run the following in the top level directory:
nmake -f makefile.vc
Run the following in top level directory, setting GEOS_DIR as appropriate:
set GEOS_DIR="c:\lib\geos"
mkdir %GEOS_DIR%\include
mkdir %GEOS_DIR%\lib
mkdir %GEOS_DIR%\bin
xcopy /S/Y source\headers\*.h %GEOS_DIR%\include
copy /Y capi\*.h %GEOS_DIR%\include
copy /Y source\*.lib %GEOS_DIR%\lib
copy /Y source\*.dll %GEOS_DIR%\bin
This can also be added to a batch file.
7.2.7. GDAL
===========
Get gdal from svn (svn checkout https://svn.osgeo.org/gdal/branches/1.4/gdal gdal).
Edit nmake.opt to suit, it's pretty well commented.
Using the Visual Studio command prompt (ensures the environment is setup properly), run the following in the top level directory:
nmake -f makefile.vc
and
nmake -f makefile.vc devinstall
7.2.8. PostGIS
==============
Get PostGIS and the Windows version of PostgreSQL from here:
http://postgis.refractions.net/download/
Note the warning about not installing the version of PostGIS that comes with the PostgreSQL installer. Simply run the installers.
7.2.9. Expat
============
Get expat from here:
http://sourceforge.net/project/showfiles.php?group_id=10127
You'll need expat-win32bin-2.0.1.exe.
Simply run the executable to install expat.
7.2.10. CMake
=============
Get CMake from here:
http://www.cmake.org/HTML/Download.html
You'll need cmake-<version>-win32-x86.exe. Simply run this to install CMake.
7.3. Building QGIS with CMAKE
=============================
Get QGIS source from svn (svn co https://svn.osgeo.org/qgis/trunk/qgis qgis).
Create a 'Build' directory in the top level QGIS directory. This will be where all the build output will be generated.
Run Start-->All Programs-->CMake-->CMake.
In the 'Where is the source code:' box, browse to the top level QGIS directory.
In the 'Where to build the binaries:' box, browse to the 'Build' directory you created in the top level QGIS directory.
Fill in the various *_INCLUDE_DIR and *_LIBRARY entries in the 'Cache Values' list.
Click the Configure button. You will be prompted for the type of makefile that will be generated. Select Visual Studio 8 2005 and click OK.
All being well, configuration should complete without errors. If there are errors, it is usually due to an incorrect path to a header or library directory. Failed items will be shown in red in the list.
Once configuration completes without error, click OK to generate the solution and project files.
With Visual Studio 2005, open the qgis.sln file that will have been created in the Build directory you created earlier.
Build the ALL_BUILD project. This will build all the QGIS binaries along with all the plugins.
Install QGIS by building the INSTALL project. By default this will install to c:\Program Files\qgis<version> (this can be changed by changing the CMAKE_INSTALL_PREFIX variable in CMake).
You will also either need to add all the dependency dlls to the QGIS install directory or add their respective directories to your PATH.
8. Building under Windows using MSVC Express
============================================
/!\ This section of the document is in draft form and is not ready to be used
yet.
Tim Sutton, 2007
8.1. System preparation
=======================
I started with a clean XP install with Service Pack 2 and all patches applied.
I have already compiled all the dependencies you need for gdal, expat etc,
so this tutorial wont cover compiling those from source too. Since compiling
these dependencies was a somewhat painful task I hope my precompiled libs
will be adequate. If not I suggest you consult the individual projects for
specific build documentation and support. Lets go over the process in a nutshell
before we begin:
* Install XP (I used a Parallels virtual machine)
* Install the premade libraries archive I have made for you
* Install Visual Studio Express 2005 sp1
* Install the Microsoft Platform SDK
* Install command line subversion client
* Install library dependencies bundle
* Install Qt 4.3.2
* Check out QGIS sources
* Compile QGIS
* Create setup.exe installer for QGIS
8.2. Install the libraries archive
==================================
Half of the point of this section of the MSVC setup procedure is to make
things as simple as possible for you. To that end I have prepared an
archive that includes all dependencies needed to build QGIS except Qt
(which we will build further down). Fetch the archive from:
http://qgis.org/uploadfiles/msvc/qgis_msvc_deps_except_qt4.zip
Create the following directory structure:
c:\dev\cpp\
And then extract the libraries archive into a subdirectory of the above
directory so that you end up with:
c:\dev\cpp\qgislibs-release
/!\ Note that you are not obliged to use this directory layout, but you
should adjust any instructions that follow if you plan to do things
differently.
8.3. Install Visual Studio Express 2005
=======================================
First thing we need to get is MSVC Express from here:
http://msdn2.microsoft.com/en-us/express/aa975050.aspx
The page is really confusing so don't feel bad if you cant actually find the
download at first! There are six colored blocks on the page for the various
studio family members (vb / c# / j# etc). Simply choose your language under
the 'select your language' combo under the yellow C++ block, and your download
will begin. Under internet explorer I had to disable popup blocking for the
download to be able to commence.
Once the setup commences you will be prompted with various options. Here is what
I chose :
* Send usage information to Microsoft (No)
* Install options:
* Graphical IDE (Yes)
* Microsoft MSDN Express Edition (No)
* Microsoft SQL Server Express Edition (No)
* Install to folder: C:\Program Files\Microsoft Visual Studio 8\ (default)
It will need to download around 90mb of installation files and reports
that the install will consume 554mb of disk space.
8.4. Install Microsoft Platform SDK2
====================================
Go to this page:
http://msdn2.microsoft.com/en-us/express/aa700755.aspx
Start by using the link provided on the above page to download and install the
platform SDK2.
The actual SDK download page is once again a bit confusing since the links for
downloading are hidden amongst a bunch of other links. Basically look for these
three links with their associated 'Download' buttons and choose the correct
link for your platform:
PSDK-amd64.exe 1.2 MB Download
PSDK-ia64.exe 1.3 MB Download
PSDK-x86.exe 1.2 MB Download
When you install make sure to choose 'custom install'. These instructions
assume you are installing into the default path of:
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\
We will go for the minimal install that will give us a working environment,
so on the custom installation screen I made the following choices:
Configuration Options
+ Register Environmental Variables (Yes)
Microsoft Windows Core SDK
+ Tools (Yes)
+ Tools (AMD 64 Bit) (No unless this applies)
+ Tools (Intel 64 Bit) (No unless this applies)
+ Build Environment
+ Build Environment (AMD 64 Bit) (No unless this applies)
+ Build Environment (Intel 64 Bit) (No unless this applies)
+ Build Environment (x86 32 Bit) (Yes)
+ Documentation (No)
+ Redistributable Components (Yes)
+ Sample Code (No)
+ Source Code (No)
+ AMD 64 Source (No)
+ Intel 64 Source (No)
Microsoft Web Workshop (Yes) (needed for shlwapi.h)
+ Build Environment (Yes)
+ Documentation (No)
+ Sample Code (No)
+ Tools (No)
Microsoft Internet Information Server (IIS) SDK (No)
Microsoft Data Access Services (MDAC) SDK (Yes) (needed by GDAL for odbc)
+ Tools
+ Tools (AMD 64 Bit) (No)
+ Tools (AMD 64 Bit) (No)
+ Tools (x86 32 Bit) (Yes)
+ Build Environment
+ Tools (AMD 64 Bit) (No)
+ Tools (AMD 64 Bit) (No)
+ Tools (x86 32 Bit) (Yes)
+ Documentation (No)
+ Sample Code (No)
Microsodt Installer SDK (No)
Microsoft Table PC SDK (No)
Microsoft Windows Management Instrumentation (No)
Microsoft DirectShow SDK (No)
Microsoft Media Services SDK (No)
Debuggin Tools for Windows (Yes)
/!\ Note that you can always come back later to add extra bits if you like.
/!\ Note that installing the SDK requires validation with the
Microsoft Genuine Advantage application. Some people have a philosophical
objection to installing this software on their computers. If you are one
of them you should probably consider using the MINGW build instructions
described elsewhere in this document.
The SDK installs a directory called
C:\Office10
Which you can safely remove.
After the SDK is installed, follow the remaining notes on the page link
above to get your MSVC Express environment configured correctly. For your
convenience, these are summarised again below, and I have added a couple
more paths that I discovered were needed:
1) open Visual Studio Express IDE
2) Tools -> Options -> Projects and Solutions -> VC++ Directories
3) Add:
Executable files:
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin
Include files:
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\atl
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\mfc
Library files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib
4) Close MSVC Express IDE
5) Open the following file with notepad:
C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults\corewin_express.vsprops
and change the property:
AdditionalDependencies="kernel32.lib"
To read:
AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib"
The notes go on to show how to build a mswin32 application which you can try if you like -
I'm not going to recover that here.
8.5. Edit your vsvars
=====================
Backup your vsvars32.bat file in
C:\Program Files\Microsoft Visual Studio 8\Common7\Tools
and replace it with this one:
@SET VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 8
@SET VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio 8\VC
@SET FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework
@SET FrameworkVersion=v2.0.50727
@SET FrameworkSDKDir=C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0
@if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR
@if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR
@echo Setting environment for using Microsoft Visual Studio 2005 x86 tools.
@rem
@rem Root of Visual Studio IDE installed files.
@rem
@set DevEnvDir=C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
@set PATH=C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;C:\Program Files\Microsoft Visual Studio 8\VC\BIN;C:\Program Files\Microsoft Visual Studio 8\Common7\Tools;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 8\VC\VCPackages;%PATH%
@rem added by Tim
@set PATH=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin;%PATH%
@set INCLUDE=C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE;%INCLUDE%
@rem added by Tim
@set INCLUDE=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include;%INCLUDE%
@set INCLUDE=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\mfc;%INCLUDE%
@set INCLUDE=%INCLUDE%;C:\dev\cpp\qgislibs-release\include\postgresql
@set LIB=C:\Program Files\Microsoft Visual Studio 8\VC\LIB;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\lib;%LIB%
@rem added by Tim
@set LIB=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib;%LIB%
@set LIB=%LIB%;C:\dev\cpp\qgislibs-release\lib
@set LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
@goto end
:error_no_VSINSTALLDIR
@echo ERROR: VSINSTALLDIR variable is not set.
@goto end
:error_no_VCINSTALLDIR
@echo ERROR: VCINSTALLDIR variable is not set.
@goto end
:end
8.6. Environment Variables
==========================
Right click on 'My computer' then select the 'Advanced' tab. Click environment variables and
create or augment the following '''System''' variables (if they don't already exist):
Variable Name: Value:
--------------------------------------------------------------------------
EDITOR vim
INCLUDE C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\.
LIB C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib\.
LIB_DIR C:\dev\cpp\qgislibs-release
PATH C:\Program Files\CMake 2.4\bin;
%SystemRoot%\system32;
%SystemRoot%;
%SystemRoot%\System32\Wbem;
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin\.;
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin\WinNT\;
C:\Program Files\svn\bin;C:\Program Files\Microsoft Visual Studio 8\VC\bin;
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;
"c:\Program Files\Microsoft Visual Studio 8\Common7\Tools";
c:\Qt\4.3.2\bin;
"C:\Program Files\PuTTY"
QTDIR c:\Qt\4.3.2
SVN_SSH "C:\\Program Files\\PuTTY\\plink.exe"
8.7. Building Qt4.3.2
=====================
You need a minimum of Qt 4.3.2 here since this is the first version to officially
support building the open source version of Qt for windows under MSVC.
Download Qt 4.x.x source for windows from
http:\\www.trolltech.com
Unpack the source to
c:\Qt\4.x.x\
8.7.1. Compile Qt
=================
Open the Visual Studio C++ command line and cd to c:\Qt\4.x.x where you
extracted the source and enter:
configure -platform win32-msvc2005
nmake
nmake install
Add -qt-sql-odbc -qt-sql-psql to the configure line if your want odbc and
PostgreSQL support build into Qt.
/!\ Note: For me in some cases I got a build error on qscreenshot.pro. If you
are only interested in having the libraries needed for building Qt apps, you
can probably ignore that. Just check in c:\Qt\4.3.2\bin to check all dlls and
helper apps (assistant etc) have been made.
8.7.2. Configure Visual C++ to use Qt
=====================================
After building configure the Visual Studio Express IDE to use Qt:
1) open Visual Studio Express IDE
2) Tools -> Options -> Projects and Solutions -> VC++ Directories
3) Add:
Executable files:
$(QTDIR)\bin
Include files:
$(QTDIR)\include
$(QTDIR)\include\Qt
$(QTDIR)\include\QtCore
$(QTDIR)\include\QtGui
$(QTDIR)\include\QtNetwork
$(QTDIR)\include\QtSvg
$(QTDIR)\include\QtXml
$(QTDIR)\include\Qt3Support
$(LIB_DIR)\include (needed during qgis compile to find stdint.h and unistd.h)
Library files:
$(QTDIR)\lib
Source Files:
$(QTDIR)\src
Hint: You can also add
QString = t=<d->data, su>, size=<d->size, i>
to AutoExp.DAT in C:\Program Files\Microsoft Visual Studio 8\Common7\Packages\Debugger before
[Visualizer]
That way the Debugger will show the contents of QString when you point at or
watch a variable in the debugger. There are probably much more additions -
feel free to add some - I just needed QString and took the first hit in google
I could find.
8.8. Install Python
===================
Download http://python.org/ftp/python/2.5.1/python-2.5.1.msi and install it.
8.9. Install SIP
================
Download http://www.riverbankcomputing.com/Downloads/sip4/sip-4.7.1.zip and extract it
into your c:\dev\cpp directory.
From a Visual C++ command line cd to the directory where you extract SIP and run:
c:\python25\python configure.py -p win32-msvc2005
nmake
nmake install
8.10. Install PyQt4
===================
Download http://www.riverbankcomputing.com/Downloads/PyQt4/GPL/PyQt-win-gpl-4.3.1.zip and extract it
into your c:\dev\cpp directory.
From a Visual C++ command line cd to the directory where you extracted PyQt4 and run:
c:\python25\python configure.py -p win32-msvc2005
nmake
nmake install
8.11. Install CMake
===================
Download and install cmake 2.4.7 or better, making sure to enable the
option
Update path for all users
8.12. Install Subversion
========================
You '''must''' install the command line version if you want the CMake svn scripts to work.
Its a bit tricky to find the correct version on the subversion download site as they have
som misleadingly named similar downloads. Easiest is to just get this file:
http://subversion.tigris.org/downloads/1.4.5-win32/apache-2.2/svn-win32-1.4.5.zip
Extract the zip file to
C:\Program Files\svn
And then add
C:\Program Files\svn\bin
To your path.
8.13. Initial SVN Check out
===========================
Open a cmd.exe window and do:
cd \
cd dev
cd cpp
svn co https://svn.osgeo.org/qgis/trunk/qgis
At this point you will probably get a message like this:
C:\dev\cpp>svn co https://svn.osgeo.org/qgis/trunk/qgis
Error validating server certificate for 'https://svn.qgis.org:443':
- The certificate is not issued by a trusted authority. Use the
fingerprint to validate the certificate manually!
Certificate information:
- Hostname: svn.qgis.org
- Valid: from Sat, 01 Apr 2006 03:30:47 GMT until Fri, 21 Mar 2008 03:30:47 GMT
- Issuer: Developer Team, Quantum GIS, Anchorage, Alaska, US
- Fingerprint: 2f:cd:f1:5a:c7:64:da:2b:d1:34:a5:20:c6:15:67:28:33:ea:7a:9b
(R)eject, accept (t)emporarily or accept (p)ermanently?
Press 'p' to accept and the svn checkout will commence.
8.14. Create Makefiles using cmakesetup.exe
===========================================
I wont be giving a detailed description of the build process, because
the process is explained in the first section (where you manually build
all dependencies) of the windows build notes in this document. Just skip
past the parts where you need to build GDAL etc, since this simplified
install process does all the dependency provisioning for you.
cd qgis
mkdir build
cd build
cmakesetup ..
Cmakesetup should find all dependencies for you automatically (it uses the
LIB_DIR environment to find them all in c:\dev\cpp\qgislibs-release).
Press configure again after the cmakesetup gui appears and when all the red
fields are gone, and you have made any personalisations to the setup, press
ok to close the cmake gui.
Now open Visual Studio Express and do:
File -> Open -> Project / Solution
Now open the cmake generated QGIS solution which should be in :
c:\dev\cpp\qgis\build\qgisX.X.X.sln
Where X.X.X represents the current version number of QGIS. Currently I
have only made release built dependencies for QGIS (debug versions will follow
in future), so you need to be sure to select 'Release' from the solution
configurations toolbar.
Next right click on ALL_BUILD in the solution browser, and then choose build.
Once the build completes right click on INSTALL in the solution browser and
choose build. This will by default install qgis into c:\program files\qgisX.X.X.
8.15. Running and packaging
===========================
To run QGIS you need to at the minimum copy the dlls from c:\dev\cpp\qgislibs-release\bin
into the c:\program files\qgisX.X.X directory.
9. Authors and Acknowledgments
==============================
The following people have contributed to this document:
- Windows MINGW Section
- Tim Sutton, Godofredo Contreras 2006
- CMake additions Magnus Homann 2007
- Python additions Martin Dobias 2007
- With thanks to Tisham Dhar for preparing the initial msys environment
- Windows MSVC Section (Detailed install)
- David Willis 2007
- MSVC install additions Tim Sutton 2007
- PostgreSQL, Qt compile, SIP, Python, AutoExp additions Juergen Fischer 2007
- Windows MSVC Section (Simplified install)
- Tim Sutton 2007
- Juergen Fischer 2007
- OSX Section
- Tim Sutton 2007
- With special thanks to Tom Elwertowski and William Kyngesburye
- GNU/Linux Section
- Tim Sutton 2006
- Debian package section: Juergen Fischer 2008
|