Installing MikTex-2.9 in Ubuntu

Problems met during the installing process:

1. Make Error

Linking C static library http://www.cnblogs.com/../binlib/liblua51-static.a
[ 16%] Built target lua51-static
[ 16%] Building C object Libraries/3rd/lua-static/CMakeFiles/miktex-luac.dir/__/lua/src/luac.c.o
[ 16%] Building C object Libraries/3rd/lua-static/CMakeFiles/miktex-luac.dir/__/lua/src/print.c.o
Linking C executable http://www.cnblogs.com/../binlib/miktex-luac
http://www.cnblogs.com/../binlib/liblua51-static.a(lvm.c.o): In function `Arith':
lvm.c:(.text+0x1d5): undefined reference to `pow'
lvm.c:(.text+0x204): undefined reference to `floor'
http://www.cnblogs.com/../binlib/liblua51-static.a(lvm.c.o): In function `luaV_execute':
lvm.c:(.text+0x27c0): undefined reference to `floor'
lvm.c:(.text+0x29b6): undefined reference to `pow'
http://www.cnblogs.com/../binlib/liblua51-static.a(lcode.c.o): In function `luaK_posfix':
lcode.c:(.text+0x2c8f): undefined reference to `pow'
lcode.c:(.text+0x2e13): undefined reference to `floor'
collect2: error: ld returned 1 exit status
make[2]: *** [binlib/miktex-luac] Error 1
make[1]: *** [Libraries/3rd/lua-static/CMakeFiles/miktex-luac.dir/all] Error 2
make: *** [all] Error 2

Solution:

This linking problem occurrs in that gcc does not support linking math library by default. Edit the file ./Libraries/3rd/lua-static/CMakeFiles/miktex-luac.dir/link.txt. Add a compile option -lm before the option -Wl so that the math library can be linked with the liblua51-static.a library.

from

/usr/bin/gcc  -O3 -DNDEBUG  CMakeFiles/miktex-luac.dir/__/lua/src/luac.c.o CMakeFiles/miktex-luac.dir/__/lua/src/print.c.o  -o http://www.cnblogs.com/../binlib/miktex-luac -rdynamic -L/home/chao/Downloads/MikTex-2.9/binlib http://www.cnblogs.com/../binlib/liblua51-static.a -Wl,-rpath,/home/chao/Downloads/MikTex-2.9/binlib:

to

/usr/bin/gcc  -O3 -DNDEBUG  CMakeFiles/miktex-luac.dir/__/lua/src/luac.c.o CMakeFiles/miktex-luac.dir/__/lua/src/print.c.o  -o http://www.cnblogs.com/../binlib/miktex-luac -rdynamic -L/home/chao/Downloads/MikTex-2.9/binlib http://www.cnblogs.com/../binlib/liblua51-static.a -lm -Wl,-rpath,/home/chao/Downloads/MikTex-2.9/binlib:


2. Make Error

[ 27%] Building CXX object BuildUtilities/c4p/CMakeFiles/c4p.dir/gram.cpp.o
[ 28%] Building CXX object BuildUtilities/c4p/CMakeFiles/c4p.dir/scan.cpp.o
/home/chao/Downloads/MikTex-2.9/BuildUtilities/c4p/scan.cpp: In function ‘void yy_init_buffer(YY_BUFFER_STATE, FILE*)’:
/home/chao/Downloads/MikTex-2.9/BuildUtilities/c4p/scan.cpp:1470:61: error: ‘isatty’ was not declared in this scope
make[2]: *** [BuildUtilities/c4p/CMakeFiles/c4p.dir/scan.cpp.o] Error 1
make[1]: *** [BuildUtilities/c4p/CMakeFiles/c4p.dir/all] Error 2
make: *** [all] Error 2

Solution:

Adapted from here: https://github.com/mnemo/apitrace/commit/8159d6c1295da8c1b342bc77686e7ecfed1e5c01

Edit the file BuildUtilities/c4p/scan.cpp

add three lines od code after the line : /* end standard C headers. */

1 #ifndef _WIN32
2 #include <unistd.h> // for isatty()
3 #endif

 Since the file scan.cpp is generated from the file scan.l by flex (refer to the file CMakeLists in the directory BuildUtilities/c4p/),

