-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(compiler) Detect stdlib bundled with Perlang binaries #444
Conversation
41583d4
to
4fe53e5
Compare
FileName = "clang++", | ||
// Make this explicit, since we have only tested this with a very specific clang version. Anything else is | ||
// completely untested and not expected to work at the moment. | ||
FileName = "clang++-14", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deliberately made this a bit more strict. Let's see what error we get if you try to run this in a container without any clang-14
package installed btw...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we go. With an added catch (SystemException e)
, and re-throwing this, we get something which is good enough for now (despite being a bit overly verbose):
root@ce9d3c51d947:/perlang# /home/per/.perlang/nightly/bin/perlang docs/examples/quickstart/pi.per
Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.ApplicationException: Failed running clang. Experimental compilation is only supported on Linux-based systems. If running a Debian/Ubuntu-based distribution, please ensure that the clang-14 package is installed since experimental compilation depends on it.
---> System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'clang++-14' with working directory '/perlang'. No such file or directory
at System.Diagnostics.Process.ForkAndExecProcess(ProcessStartInfo, String, String[], String[], String, Boolean, UInt32, UInt32, UInt32[], Int32& , Int32& , Int32& , Boolean, Boolean )
at System.Diagnostics.Process.StartCore(ProcessStartInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo)
at Perlang.Interpreter.Compiler.PerlangCompiler.Compile(String source, String path, CompilerFlags compilerFlags, ScanErrorHandler scanErrorHandler, ParseErrorHandler parseErrorHandler, NameResolutionErrorHandler nameResolutionErrorHandler, ValidationErrorHandler typeValidationErrorHandler, ValidationErrorHandler immutabilityValidationErrorHandler, CompilerWarningHandler compilerWarningHandler) in /home/per/git/perlang/src/Perlang.Interpreter/Compiler/PerlangCompiler.cs:line 607
--- End of inner exception stack trace ---
at Perlang.Interpreter.Compiler.PerlangCompiler.Compile(String source, String path, CompilerFlags compilerFlags, ScanErrorHandler scanErrorHandler, ParseErrorHandler parseErrorHandler, NameResolutionErrorHandler nameResolutionErrorHandler, ValidationErrorHandler typeValidationErrorHandler, ValidationErrorHandler immutabilityValidationErrorHandler, CompilerWarningHandler compilerWarningHandler) in /home/per/git/perlang/src/Perlang.Interpreter/Compiler/PerlangCompiler.cs:line 632
at Perlang.Interpreter.Compiler.PerlangCompiler.CompileAndRun(String source, String path, CompilerFlags compilerFlags, ScanErrorHandler scanErrorHandler, ParseErrorHandler parseErrorHandler, NameResolutionErrorHandler nameResolutionErrorHandler, ValidationErrorHandler typeValidationErrorHandler, ValidationErrorHandler immutabilityValidationErrorHandler, CompilerWarningHandler compilerWarningHandler) in /home/per/git/perlang/src/Perlang.Interpreter/Compiler/PerlangCompiler.cs:line 221
at Perlang.ConsoleApp.Program.CompileAndRun(String source, String path, CompilerWarningHandler compilerWarningHandler) in /home/per/git/perlang/src/Perlang.ConsoleApp/Program.cs:line 456
at Perlang.ConsoleApp.Program.RunFile(String path) in /home/per/git/perlang/src/Perlang.ConsoleApp/Program.cs:line 344
at Perlang.ConsoleApp.Program.<>c__DisplayClass13_0.<MainWithCustomConsole>b__4(ParseResult parseResult, IConsole _) in /home/per/git/perlang/src/Perlang.ConsoleApp/Program.cs:line 249
at System.RuntimeMethodHandle.InvokeMethod(Object, Void**, Signature, Boolean)
at System.Reflection.MethodInvoker.Invoke(Object, IntPtr*, BindingFlags)
--- End of inner exception stack trace ---
at System.Reflection.MethodInvoker.Invoke(Object, IntPtr*, BindingFlags)
at System.Reflection.RuntimeMethodInfo.Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.CommandLine.NamingConventionBinder.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.NamingConventionBinder.ModelBindingCommandHandler.Invoke(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationPipeline.<Invoke>g__FullInvocationChain|3_0(InvocationContext)
at Perlang.ConsoleApp.Program.MainWithCustomConsole(String[] args, IPerlangConsole console) in /home/per/git/perlang/src/Perlang.ConsoleApp/Program.cs:line 292
at Perlang.ConsoleApp.Program.Main(String[] args) in /home/per/git/perlang/src/Perlang.ConsoleApp/Program.cs:line 108
Aborted (core dumped)
This provides some of the groundwork for this, mentioned in #406: > Distribute the (compiled) stdlib along with snapshot builds The changes to the `Makefile` means that running `make install` will now install the `stdlib` into the expected location. The next step is to get the `stdlib` bundled with releases and release snapshots as well.
4fe53e5
to
fa1b8ae
Compare
This provides some of the groundwork for this, mentioned in https://github.com/perlang-org/ perlang/issues/406:
The changes to the
Makefile
means that runningmake install
will now install thestdlib
into the expected location. The next step is to get thestdlib
bundled with releases and release snapshots as well.