fredvs / mselang

Pascal compiler for LLVM.
GNU Lesser General Public License v2.1
15 stars 4 forks source link

Error when trying to compile under Windows #1

Closed rchastain closed 4 years ago

rchastain commented 5 years ago

Hello Fred!

I try to compile the mselang under Windows, using MSEide. I get the following error:

Free Pascal Compiler version 3.0.4 [2017/10/06] for i386

Copyright (c) 1993-2017 by Florian Klaempfl and others Target OS: Win32 for i386 Compiling mselang.pas Compiling C:\MSEide\msegui\lib\common\kernel\msegui.pas ... Compiling globtypes.pas globtypes.pas(21,2) Fatal: Can't find unit mlainternaltypes used by globtypes Fatal: Compilation aborted

Would you have an idea of the problem?

Regards.

Roland

rchastain commented 5 years ago

OK, that was a stupid question. I just had to change "\home\fred\mselang\compiler" to ".\compiler". Compilation OK!

(Before that, I also had to create a "units" directory.)

What is the next step to test the compiler?

rchastain commented 5 years ago

The problem being solved, I close the discussion.

fredvs commented 5 years ago

Hello Roland.

Huh, how did you do?

Here I get error message when trying to compile for Windows (with wine). The problems come at linking (compilation seems ok).

Do you know how to do with github to make you maintainer too?

Fre;D

rchastain commented 5 years ago

Hello Fred.

I just opened the project in MSEide and compiled. :)

No, I don't know how to become maintainer.

Regards.

Roland

fredvs commented 5 years ago

Hello Roland.

Ha, perfect then it compiles for Windows too.

Did you try the mlc compiler, is it working?

For MSElang Linux I did change some code in /rtl (see commits) otherwise the compiler crashed. But maybe with the original source it works ok in Windows.

No, I don't know how to become maintainer.

OK, capito. A invitation was sent!

Fre;D

fredvs commented 5 years ago

What is the next step to test the compiler?

You may test the mlc compiler with a terminal, with same syntax parameters as fpc.

Example:

