ldc-developers / ldc2.snap

Snap package definition for LDC, the LLVM-based D compiler
11 stars 4 forks source link

Replace ldc-bootstrap part with build-snaps #75

Closed WebDrake closed 5 years ago

WebDrake commented 5 years ago

LDC v1.12.0+ supports LLVM 7, but v0.17.6 does not. This means that to build more recent LDC releases with the latest LLVM we will either need to build multiple LLVMs (!) or change the bootstrap compiler.

With build-snaps now a robust feature, this seems a good moment to tweak the snap definition to use it, so that from here on out each release of the snap package will be built with the previous compiler version.

kinke commented 5 years ago

The additional intermediate compiler I suggested would make sure the snap packages are more similar to the official prebuilt packages and benefit from all improvements of that new version themselves. E.g., for v1.15, the memory consumption with -lowmem is expected to drop by up to ~18% if compiled with v1.15, compared to older host compilers, due to important improvements in 2.085 druntime.

WebDrake commented 5 years ago

The problem with that approach is that the official downloads don't include i386 (which the snap package does support). It's likely easier to use build-snaps as a dependency like this, then update to use the same version as soon as one such release exists.

kinke commented 5 years ago

I meant the intermediate compiler, i.e., using the previous snap one to build a first preliminary version (no multilib, no shared libs, no LTO etc., no tests), and then use that one for the final build. It's just a matter of invoking CMake (with slightly different variables, the most important being D_COMPILER, others just to prevent unused shared libs, LTO libs etc.) and ninja twice for the same src tarball. See the CircleCI scripts.

WebDrake commented 5 years ago

Ah, so you mean rework ldc-bootstrap to be the same compiler version as the release, but build it using a pre-existing LDC? We might even be able to having a snap package dependency in that case: we could e.g. use the ldc deb package to build the bootstrap.

WebDrake commented 5 years ago

So, I'm trying the alternative bootstrap approach, and getting this build error:

cmake /root/build_ldc2/parts/ldc-bootstrap/src -DCMAKE_INSTALL_PREFIX= -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DD_COMPILER=/snap/bin/ldmd2 \ -DLLVM_ROOT_DIR=../../llvm/install -GNinja
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler using: Ninja
-- Check for working CXX compiler using: Ninja -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found host D compiler /snap/bin/ldmd2, with default flags ' \'
-- Host D compiler ID: LDMD
-- Host D compiler version: LDC - the LLVM D compiler (1.10.0)
-- Host D compiler front-end version: 2080
-- Found LLVM: /root/build_ldc2/parts/llvm/install (found suitable version "6.0.1", minimum required is "3.7") 
-- LDC version identifier: 1.11.0
-- Building LDC with dynamic compilation support: True (LDC_DYNAMIC_COMPILE=True)
-- Looking for C++ include lld/Common/Driver.h
-- Looking for C++ include lld/Common/Driver.h - found
-- Building LDC with integrated LLD: ON (LDC_WITH_LLD=ON)
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Looking for setupterm in tinfo
-- Looking for setupterm in tinfo - found
-- Performing Test LINKER_ACCEPTS_EXPORT_DYNAMIC_FLAG
-- Performing Test LINKER_ACCEPTS_EXPORT_DYNAMIC_FLAG - Success
-- Building LDC with plugin support: ON (LDC_ENABLE_PLUGINS=ON)
Error: module ` -wi` is in file ' -wi.d' which cannot be read
import path[0] = /root/build_ldc2/parts/ldc-bootstrap/src
import path[1] = /root/build_ldc2/parts/ldc-bootstrap/build
import path[2] = /snap/ldc2/95/bin/../include/d/ldc
import path[3] = /snap/ldc2/95/bin/../include/d
CMake Error at cmake/Modules/ExtractDMDSystemLinker.cmake:40 (message):
  Failed to compile empty program using D compiler '/snap/bin/ldmd2'
Call Stack (most recent call first):
  CMakeLists.txt:644 (include)

-- Configuring incomplete, errors occurred!
See also "/root/build_ldc2/parts/ldc-bootstrap/build/CMakeFiles/CMakeOutput.log".
Failed to run 'cmake /root/build_ldc2/parts/ldc-bootstrap/src -DCMAKE_INSTALL_PREFIX= -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DD_COMPILER=/snap/bin/ldmd2 \\ -DLLVM_ROOT_DIR=../../llvm/install -GNinja' for 'ldc-bootstrap': Exited with code 1.
Verify that the part is using the correct parameters and try again.

... any ideas what's wrong? I notice there are some settings defaulting to ON that maybe I should disable?

WebDrake commented 5 years ago

I think it may be a typo in how the D compiler is declared. Checking right now.

kinke commented 5 years ago

Found host D compiler /snap/bin/ldmd2, with default flags ' \'

That's odd, it normally looks like

Found host D compiler /home/vsts/work/1/host-ldc/bin/ldmd2, with default flags ''

WebDrake commented 5 years ago

Closing as superseded by https://github.com/ldc-developers/ldc2.snap/pull/76.

WebDrake commented 5 years ago

That's odd, it normally looks like

There was a copy-paste typo, I'd accidentally placed a trailing \ where there should not have been one ;-)