so if you have cleaned all the objects by running make clean under root directory, then you have to re-write the lines of code above.

To solve this problem permanently, we make some changes to the file scan.l by adding the three lines of code mentioned above

under this block of code in the file scan.l:

1 #if defined(MIKTEX_WINDOWS)
2 #include <io.h>
3 #endif

 3. Make Error

[ 30%] Built target md5-static
[ 30%] Building CXX object Libraries/MiKTeX/Core-static/CMakeFiles/core-static.dir/__/Core/CommandLine.cpp.o
[ 30%] Building CXX object Libraries/MiKTeX/Core-static/CMakeFiles/core-static.dir/__/Core/FileStream.cpp.o
[ 30%] Building CXX object Libraries/MiKTeX/Core-static/CMakeFiles/core-static.dir/__/Core/FormatInfo.cpp.o
[ 31%] Building CXX object Libraries/MiKTeX/Core-static/CMakeFiles/core-static.dir/__/Core/LanguageInfo.cpp.o
In file included from /usr/include/c++/4.7/algorithm:63:0,
                 from /home/chao/Downloads/MikTex-2.9/Libraries/MiKTeX/Core/StdAfx.h:137,
                 from /home/chao/Downloads/MikTex-2.9/Libraries/MiKTeX/Core/LanguageInfo.cpp:22:
/usr/include/c++/4.7/bits/stl_algo.h: In instantiation of ‘_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, const _Tp&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<MiKTeX::ABF3880A6239B84E87DC7E727A8BBFD4::LanguageInfo_*, std::vector<MiKTeX::ABF3880A6239B84E87DC7E727A8BBFD4::LanguageInfo_> >; _Tp = MiKTeX::ABF3880A6239B84E87DC7E727A8BBFD4::LanguageInfo_]’:
/usr/include/c++/4.7/bits/stl_algo.h:2309:70:   required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<MiKTeX::ABF3880A6239B84E87DC7E727A8BBFD4::LanguageInfo_*, std::vector<MiKTeX::ABF3880A6239B84E87DC7E727A8BBFD4::LanguageInfo_> >]’
/usr/include/c++/4.7/bits/stl_algo.h:2340:54:   required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<MiKTeX::ABF3880A6239B84E87DC7E727A8BBFD4::LanguageInfo_*, std::vector<MiKTeX::ABF3880A6239B84E87DC7E727A8BBFD4::LanguageInfo_> >; _Size = long int]’
/usr/include/c++/4.7/bits/stl_algo.h:5476:4:   required from ‘void std::sort(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<MiKTeX::ABF3880A6239B84E87DC7E727A8BBFD4::LanguageInfo_*, std::vector<MiKTeX::ABF3880A6239B84E87DC7E727A8BBFD4::LanguageInfo_> >]’
/home/chao/Downloads/MikTex-2.9/Libraries/MiKTeX/Core/LanguageInfo.cpp:164:43:   required from here
/usr/include/c++/4.7/bits/stl_algo.h:2271:4: error: passing ‘const MiKTeX::ABF3880A6239B84E87DC7E727A8BBFD4::LanguageInfo_’ as ‘this’ argument of ‘bool MiKTeX::ABF3880A6239B84E87DC7E727A8BBFD4::LanguageInfo_::operator<(const MiKTeX::ABF3880A6239B84E87DC7E727A8BBFD4::LanguageInfo_&)’ discards qualifiers [-fpermissive]
make[2]: *** [Libraries/MiKTeX/Core-static/CMakeFiles/core-static.dir/__/Core/LanguageInfo.cpp.o] Error 1
make[1]: *** [Libraries/MiKTeX/Core-static/CMakeFiles/core-static.dir/all] Error 2
make: *** [all] Error 2

Solution:


This problem happens at the 164 line of LanguageInfo.cpp, which is related to the sort algorithm. It seems to be a problem with the sort algorithm.h in STL of C++. To solve this problem, we refer to the following link:

http://stackoverflow.com/questions/10765787/passing-const-this-argument-discards-qualifiers-fpermissive

which mentions about how to solve a similar problem.

