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

Add support for FreeBSD/aarch64 #6373

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@myfreeweb
Contributor

myfreeweb commented Jul 12, 2018

Yes, it's just a symlink to the amd64 folder. It Just Worked™.

Compiler binary for FreeBSD 12: https://unrelentingtech.s3.dualstack.eu-west-1.amazonaws.com/crystal/crystal-0.25.1-freebsd12.0-aarch64

Works great with LLVM 5.0.2. LLVM 6.0.1 results in assertion failures:

Assertion failed: (cast<DISubprogram>(Scope)->describes(&MF->getFunction())), function getOrCreateRegularScope, file /wrkdirs/usr/ports/devel/llvm60/work/llvm-6.0.1.src/lib/CodeGen/LexicalScopes.cpp, line 176.
Assertion failed: (SizeInBits != 0 && "invalid zero-sized type"), function getLLTForType, file /wrkdirs/usr/ports/devel/llvm60/work/llvm-6.0.1.src/lib/CodeGen/LowLevelType.cpp, line 34.
Assertion failed: (Index + MRI->getType(Res).getSizeInBits() <= MRI->getType(Src).getSizeInBits() && "extracting off end of register"), function buildExtract, file /wrkdirs/usr/ports/devel/llvm60/work/llvm-6.0.1.src/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp, line 409.

On amd64, these don't appear.

Also, some spec failures:

  1) File symlink? gives true
     Failure/Error: File.symlink?(datapath("symlink.txt")).should be_true

       Expected: true
            got: false

     # spec/std/file_spec.cr:255

  2) File gets info for a symlink
     Failure/Error: info.type.should eq(File::Type::Symlink)

       Expected: Symlink
            got: File

     # spec/std/file_spec.cr:405

  3) String encode raises if illegal byte sequence
     Failure/Error: expect_raises ArgumentError, "Invalid multibyte sequence" do

       Expected ArgumentError but nothing was raised

     # spec/std/string_spec.cr:2298

  4) IO encoding decode says invalid byte sequence
     Failure/Error: expect_raises ArgumentError, "Invalid multibyte sequence" do

       Expected ArgumentError with "Invalid multibyte sequence", got #<ArgumentError: Incomplete multibyte sequence> with backtrace:
         # Iconv#handle_invalid<Pointer(Pointer(UInt8)), Pointer(UInt64)>:(UInt64 | Nil)
         # IO::Decoder#read</usr/home/greg/crystal/spec/std/io/io_spec.cr::SimpleIOMemory>:Nil
         # IO::Decoder#read_byte</usr/home/greg/crystal/spec/std/io/io_spec.cr::SimpleIOMemory>:(UInt8 | Nil)
         # /usr/home/greg/crystal/spec/std/io/io_spec.cr::SimpleIOMemory
         # /usr/home/greg/crystal/spec/std/io/io_spec.cr::SimpleIOMemory
         # /usr/home/greg/crystal/spec/std/io/io_spec.cr::SimpleIOMemory
         # /usr/home/greg/crystal/spec/std/io/io_spec.cr::SimpleIOMemory
         # ~procProc(Nil)
         # it<String, String, Int32, Int32, &Proc(Nil)>:(Array(Spec::Result) | Nil)
         # ~procProc(Nil)
         # Spec::RootContext::describe<String, String, Int32, &Proc(Nil)>:Spec::Context+
         # describe<String, String, Int32, &Proc(Nil)>:Spec::Context+
         # ~procProc(Nil)
         # Spec::RootContext::describe<String, String, Int32, &Proc(Nil)>:Spec::Context+
         # describe<String, String, Int32, &Proc(Nil)>:Spec::Context+
         # ~procProc(Nil)
         # Spec::RootContext::describe<String, String, Int32, &Proc(Nil)>:Spec::Context+
         # describe<IO:Class, String, Int32, &Proc(Nil)>:Spec::Context+
         # __crystal_main
         # Crystal::main_user_code<Int32, Pointer(Pointer(UInt8))>:Nil
         # Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32
         # main

     # spec/std/io/io_spec.cr:659

  5) IO encoding encode raises on invalid byte sequence
     Failure/Error: expect_raises ArgumentError, "Invalid multibyte sequence" do

       Expected ArgumentError but nothing was raised

     # spec/std/io/io_spec.cr:821

  6) Time::Location .load_local
     Failure/Error: Location.load_local.name.should eq "Local"

       Expected: "Local"
            got: "UTC"

     # spec/std/time/location_spec.cr:166