$ /home/fred/mselang/compiler/mlc -Fu/home/fred/msegui/lib/common/kernel/linux -Fu/home/fred/mselang/*/* -Fu/home/fred/mselang/* -Fu/home/fred/mselang -Fu/home/fred/msegui/lib/common/* -B hellomlc.mla

It will produce a mli file that can be run with the mli interpreter in /mselang/src/interpreter.

To produce a bc file and a executable, you may use mselang and have llvm installed.

Maybe it is possible to produce a bc file with the mlc adding a option but I did not find how.

Fre;D

rchastain commented 5 years ago

OK. I try to compile mlc. I get this error.

Free Pascal Compiler version 3.0.4 [2017/10/06] for i386 Copyright (c) 1993-2017 by Florian Klaempfl and others Target OS: Win32 for i386 Compiling mlc.pas Compiling C:\MSEide\msegui\lib\common\kernel\msenogui.pas Compiling C:\MSEide\msegui\lib\common\kernel\linux\msesysintf.pas Compiling C:\MSEide\msegui\lib\common\kernel\msesys.pas Compiling C:\MSEide\msegui\lib\common\kernel\linux\msesysintf.pas Compiling C:\MSEide\msegui\lib\common\kernel\linux\msesetlocale.pas Compiling C:\MSEide\msegui\lib\common\kernel\linux\cwstring.pas cwstring.pas(42,59) Fatal: Can't find unit unixcp used by cwstring Fatal: Compilation aborted

Looking for the solution...

rchastain commented 5 years ago

OK, I am stupid. Of course, I have to set the project options. Sorry for the noise (as you would have said). :)

rchastain commented 5 years ago

After correcting the options, another error.

Free Pascal Compiler version 3.0.4 [2017/10/06] for i386 Copyright (c) 1993-2017 by Florian Klaempfl and others Target OS: Win32 for i386 Compiling mlc.pas Compiling C:\MSEide\msegui\lib\common\kernel\msenogui.pas Compiling C:\MSEide\msegui\lib\common\kernel\msesys.pas Compiling C:\MSEide\msegui\lib\common\kernel\mseevent.pas Compiling C:\MSEide\msegui\lib\common\kernel\msethread.pas Compiling C:\MSEide\msegui\lib\common\kernel\mseapplication.pas Compiling C:\MSEide\msegui\lib\common\kernel\msesysutils.pas Compiling C:\MSEide\msegui\lib\common\kernel\msedate.pas Compiling C:\MSEide\msegui\lib\common\kernel\msepipestream.pas Compiling C:\MSEide\msegui\lib\common\sysutils\mseprocutils.pas mseprocutils.pas(600,5) Error: Identifier not found "iswin95" mseprocutils.pas(1511) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted

I will investigate.

fredvs commented 5 years ago

Hello Roland.

On Linux + wine it compiles with that parameters (note the -dmse_compiler parameter):

wine /home/fred/.wine/drive_c/FPC/3.0.4/bin/i386-win32/ppc386.exe -omlc -Fu/home/fred/msegui/lib/common/kernel/windows -Fi/home/fred/msegui/lib/common/kernel/windows -Fu/home/fred/mselangmoi/*/* -Fi/home/fred/mselangmoi/*/* -Fl/home/fred/mselangmoi/*/* -Fo/home/fred/mselangmoi/*/* -Fu/home/fred/mselangmoi/* -Fi/home/fred/mselangmoi/* -Fl/home/fred/mselangmoi/* -Fo/home/fred/mselangmoi/* -Fu/home/fred/msegui/lib/common/kernel/linux -Fi/home/fred/msegui/lib/common/kernel/linux -Fu/home/fred/msegui/lib/common/kernel -Fi/home/fred/msegui/lib/common/kernel -Fu/home/fred/msegui/lib/common/* -Fu.. -Fi.. -Fl.. -Fo.. -Fu. -Fi. -Fl. -Fo. -dmse_compiler -l -Mobjfpc -Sh -Fcutf8 -B -FUunits -O2 -XX -Xs -CX mlc.pas

But while linking there is that error:

Linking mlc
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\parserglob.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\parser.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\globtypes.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\msertti.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\listutils.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\llvmlists.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\segmentutils.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\llvmbitcodes.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\opglob.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\elementcache.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\handlerglob.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\identutils.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\elements.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\managedtypes.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\unithandler.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\classhandler.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\errorhandler.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\opcode.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\handlerutils.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\compilerunit.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\typehandler.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\rttihandler.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\stackops.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\unitglob.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\mserttiutils.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\interfacehandler.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\handler.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\subhandler.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\valuehandler.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\grammarglob.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\syssubhandler.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\llvmops.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\unitwriter.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\unitreader.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\grapas.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\gramse.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\exceptionhandler.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\filehandler.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\directivehandler.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\controlhandler.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\varhandler.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\llvmbcwriter.o
mlc.pas(11,1) Error: Illegal COFF Magic while reading Z:\home\fred\mselangmoi\units\bcunitglob.o
mlc.pas(11,1) Fatal: There were 43 errors compiling module, stopping
Fatal: Compilation aborted

Fre;D

fredvs commented 5 years ago

Re-hello Roland.

Note that mselang is independant of mlc.

So it you can compile mselang, you have the most important: the .bc bit-code file producer.

mlc compiler produce afaik only a mli file (must be interpreted).

Fre;D

fredvs commented 5 years ago

Re-re hello Roland.

OK, i did try to compile mselang with Linux + wine.

Here it was out-of-the-box.

Included Windows binary of mselang. mselang.zip

Just copy it in /mselang/src/ and it should work.

Fre;D

PS: I propose to temporally forget the mlc compiler and do the test with mselang. With mselang you may also produce a mli file (must be interpreted) so mlc compiler is not absolutely indispensable.

fredvs commented 5 years ago

Hello Roland. Ok, mlc compiles finally ok with wine. Here the win32 binary: mlc.zip

But trying mlc.exe with a simple "Hello MSElang" program, I get those errors:

MSElang Compiler version 0.0 win32 Copyright (c) 2013-2018 by Martin Schreiber. ... rtl_strings.mla(34,12) Error: Invalid utf-8 sequence rtl_strings.mla(34,12) Error: Incompatible types: got "string8" expected "dk_character" Compilation duration: 00:00:00.439. There are some errors, process failed...

It will need some (lot of) cups of coffee to resolve. Of course your flair is welcome.

Fre;D

rchastain commented 5 years ago

Hello Fred! Not had time for the project today. Thank you for the Windows binaries. In my opinion, you shouldn't worry about the fact that MSElang doesn't work. You/we need some time to study things before deciding what you/we will make of that project. Have a good night! Regards. Roland

fredvs commented 5 years ago

Hello Roland.

Included working Windows binaries of mselang.exe, mlc.exe (compiler) and mli.exe (interpreter). mselang_win.zip

Please copy mselang.exe in /mselang/src, mlc.exe in mselang/src/compiler and mli.exe in mselang/src/interpreter.

You will need the last commits of mselang code to use it.

You may first test a simple pascal "Hello World" with mslang.exe (disable llvm option to get only the .mli file) or with mlc.exe. If it produces a .mli it is bon signe.

And if you have LLVM installed, you may try to compile your demo with mslang.exe with llvm option enabled to get the executable.

Hope that it is working on Windows 10 (only tested with wine).

You/we need some time to study things before deciding what you/we will make of that project.

Of course it is the best way but, sorry, I am a impatient explorer. ;)

Fre;D

fredvs commented 5 years ago

In my opinion, you shouldn't worry about the fact that MSElang doesn't work.

Huh, I am not worry because MSElang works. ;)

mselang_windows

rchastain commented 5 years ago

Hello Fred! With your latest code, Compilation mlc: OK. Compilation mli: OK. Compilation mselang: OK. Just had to update the directories in the project options. Do you use MSEide or ideU for that project? Regards. Roland

fredvs commented 5 years ago

Hello Roland.

Excellent that all compiles ok. I use ideU because is more easy for cross/poly compilations.

You may see with previous picture that mselang.exe works with wine (Windows emulator).

But on Windows 10, that I just try now, mselang.exe run but the compilation of a simple hello world fail. I did not try mlc.exe yet on Windows 10.

On linux I work like this: With ideU I did assign with menu-Settings-Compiler mlc.exe as compiler number 2. (fpc is assigned as compiler 1.)

And now for all my projects there is in Project-Options a option that uses compiler 2 (mlc).

mlc compiler produces a mli file that can be interpreted with mli interpreter.

When all compiles ok and the mli file is correctly interpreted, I use mselang to link the bc file created to get the working executable.

I would prefer that mlc produces a bc file instead of a mli file.

bc files can be managed with clang or gcc or llvm-link to produce the executable. mli files can be interpreted but, afaik cannot be linked.

Maybe mlc.exe can produce also a bc file using a special parameter but I did not find how.

So, to resume, I use ideU + mlc to test/debug the mli file. When all is ok, I use mselang to compile + link the bc file (mselang can produce a bc file).

Fre;D

fredvs commented 5 years ago

Hello Roland.

Added mbc compiler that produces a bit-code file from the pascal file. I did not find how to add with mlc the parameters to produce a bit-code file instead of a mli file.

So I used the code of mlc and added in new source (mbc) the parameters needed to create a bit-code file. A mbc.prj was added too. Of course when we will discover what parameter to use with mlc, mbc will be removed.

To resume: There are 2 pascal compilers in /mselang/compiler/:

Fre;D

fredvs commented 5 years ago

Re-hello Roland.

Now for all projects (mselang.prj, mlc.prj, mbc.prj and mli.prj) the macro ${MSELANGDIR} is used.

You may create this global macro with mseide/ideU menu Settings-General-Macros Insert a row with right-click and set:

as name: ${MSELANGDIR} as value: c:\mselang\src (according to your system)

For each project, please set:

In Project-options tab-Make" check the tab-Directories according your Windows system.

In /mselang/src/test was added mlctest folder with a simple "Hello MSElang world" demo. If you use ideU you will need to set the compiler used (mlc.exe or mbc.exe) by the project with Project-options tab-Make - tab-Project Compiler

Maybe we can play with this "Hello MSElang world" demo at beginning and add each time more methods, step by step.

Picture of mlc.exe and mli.exe at work on Windows 10:

mlc_win10

And here picture of mbc.exe at work producing the bit-code file.

mbc_win10

I was not able to make mselang.exe work on Windows 10. But this is a detail, the most important is that the compiler work, mselang is only a tool-chain. And that will be fast fixed.

I will attack asap LLVM on Windows 10 to make the bit-code executable.

Have fun!

Fre;D

rchastain commented 5 years ago

Hello Fred!

It looks like you do giant steps. Congratulations, and sorry for not helping you very much. ASAP I will experiment with the new project settings. I have also installed LLVM and began to play with the command line for compiling simple C programs.

I continue to keep a copy of your messages. I need time to read and experiment. I would be good to make a single document which explain all.

Regards.

Roland

fredvs commented 5 years ago

Hello Roland.

Many thanks for your your enthusiasm.

About LLVM on Windows 10.

To make hellomlc.bc (created by Martin' mbc.exe) executable I use that command line:

clang.exe c:\mlctest\hellomlc.bc -o c:\mlctest\hellomlc.exe

The compilation is ok but the link fail because of (I guess) clib library equivalent for Windows was not loaded.

After (few) exploration it appears that clang.exe uses the linker of the MS Visual Studio installed. I do not have lot of experience with Visual Studio so I give it up for the moment.

But it will work, the bc file created by Martin mbc is perfectly recognized and compiled by clang.exe, only the linking done by MS VS fails.

On Linux all is working perfectly, the bc is compiled-linked out of the box with clang and work.

Fre;D

fredvs commented 5 years ago

Hello Roland.

A beautiful challenge would be to make moustique compiled by mselang.

Fre;D

fredvs commented 5 years ago

Re-hello.

Now that mselang project is working, I have to confess that I have lot of vertigo. I dont have the skill of Martin to make grow mselang along.

For example for cui (console application) writeln() is implemented in mselang but afaik readln() is not yet implemented.

And I do not have any idea now how to implement this.

Only a miracle would help: some guru's that fall in love with mselang project and give they knowledge for it.

Fre;D

fredvs commented 5 years ago

Re-...-hello.

Here some tips to make link the bit code file bc using clang.exe.

In Linux, with that command line:

$ clang hellomlc.bc -o hellomlc

There is that error:

/tmp/hellomlc-c57671.o: In function rtl_fpccompatibility.d1': /home/fred/mlctest/hellomlc.bc:(.text+0x778f): undefined reference tonearbyint' clang: error: linker command failed with exit code 1 (use -v to see invocation)

It is because a external method, nearbyint, is not found in the loaded libraries.

The method nearbyint is in the math library libm.so.

To resolve that, use the -l parameter, to link the missing library, like this on Linux (remove "lib" and ".so" from library name):

$ clang hellomlc.bc -lm -o hellomlc

For Windows, you do not need the math library, the standard math methods are handled by msvcr90.dll and loaded in the system.

But you need access to some library that handle other undefined references (if there are some). Some fast Googling said that it must be inside libstdc.dll or libgcc.dll but I did not investigate more.

Tip: With clang use the -v (verbosity) parameter, it will show what linker is used and what parameters are sent.

I have to do a break for Windows 10 so, good luck for the suite. ;) [EDITED] http://lld.llvm.org/windows_support.html

Fre;D

rchastain commented 5 years ago

Hello Fred!

Great! Thank you for that mini tutorial. I can't wait to test it. Could you share a bc file so that anyone can experiment with?

I come back to you as soon I have made a first test.

Regards.

Roland

rchastain commented 5 years ago

Sorry for the request about the bc file. I have just seen that there are many bc files in MSElang release.

fredvs commented 5 years ago

Hello Roland.

Here the hellomlc.bc demo compiled on wine with mbc.exe. hellomlc_bc.zip

Huh, did you try to compile the hellomlc.prj in /mselang/src/test/mlctest/ using mseide/ideU (and using mbc.exe as compiler) ?

You may use command line too, here the one I use on Linux and wine:

$ cd /fred/mselang/src/test/mcltest/

$ wine /home/fred/mselang/src/compiler/mbc.exe -Fu/home/fred/mselang/src/rtl/system/windows -Fu/home/fred/mselang/src/*/* -Fu/home/fred/mselang/src/* -B mse_compiler /fred/mselang/src/test/mcltest/hellomlc.mla

It should be out of the box with that result (and hellomlc.bc created):

MSElang Compiler version 0.0 win32 Copyright (c) 2013-2018 by Martin Schreiber. 5565 lines, 20 units, 0.433s total, 0.433s MSElang, 0.000s rest mlc process: OK. llvm process: OK. mbc process: OK. All process duration: 00:00:00.506. All process: OK. :)

.Fre;D

fredvs commented 5 years ago

Sorry for the request about the bc file. I have just seen that there are many bc files in MSElang release.

Yes but maybe that are not bc file of the main executable and will not be linkable.

Fre;D

fredvs commented 5 years ago

Hello Roland.

I am trying to make LLVM work on Windows via wine. With wine it is not possible to install Visual Studio and use its linker. So a other solution is to use the linker of MinGW-w32.

There is a nice explanation how to use Clang and MinGW-w32 on Windows: http://blog.johannesmp.com/2015/09/01/installing-clang-on-windows-pt2/

Here the command line that I use with wine to force clang to use MinGW-w32 ld.exe linker vs Visual Studio link.exe linker:

"C:\Program Files (x86)\LLVM\bin\clang++.exe" -O3 -v -target i686-mingw32 -L /dir/of/minGW/libraries/ -dynamic -Wall -Wextra hellomlc.bc -o hellomlc.exe

Note the -target i686-mingw32 param to force to use mingw ld.exe linker.

Parameter -L /dir/of/minGW/libraries/ ---> change this according your config.

Compilation is ok but I still have 3 undefined references to stdout, __error and strerror_r'. This must be solved using -lthelib but I did not find the library that assign those methods.

Any idea is welcome, of course. And if you was able to compile+link on Windows 10, it is even better.

Fre;D '

fredvs commented 5 years ago

Re-hello.

For Windows strerrorr does not exists, strerrors must be used (with correct assign). It was corrected in last mselang commits.

Now there are only undefined references to stdout, all others are gone .

After googling, it seems that stdout is Unix only, so a conversion must be done in MSElang-code for Windows.

I think that I have to give the hand to a Windows guru for this.

Fre;D

rchastain commented 5 years ago

Hello Fred!

Thank you for your message.

I have to install MinGW. I have already Visual Studio installed.

Regards.

Roland

fredvs commented 5 years ago

Hello Roland.

Of course if you are able to link with Visual Studio, it is perfect.

Fre;D

fredvs commented 5 years ago

Hello Roland.

Sorry to monopolize this issue. I really want to make mselang work with Windows because, after try it on Linux, I may affirm that Martin was already very far in the development.

And, IMHO, it would be a crime to forget all his work. I am sure that linking on Windows should work.

On Windows, the mli file produced by mlc.exe is perfectly interpreted by mli.exe. Using clang.exe to compile a bc file produced by mbc.exe works, but the link fail (on my wine system).

Maybe you will have more chance than me for Windows-linking (I really hope this).

Fre;D

fredvs commented 5 years ago

Re,..., hello Roland.

Maybe this workaround for Windows could be helpful.

Ok I stop before you call the police. ;)

Fre;D

rchastain commented 5 years ago

Hello Fred!

Thank you for your efforts to make MSElang usable under Windows.

OK, I will try that. I will also try the mli interpreter.

Regards.

Roland

rchastain commented 5 years ago

Compiled mlc and mli from a fresh copy of the git repository. Compiled a hello.pas with mlc and tested successfully mli with hello.mli. :)

MSElang Compiler version 0.0 Copyright (c) 2013-2018 by Martin Schreiber Target OS: i386-win32 Compiling hello.pas ... mlc process: OK Output file: hello.mli All process duration: 00:00:00.094 All process: OK :)

C:\Roland\pascal\mselang\src\compiler>..\interpreter\mli.exe C:\Roland\pascal\mselang\src\compiler\hello.mli hello

I should have tried that sooner. OK, this a beginning, a very interesting beginning. 👍

fredvs commented 5 years ago

Hello Roland.

Nice that mlc.exe + mli.exe are working in Windows 10.

Now about mbc.exe + clang++.exe.

Google-Chrome has decided to use llvm for Windows too: http://blog.llvm.org/2018/03/clang-is-now-used-to-build-chrome-for.html

So all the power of Gooogle gonna be for llvm.

Yes, llvm-Windows is new and you will be a pioneer to compile/link llvm on Windows.

But it is so promising and it is a must to have a Pascal member in LLVM community.

Fre;D

fredvs commented 5 years ago

Hello Roland.

You may try also mselang.exe (the gui tool chain). It should work on your Windows 10 system. If you do not enable "llvm" chekbox , it will create a .mli file and will interpreted it if you enable "run at end".

Use the button "Units" to add the needed units.

Fre;D

rchastain commented 5 years ago

Hello Fred!

I could compile MSElang. But when I open my hello.pas and click on "Parse", I get a " Parser error " message, and the content of hello.pas is deleted!

Regards.

Roland

fredvs commented 5 years ago

Hello Roland.

Here on Linux + wine it works. Did you add the needed path of the units? Did you click on "Load" after selecting a Pascal file?

See picture:

mselang_win

Fre;D

fredvs commented 5 years ago

Hello Roland!

Indeed, on a real Windows 10 machine mselang.exe was not working.

With last commits, it should work, see picture:

mselang_gui_win10

Note that LLVM chain is not yet working here for Windows (error at linking). Note also that mslang.exe gives less infos while compiling vs using mlc.exe or mbc.exe with a terminal.

Fre;D

rchastain commented 5 years ago

Hello Fred! Thank you for your messages. I wasn't at home today. Tomorrow I will make a test with your latest commits. Regards. Roland

fredvs commented 5 years ago

Hello Roland!

Release alpha1 is committed: https://github.com/fredvs/mselang/releases

For Linux 32 all is working, MSElang can produce working executable. Here videos of mselang at work on Linux:

mselang_atwork.zip

For Windows, producing mli and bc files is ok but the linking fails here with wine.

But you may interpreter the mli file with mli.exe.

Or easier, use mselang.exe, it should work out of the box now for Windows 10. Just download the release, unzip it, run mselang.exe, click on "Parse" (all is pre-configured).

In /mselang/test/ there are tons of examples.

Have fun (and courage).

OK, I let you in peace.

Fre;D

rchastain commented 5 years ago

Hello Fred! Thank you for alpha1. Congratulations for your work.

Result of a quick test here. "Parse" hellomselang.pas: OK. "Inter": access violation.

Please could you fix the name of the folder hellomselang?

Regards.

Roland

fredvs commented 5 years ago

Hello Roland.

OK. "Inter": access violation.

Ooops, well seen, fixed.

Please could you fix the name of the folder hellomselang?

Re-ooops, bien vu, fixed.

OK, I did delete the buged alpha1 release and added new fixed (I hope). https://github.com/fredvs/mselang/releases/tag/0.0.2

Thanks Roland.

Fre;D

rchastain commented 5 years ago

Hello Fred! Indeed, it works now. Good job! Regards. Roland

fredvs commented 5 years ago

Hello Roland! I think that here is the answer of the 'stdout' problem at linking on Windows: http://clang-developers.42468.n3.nabble.com/Clang-Windows-and-stdout-td4063613.html

So, I guess that rtl_sysintf.mla must be translated for Windows.

By the way, in just re-uploaded-release_beta1 is enabled LLVM tool-chain for Windows too: https://github.com/fredvs/mselang/releases/

Compiling with clang.exe the bc file produced by mselang should work.

For the linking maybe with Visual Studio link.exe you will have more luck. (But I think rtl_sysintf.mla must be adapted for Windows first).

If you did install LLVM from installer (not compiling by yourself) opt.exe should be missing. It is the bc optimizer and is not given by default in LLVM installer. But it is not needed to compile the original bc.

Ok, now I really stop, you may call the police.

Fre;D

rchastain commented 5 years ago

Hello Fred! Thank for the informations about LLVM. Tomorrow I go to France for a week. I won't have much time for the project. I opened a discussion about MSElang in french Pascal forum. https://www.developpez.net/forums/d1932104/autres-langages/pascal/avenir-projet-mselang/ I would like to have better described MSElang. It's just a beginning, and an invitation to potential contributors. À bientôt Fred ! Roland

fredvs commented 5 years ago

Hello Roland.

Thanks to open discussions and create interest for MSElang.

IMHO, it would be the top if somebody of Ultibo team take a look at MSElang. Re-IMHO, MSElang is perfect for them. https://ultibo.org/forum/viewtopic.php?f=12&t=1194

Bon voyage!

Fre;D