The problem is that since ABF3880A6239B84E87DC7E727A8BBFD4::LanguageInfo_ have been defined as const, therefore we can only call static member function on it. Since sort algorithm requires to compare two instances of the type ABF3880A6239B84E87DC7E727A8BBFD4::LanguageInfo_, therefore, the overloaded "<" function must be constant.

So we make changes to the definition of the class ABF3880A6239B84E87DC7E727A8BBFD4::LanguageInfo_, which is define in the file ./Libraries/MiKTeX/Core/internal.h to the following defintion: (pay attention to the const definition of the overloaded < function)

 1 struct LanguageInfo_ : public LanguageInfo 
 2 { 
 3 public: 
 4   LanguageInfo_ () 
 5   { 
 6   } 
 7  
 8 public: 
 9   LanguageInfo_ (/*[in]*/ const LanguageInfo & other) 
10     : LanguageInfo (other) 
11   { 
12   } 
13  
14 public: 
15   PathName cfgFile; 
16  
17 public: 
18   bool operator < (/*[in]*/ const LanguageInfo_ & rhs) const 
19   { 
20     if (this->key == "english") 
21     { 
22       return (true); 
23     } 
24     if (rhs.key == "english") 
25     { 
26       return (false); 
27     } 
28     return (this->key < rhs.key); 
29   } 
30  
31 };

 

4 Make Error
[ 30%] Building CXX object Libraries/MiKTeX/Core-static/CMakeFiles/core-static.dir/__/Core/filetypes.cpp.o
/home/chao/Downloads/MikTex-2.9/Libraries/MiKTeX/Core/filetypes.cpp:794:19: error: macro "P9_" passed 10 arguments, but takes just 9
/home/chao/Downloads/MikTex-2.9/Libraries/MiKTeX/Core/filetypes.cpp: In member function ‘void MiKTeX::ABF3880A6239B84E87DC7E727A8BBFD4::SessionImpl::RegisterFileType(MiKTeX::Core::FileType)’:
/home/chao/Downloads/MikTex-2.9/Libraries/MiKTeX/Core/filetypes.cpp:785:2: error: ‘P9_’ was not declared in this scope
make[2]: *** [Libraries/MiKTeX/Core-static/CMakeFiles/core-static.dir/__/Core/filetypes.cpp.o] Error 1
make[1]: *** [Libraries/MiKTeX/Core-static/CMakeFiles/core-static.dir/all] Error 2
make: *** [all] Error 2

Solution: Since the macro P9_ can only take 9 parameters, so we delete one parameter(the last one of the second to last one since they does not

appear in other cases of FileTypes.)

 1     case FileType::PSHEADER:
 2       RegisterFileType (
 3         FileType::PSHEADER,
 4         "PostScript header",
 5         0,
 6         P2_(".pro", ".enc"),
 7         P9_(CURRENT_DIRECTORY,
 8             R_(MIKTEX_PATH_MIKTEX_CONFIG_DIR),
 9             R_(MIKTEX_PATH_DVIPS_DIR),
10             R_(MIKTEX_PATH_PDFTEX_DIR),
11             R_(MIKTEX_PATH_DVIPDFM_DIR),
12             R_(MIKTEX_PATH_ENC_DIR),
13             R_(MIKTEX_PATH_TYPE1_DIR),
14             R_(MIKTEX_PATH_TYPE42_DIR),
15 //          R_(MIKTEX_PATH_TYPE3_DIR),
16             "$psfontdirs"),
17         P2_("TEXPSHEADERS", "PSHEADERS"));
18       break;

 

sanderd17 from http://ubuntuforums.org/showthread.php?t=1480251

There are lots of problems installing MikTex in Ubuntu, and a message from a guy makes the whole task meaningless...

Why do you need MikTeX? MikTeX is good for Windows cause they don't have a package manager but in Ubuntu, you can use the default package manager.

If you go to System->administration->Synaptic and you do a search for xepersian, you see it's in the Ubuntu texlive-xetex package. So all you have to do is install that package.

If you have to install LaTeX, Just go to the software center, install an editor (kile, texmaker ...) and the LaTeX distribution will come with it.

Hope it helped.


So I think I will change to Kile for the LaTex distribution in the end...

posted on 2012-11-21 10:17  Fractal Matrix  阅读(944)  评论(1)    收藏  举报

导航