gjtorikian / mtex2MML

A Bison grammar to convert TeX math into MathML.
23 stars 14 forks source link

Kick off building in MSVC #39

Closed anaisbetts closed 9 years ago

anaisbetts commented 9 years ago

This doesn't completely fix the build, I got a bajillion linker errors related to the library itself, but this should at least get you started. To build on Windows:

  1. Install VS2013 Community Edition (or any other one, but community is free)
  2. Install cmake
  3. .\build.ps1
gjtorikian commented 9 years ago

Awesome! Thank you so much! I will try this out on my VM.

A quick question: did you also have to install Bison/Flex through Chocolatey, or is there some other package manager people use?

anaisbetts commented 9 years ago

A quick question: did you also have to install Bison/Flex through Chocolatey, or is there some other package manager people use?

I didn't have to install Bison/Flex at all, maybe that's why I got the linker errors lol. It might be in Chocolatey but I wouldn't be surprised if it wasn't and you had to install it by hand :(

gjtorikian commented 9 years ago

Thanks for your help @paulcbetts. I really appreciate it.

I got the build "building" on my VM. Thankfully Chocolately had Flex and Bison as a package and is generating the .c files correctly. One thing that's not happening is that my header files in the Bison parser are not being picked up. Here are my only errors:

  parser.obj : error LNK2019: unresolved external symbol _mtex2MML_create_css_colors referenced in function _format_additions [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  parser.obj : error LNK2019: unresolved external symbol _mtex2MML_extract_number_from_pxstring referenced in function _mtex2MML_yyparse [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  parser.obj : error LNK2019: unresolved external symbol _mtex2MML_extract_string_from_pxstring referenced in function _mtex2MML_yyparse [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  parser.obj : error LNK2019: unresolved external symbol _mtex2MML_dbl2em referenced in function _mtex2MML_yyparse [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  parser.obj : error LNK2019: unresolved external symbol _mtex2MML_root_pos_to_em referenced in function _mtex2MML_yyparse [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  parser.obj : error LNK2019: unresolved external symbol _mtex2MML_double_pixel referenced in function _mtex2MML_yyparse [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  parser.obj : error LNK2019: unresolved external symbol _mtex2MML_implement_skew referenced in function _mtex2MML_yyparse [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  parser.obj : error LNK2019: unresolved external symbol _mtex2MML_env_replacements referenced in function _format_additions [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  parser.obj : error LNK2019: unresolved external symbol _mtex2MML_vertical_pipe_extract referenced in function _mtex2MML_yyparse [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  parser.obj : error LNK2019: unresolved external symbol _mtex2MML_remove_excess_pipe_chars referenced in function _mtex2MML_yyparse [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  parser.obj : error LNK2019: unresolved external symbol _mtex2MML_combine_row_data referenced in function _mtex2MML_yyparse [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  parser.obj : error LNK2019: unresolved external symbol _mtex2MML_fetch_eqn_number referenced in function _mtex2MML_yyparse [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  parser.obj : error LNK2019: unresolved external symbol _mtex2MML_current_env_type referenced in function _mtex2MML_yyparse [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  parser.obj : error LNK2019: unresolved external symbol _mtex2MML_current_env_line_count referenced in function _mtex2MML_yyparse [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  parser.obj : error LNK2019: unresolved external symbol _mtex2MML_str_replace referenced in function _mtex2MML_yyparse [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  lexer.obj : error LNK2001: unresolved external symbol _mtex2MML_str_replace [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  parser.obj : error LNK2019: unresolved external symbol _snprintf referenced in function _mtex2MML_global_label [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  lexer.obj : error LNK2019: unresolved external symbol _mtex2MML_remove_first_char referenced in function _mtex2MML_yylex [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]
  C:\Users\Garen Torikian\Desktop\mtex2MML\Release\mtex2MML_clar.exe : fatal error LNK1120: 17 unresolved externals [C:\Users\Garen Torikian\Desktop\mtex2MML\mtex2MML_clar.vcxproj]

All of those unresolved symbols are functions I've written (except snprintf, duh). And they're all missing in the Bison/Flex files. So I guess I need to do some Binging for how to link the two on Windows...

gjtorikian commented 9 years ago

Huh. Changing your addition of

if(MSVC)
+  file(GLOB SRC_MTEX2MML ${CMAKE_CURRENT_SOURCE_DIR}/src/**/*.c)

back to

file(GLOB SRC_MTEX2MML ${CMAKE_CURRENT_SOURCE_DIR}/src/*.c)

fixed it for me. That's...weird.

gjtorikian commented 9 years ago

Awesome. I've got it building and the test suite is almost passing. There are 13 failures...but out of 260+ that's not bad.

One last question while I have you on the line: the unistd.h shim file defines some types. Looks like these might be tossing out warnings:

C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdint.h(57): warning C4005: 'INT8_MIN' : macro redefinition [C:\Users\Garen Torikian\Desktop\mtex2MML\build\libmtex2MML.vcxproj]
          C:/Users/Garen Torikian/Desktop/mtex2MML/build/lexer.c(79) : see previous definition of 'INT8_MIN'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdint.h(58): warning C4005: 'INT16_MIN' : macro redefinition [C:\Users\Garen Torikian\Desktop\mtex2MML\build\libmtex2MML.vcxproj]
          C:/Users/Garen Torikian/Desktop/mtex2MML/build/lexer.c(82) : see previous definition of 'INT16_MIN'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdint.h(59): warning C4005: 'INT32_MIN' : macro redefinition [C:\Users\Garen Torikian\Desktop\mtex2MML\build\libmtex2MML.vcxproj]
          C:/Users/Garen Torikian/Desktop/mtex2MML/build/lexer.c(85) : see previous definition of 'INT32_MIN'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdint.h(61): warning C4005: 'INT8_MAX' : macro redefinition [C:\Users\Garen Torikian\Desktop\mtex2MML\build\libmtex2MML.vcxproj]
          C:/Users/Garen Torikian/Desktop/mtex2MML/build/lexer.c(88) : see previous definition of 'INT8_MAX'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdint.h(62): warning C4005: 'INT16_MAX' : macro redefinition [C:\Users\Garen Torikian\Desktop\mtex2MML\build\libmtex2MML.vcxproj]
          C:/Users/Garen Torikian/Desktop/mtex2MML/build/lexer.c(91) : see previous definition of 'INT16_MAX'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdint.h(63): warning C4005: 'INT32_MAX' : macro redefinition [C:\Users\Garen Torikian\Desktop\mtex2MML\build\libmtex2MML.vcxproj]
          C:/Users/Garen Torikian/Desktop/mtex2MML/build/lexer.c(94) : see previous definition of 'INT32_MAX'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdint.h(65): warning C4005: 'UINT8_MAX' : macro redefinition [C:\Users\Garen Torikian\Desktop\mtex2MML\build\libmtex2MML.vcxproj]
          C:/Users/Garen Torikian/Desktop/mtex2MML/build/lexer.c(97) : see previous definition of 'UINT8_MAX'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdint.h(66): warning C4005: 'UINT16_MAX' : macro redefinition [C:\Users\Garen Torikian\Desktop\mtex2MML\build\libmtex2MML.vcxproj]
          C:/Users/Garen Torikian/Desktop/mtex2MML/build/lexer.c(100) : see previous definition of 'UINT16_MAX'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\stdint.h(67): warning C4005: 'UINT32_MAX' : macro redefinition [C:\Users\Garen Torikian\Desktop\mtex2MML\build\libmtex2MML.vcxproj]
          C:/Users/Garen Torikian/Desktop/mtex2MML/build/lexer.c(103) : see previous definition of 'UINT32_MAX'

Is that file necessary?


Closing this in favor of https://github.com/gjtorikian/mtex2MML/pull/42. Thanks again!