Finished in 1:08 minutes
13906 examples, 6 failures, 0 errors, 14 pending

Failed examples:

crystal spec spec/std/file_spec.cr:254 # File symlink? gives true
crystal spec spec/std/file_spec.cr:403 # File gets info for a symlink
crystal spec spec/std/string_spec.cr:2297 # String encode raises if illegal byte sequence
crystal spec spec/std/io/io_spec.cr:656 # IO encoding decode says invalid byte sequence
crystal spec spec/std/io/io_spec.cr:818 # IO encoding encode raises on invalid byte sequence
crystal spec spec/std/time/location_spec.cr:164 # Time::Location .load_local

They don't look very aarch64 related. I never ran spec on amd64 though…

Add support for FreeBSD/aarch64
Yes, it's just a symlink to the amd64 folder.
It Just Worked™.
@ysbaddaden

This comment has been minimized.

Show comment
Hide comment
@ysbaddaden

ysbaddaden Jul 18, 2018

Member

Thanks!

About LLVM errors, I'm afraid you'll have to dig to understand where they come from. Maybe we have an issue with Crystal+LLVM6 on AArch64 😢

About spec failures:

  1. maybe a wrong value for LibC::S_IFLNK? Or the issue was caused by the File::Stats to File::Info change?
  2. ditto;
  3. depending on iconv library maybe we can't detect all issues, or FreeBSD needs a specific check (see https://github.com/crystal-lang/crystal/issues?utf8=%E2%9C%93&q=iconv+freebsd);
  4. probably the iconv/errno message is different on FreeBSD that what the spec expects;
  5. same as 3.
  6. maybe we fail to find tzdata files (see https://github.com/crystal-lang/crystal/blob/master/src/crystal/system/unix/time.cr) or related to TZ environment variable.

It would be interesting to see which specs also fail on x86_64-freebsd12.

Member

ysbaddaden commented Jul 18, 2018

Thanks!

About LLVM errors, I'm afraid you'll have to dig to understand where they come from. Maybe we have an issue with Crystal+LLVM6 on AArch64 😢

About spec failures:

  1. maybe a wrong value for LibC::S_IFLNK? Or the issue was caused by the File::Stats to File::Info change?
  2. ditto;
  3. depending on iconv library maybe we can't detect all issues, or FreeBSD needs a specific check (see https://github.com/crystal-lang/crystal/issues?utf8=%E2%9C%93&q=iconv+freebsd);
  4. probably the iconv/errno message is different on FreeBSD that what the spec expects;
  5. same as 3.
  6. maybe we fail to find tzdata files (see https://github.com/crystal-lang/crystal/blob/master/src/crystal/system/unix/time.cr) or related to TZ environment variable.

It would be interesting to see which specs also fail on x86_64-freebsd12.

@straight-shoota

This comment has been minimized.

Show comment
Hide comment
@straight-shoota

straight-shoota Jul 18, 2018

Contributor

No 6 is either an issue with environment variables (nil interpreted as "") or the platform-specific Crystal::System::Time.load_localtime (i.e. loading /etc/localtime).

For debugging, just add the following expression before the failing spec line:

pp ENV["TZ"]?, Crystal::System::Time.load_localtime
Contributor

straight-shoota commented Jul 18, 2018

No 6 is either an issue with environment variables (nil interpreted as "") or the platform-specific Crystal::System::Time.load_localtime (i.e. loading /etc/localtime).

For debugging, just add the following expression before the failing spec line:

pp ENV["TZ"]?, Crystal::System::Time.load_localtime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment