Skip to content

Allow building on FreeBSD/i386 #114705

Open
Open

Description

@UnitedMarsupials

Generally, I don't think, explicitly prohibiting build on a platform is wise. If it fails -- it fails, but it should not be prevented from trying...

In particular, the below patch allows build to be attempted on FreeBSD/i386 -- setting the already used CLR_CMAKE_HOST_UNIX_X86:

--- eng/native/configureplatform.cmake	2025-03-13 17:40:22.000000000 -0400
+++ eng/native/configureplatform.cmake	2025-04-15 11:53:10.858273000 -0400
@@ -168,4 +168,6 @@
     elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm64)
         set(CLR_CMAKE_HOST_UNIX_ARM64 1)
+    elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i386)
+        set(CLR_CMAKE_HOST_UNIX_X86 1)
     else()
         clr_unknown_arch()
--- eng/native/configurecompiler.cmake	2025-03-13 17:40:22.000000000 -0400
+++ eng/native/configurecompiler.cmake	2025-04-15 11:55:26.890280000 -0400
@@ -429,4 +429,6 @@
     elseif(CLR_CMAKE_HOST_UNIX_AMD64)
       message("Detected FreeBSD amd64")
+    elseif(CLR_CMAKE_HOST_UNIX_X86)
+      message("Detected FreeBSD i386")
     else()
       message(FATAL_ERROR "Unsupported FreeBSD architecture")

With the above changes, I was able to build the dotnet-executable on my FreeBSD-14/i386 here using the lang/dotnet-host port.

Maybe, if this is merged, the boostrap binaries -- which our lang/dotnet port is using -- will eventually appear.

Activity

  1. ghost added
    needs-area-label
    on Apr 15, 2025
  2. added
    untriaged
    on Apr 15, 2025
  3. added
    os-freebsd
    and removed
    needs-area-label
    on Apr 15, 2025
  4. dotnet-policy-service commented on Apr 15, 2025

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/area-meta
    See info in area-owners.md if you want to be subscribed.

  5. am11 commented on Apr 15, 2025

    @am11
    Member

    I think nobody would have any objection for a new platform port, my experience is they are always welcome. You could try adding freebsd-x86 and freebsd-riscv64 next to linux- variants. Feel free to send PRs. 👍

    Generally, I don't think, explicitly prohibiting build on a platform is wise. If it fails -- it fails,

    This opt-in setup is to ensure someone has tried to build on the platform, maintainers and other community members have reviewed the changes and there is a list of tasks somewhere to track progress. .NET ports are not simple and getting things working end-to-end takes some time. Also, diagnostics is an important part; PlatformNotSupportedException and the likes are there to communicate with user which APIs are not available.

    cc @arrowd, @Thefrank, @sec

  6. UnitedMarsupials commented on Apr 15, 2025

    @UnitedMarsupials
    Author

    This opt-in setup is to ensure someone has tried to build on the platform

    Then, maybe, detecting a new platform should yield a warning -- but it should not be an error...

  7. Thefrank commented on Apr 15, 2025

    @Thefrank
    Contributor

    From the FreeBSD side, there is still signaling that i386 will no longer be supported starting with FreeBSD 15 but the document is more than a year old (https://www.freebsd.org/platforms/). MIPS and PPC 32bit have already been removed from support on FreeBSD.

    New platforms for dotnet are always nice! Tests on the other hand, are the harder part. It is up to you to make sure everything is functioning correct and AFAIK source-build does not build/run tests but @arrowd or @sec might have a better idea as they use source-build more than I do.

  8. sec commented on Apr 16, 2025

    @sec
    Contributor

    @UnitedMarsupials you're welcome to open PR with those changes, if those unblock build on i386.
    but also as @Thefrank already said, i386 support is phased out - may I ask are you still using some i386 hardware and/or dotnet software on it? :)

  9. UnitedMarsupials commented on Apr 17, 2025

    @UnitedMarsupials
    Author

    @UnitedMarsupials you're welcome to open PR with those changes

    Do you really need a formal merge-request for such a trivial patch?

    already said, i386 support is phased out - may I ask are you still using some i386 hardware and/or dotnet software on it? :)

    I don't think, that's been settled -- I sure hope, not. 32-bit MIPS and PPC may not be valuable, but i386 is FreeBSD's (and Linux', for that matter) very first and original hardware platform and remains useful for smaller VMs, where 4Gb of addressable memory is quite sufficient and there is no need to waste RAM on wide pointers...

    I submitted this patch to the maintainers of FreeBSD port, but they want bootstrap binaries to become available for FreeBSD before merging it...

  10. Thefrank commented on Apr 18, 2025

    @Thefrank
    Contributor

    I submitted this patch to the maintainers of FreeBSD port, but they want bootstrap binaries to become available for FreeBSD before merging it...

    The bootstrap is something that you will have to build. For now, FreeBSD is a community supported platform for dotnet so you will not get official binaries from Microsoft.

  11. removed
    untriaged
    on Jul 23, 2025
  12. added this to the Future milestone on Jul 23, 2025
  13. kdenv2604 commented on Nov 25, 2026

    @kdenv2604

    Hi! I have a working .NET 10 CoreCLR port for FreeBSD i386: kdenv2604#1. The draft includes validation on FreeBSD 14 i386, including managed workloads and PAL tests.

    I understand from #138083 that enabling a new OS/architecture combination does not meet the bar for release branches. The port relies on Unix x86 CoreCLR code removed from main in #137008.

    Given that, is there another upstream path you would recommend for FreeBSD i386, or would maintaining the port as a community fork be the appropriate approach? Any guidance on a sustainable maintenance path would be appreciated.

  14. arrowd commented on Nov 25, 2026

    @arrowd
    Contributor

    FreeBSD is sunsetting the 32 bit arches support, so I think a separate fork is your only option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions