Skip to content
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

run in docker #139

Closed
atrakic opened this issue Jan 4, 2024 · 3 comments
Closed

run in docker #139

atrakic opened this issue Jan 4, 2024 · 3 comments

Comments

@atrakic
Copy link

atrakic commented Jan 4, 2024

Hi,

I tried to run in docker from Mac host but I could not succeed. What I tried:

Prepare build + run env

# on Mac host:
$ mkdir -p foo
cd foo
git clone https://github.com/bflattened/bflat.git
mkdir tmp
cd tmp
$ wget -c https://github.com/bflattened/bflat/releases/download/v8.0.1/bflat-8.0.1-linux-glibc-x64.tar.gz
$ cd ..

enter docker

docker run -it  --platform linux/amd64 --rm -v .:/app -w /app debian bash

In docker from here

$  uname -m
x86_64

$ cd tmp 
$ tar xvf bflat-8.0.1-linux-glibc-x64.tar.gz$
$ cd ..
$ export LD_LIBRARY_PATH=:/app/tmp:/app/tmp/lib/linux:/usr/lib:/app/tmp/lib/uefi/x64:/app/tmp/lib
$ export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/app/tmp:/app/tmp/bin

Verify install

root@a8d2861d86ca:/app/tmp# ./bflat -v
8.0.1+ce27bc593cdbd0de5afb836c62953f0c40ae32bd

Try to build and run sample:

$ cd /app/bflat/samples/HelloWorld
$ bflat build hello.cs
No usable version of libssl was found
Aborted

Install missing package

$ apt-get install -y libssl3

Try to run again:

$ bflat build hello.cs
Error: DllNotFound_Linux, objwriter,
objwriter.so: cannot open shared object file: No such file or directory
libc++.so.1: cannot open shared object file: No such file or directory
objwriter: cannot open shared object file: No such file or directory
libobjwriter: cannot open shared object file: No such file or directory

System.DllNotFoundException: DllNotFound_Linux, objwriter,
objwriter.so: cannot open shared object file: No such file or directory
libc++.so.1: cannot open shared object file: No such file or directory
objwriter: cannot open shared object file: No such file or directory
libobjwriter: cannot open shared object file: No such file or directory

   at System.Runtime.InteropServices.NativeLibrary.LoadLibErrorTracker.Throw(String) + 0x47
   at Internal.Runtime.CompilerHelpers.InteropHelpers.FixupModuleCell(InteropHelpers.ModuleFixupCell*) + 0x127
   at Internal.Runtime.CompilerHelpers.InteropHelpers.ResolvePInvokeSlow(InteropHelpers.MethodFixupCell*) + 0x35
   at ILCompiler.DependencyAnalysis.ObjectWriter.InitObjWriter(String, String) + 0x43
   at ILCompiler.DependencyAnalysis.ObjectWriter..ctor(String, NodeFactory, ObjectWritingOptions) + 0x19a
   at ILCompiler.DependencyAnalysis.ObjectWriter.EmitObject(String, IReadOnlyCollection`1, NodeFactory, ObjectWritingOptions, IObjectDumper, Logger) + 0x8e
   at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String, ObjectDumper) + 0x32
   at BuildCommand.Handle(ParseResult) + 0x2fef
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext() + 0x139
--- End of stack trace from previous location ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x1c
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0xbe
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x4e
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext() + 0xf2
--- End of stack trace from previous location ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x1c
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0xbe
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x4e
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext() + 0xbf
--- End of stack trace from previous location ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x1c
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0xbe
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x4e
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass23_0.<<UseVersionOption>b__0>d.MoveNext() + 0x1dd
--- End of stack trace from previous location ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x1c
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0xbe
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x4e
   at System.CommandLine.Invocation.InvocationPipeline.<Invoke>g__FullInvocationChain|3_0(InvocationContext) + 0x8a
   at Program.Main(String[] args) + 0x2b4

What else do I miss?

@MichalStrehovsky
Copy link
Member

I think it's missing libc++. Try installing libc++1 package.

@lucabol
Copy link
Contributor

lucabol commented Jan 12, 2024

fyi I had the same issue on Ubuntu 22.04 under WSL2 and fixed it with:

sudo apt-get -y install libc++1

Perhaps you want to doc this as people are likely to try it in this configuration.

@MichalStrehovsky
Copy link
Member

Thanks for verifying. Yep, should doc this.

Luckily upstream is getting rid of objwriter.so, and also the transitive libc++ dependency for .NET 9 so this will soon be past.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants