Thread overview
Building i386 D runtime on OS X
Sep 24
teverett
Sep 25
teverett
September 24

Hello, I am following the instructions here:

https://wiki.dlang.org/Building_LDC_runtime_libraries

I'm on OSX and need a ELF D RTL for i386.

I've used HomeBrew to install x86_64-elf-gcc, ninja and cmake. The command I'm issuing is:

CC=/usr/local/Cellar/x86_64-elf-gcc/12.2.0/bin/x86_64-elf-gcc ldc-build-runtime --ninja --dFlags="-mtriple=i386-none-elf"

I'm getting the below result. Is there a known way to get past the search_paths issue? Or perhaps a better way to build the i386 elf RT on OS X?

> CC=/usr/local/Cellar/x86_64-elf-gcc/12.2.0/bin/x86_64-elf-gcc ldc-build-runtime --ninja --dFlags="-mtriple=i386-none-elf"
.: Creating build directory: ldc-build-runtime.tmp
.: Downloading LDC source archive: https://github.com/ldc-developers/ldc/releases/download/v1.30.0/ldc-1.30.0-src.zip
.: Invoking: cmake -DLDC_EXE_FULL=/usr/local/Cellar/ldc/1.30.0_1/bin/ldc2 -DDMDFE_MINOR_VERSION=100 -DDMDFE_PATCH_VERSION=1 -DD_EXTRA_FLAGS=-mtriple=i386-none-elf -G Ninja /Users/tom/projects/ados/src/ldc-build-runtime.tmp/ldc-src/runtime
-- The C compiler identification is GNU 12.2.0
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - no
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /usr/local/Cellar/x86_64-elf-gcc/12.2.0/bin/x86_64-elf-gcc
-- Check for working C compiler: /usr/local/Cellar/x86_64-elf-gcc/12.2.0/bin/x86_64-elf-gcc - broken
CMake Error at /usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/usr/local/Cellar/x86_64-elf-gcc/12.2.0/bin/x86_64-elf-gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/tom/projects/ados/src/ldc-build-runtime.tmp/CMakeFiles/CMakeTmp

    Run Build Command(s):/usr/local/bin/ninja cmTC_75803 && [1/2] Building C object CMakeFiles/cmTC_75803.dir/testCCompiler.c.o
    [2/2] Linking C executable cmTC_75803
    FAILED: cmTC_75803
    : && /usr/local/Cellar/x86_64-elf-gcc/12.2.0/bin/x86_64-elf-gcc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/usr/local/opt/libpq/lib CMakeFiles/cmTC_75803.dir/testCCompiler.c.o -o cmTC_75803   && :
    /usr/local/opt/x86_64-elf-binutils/bin/x86_64-elf-ld: Error: unable to disambiguate: -search_paths_first (did you mean --search_paths_first ?)
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)

-- Configuring incomplete, errors occurred!
See also "/Users/tom/projects/ados/src/ldc-build-runtime.tmp/CMakeFiles/CMakeOutput.log".
See also "/Users/tom/projects/ados/src/ldc-build-runtime.tmp/CMakeFiles/CMakeError.log".
.: Error: command failed with status 1

September 25

On Saturday, 24 September 2022 at 23:05:28 UTC, teverett wrote:

>

Hello, I am following the instructions here:

https://wiki.dlang.org/Building_LDC_runtime_libraries

I'm on OSX and need a ELF D RTL for i386.

I've used HomeBrew to install x86_64-elf-gcc, ninja and cmake. The command I'm issuing is:

CC=/usr/local/Cellar/x86_64-elf-gcc/12.2.0/bin/x86_64-elf-gcc ldc-build-runtime --ninja --dFlags="-mtriple=i386-none-elf"

Hi,

I assume that this is for the ldc group instead of gdc.

Generically, building druntime should be fine, you'll need a sufficiently old enough version of osx to run 32-bit binaries - I forget when they dropped multilib support, around 10.9? - which means that there might be some missing symbols reported when building Phobos (posix_memalign might be one).

September 25

On Sunday, 25 September 2022 at 06:03:32 UTC, Iain Buclaw wrote:

>

On Saturday, 24 September 2022 at 23:05:28 UTC, teverett wrote:

>

[...]

Hi,

I assume that this is for the ldc group instead of gdc.

Generically, building druntime should be fine, you'll need a sufficiently old enough version of osx to run 32-bit binaries - I forget when they dropped multilib support, around 10.9? - which means that there might be some missing symbols reported when building Phobos (posix_memalign might be one).

oh, thank you for your reply. I'll repost to the LDC group.