[oi-dev] problems publishing rust

Friedrich Kink friedrich.kink at fkink.de
Sun Jun 19 09:05:48 UTC 2022


Thanks a lot for your response. Let me give some more information. This 
patch helped me to over come your issue:

--- rustc-1.61.0-src/src/bootstrap/builder.rs   2022-05-18 
03:29:36.000000000 +0000
+++ rustc-1.61.0-src/src/bootstrap/builder.rs.new 2022-06-06 
21:25:45.179276851 +0000
@@ -1304,7 +1304,7 @@
                  Some("-Wl,-rpath, at loader_path/../lib")
              } else if !target.contains("windows") {
                  rustflags.arg("-Clink-args=-Wl,-z,origin");
-                Some("-Wl,-rpath,$ORIGIN/../lib")
+               Some("-Wl,-rpath,/usr/clang/13.0/lib")
              } else {
                  None
              };

Also I already use rustup (as suggested by Joshua, too) and this is my 
current Makefile (as metioned it gets compiled and installed but make 
REQUIRED_PACKAGES|publish stops immediately):

BUILD_BITS=             64
USE_OPENSSL11=          yes

include ../../../make-rules/shared-macros.mk

COMPONENT_NAME=         rustc
COMPONENT_VERSION=      1.61.0
COMPONENT_FMRI=         developer/lang/rustc
COMPONENT_SUMMARY=      Rust - Safe, concurrent, practical language
COMPONENT_CLASSIFICATION=       Development/Other Languages
COMPONENT_PROJECT_URL=  http://www.rust-lang.org
COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)-src
COMPONENT_ARCHIVE=      $(COMPONENT_SRC).tar.gz
COMPONENT_ARCHIVE_HASH= 
sha256:ad0b4351675aa9abdf4c7e066613bd274c4391c5506db152983426376101daed
COMPONENT_ARCHIVE_URL= 
https://static.rust-lang.org/dist/$(COMPONENT_ARCHIVE)
COMPONENT_LICENSE=      MIT or Apache-2.0
COMPONENT_LICENSE_FILE= LICENSE-APACHE

RUST_BOOTSTRAP_PATH=    $(BUILD_DIR)/$(MACH64)
#RUST_ARCH=             x86_64-sun-solaris

include $(WS_MAKE_RULES)/common.mk

# GCC_VERSION =  7

# Put the bits cargo downloads in a private directory.  This could be cached
# somewhere more permanent, but it's important to make sure that a person's
# $HOME/.cargo isn't used.
RUST_VERSION=           $(COMPONENT_VERSION)
RUSTUP_HOME=            $(BUILD_DIR)/$(MACH64)
CARGO_HOME=             $(BUILD_DIR)/$(MACH64)

PATH= $(CARGO_HOME)/bin:$(GCC_BINDIR):$(PATH.gnu)

#  workaround the symlink name lenght 100 problem, but hope it is not 
neccessary with
# but also with patch src_tools_rust-installer_src_generator.rs.patch
COMPONENT_BUILD_ENV+=   CARGO_HOME=$(CARGO_HOME)
COMPONENT_INSTALL_ENV+= CARGO_HOME=$(CARGO_HOME)
COMPONENT_TEST_ENV+=    CARGO_HOME=$(CARGO_HOME)
COMPONENT_BUILD_ENV+=   RUSTUP_HOME=$(RUSTUP_HOME)
COMPONENT_INSTALL_ENV+= RUSTUP_HOME=$(RUSTUP_HOME)
COMPONENT_TEST_ENV+=    RUSTUP_HOME=$(RUSTUP_HOME)
#       $(COMPONENT_DIR)/files/sym2hard.py; \

COMPONENT_PRE_CONFIGURE_ACTION += ( \
         $(CLONEY) $(SOURCE_DIR) $(@D); \
         cd $(@D); \
         export RUSTUP_HOME=$(RUSTUP_HOME); \
         export CARGO_HOME=$(CARGO_HOME); \
         export RUSTUP_INIT_SKIP_PATH_CHECK=yes; \
         curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh 
-s -- --no-modify-path --default-toolchain stable -y; \
         source $(CARGO_HOME)/env; \
         rustup install stable; \
         rustup default stable; \
         rustup show; \
         cargo install --root=$(CARGO_HOME) cbindgen; \
         );

PYTHON_VERSION=         3.9

# Need some help to pick the correct ar binary
GNUAR=$(GNUBIN)/ar
# getpwuid_r failure
CXXFLAGS += -D_POSIX_PTHREAD_SEMANTICS
CFLAGS += -D_POSIX_PTHREAD_SEMANTICS

# Add arch triplet to pkg macros
#PKG_MACROS+= RUST_ARCH="$(RUST_ARCH)"

# Rust expects the library path to be /usr/lib and is broken otherwise
RUSTC_LIBDIR= $(USRLIBDIR)
CLANG_ROOT= /usr/clang/13.0

CONFIGURE_OPTIONS = --prefix=$(CONFIGURE_PREFIX)
CONFIGURE_OPTIONS += --mandir=$(CONFIGURE_MANDIR)
CONFIGURE_OPTIONS += --bindir=$(CONFIGURE_BINDIR.$(BITS))
CONFIGURE_OPTIONS += --libdir=$(RUSTC_LIBDIR)
CONFIGURE_OPTIONS += --docdir=$(USRSHAREDOCDIR)/rust-$(COMPONENT_VERSION)
CONFIGURE_OPTIONS += --datadir=$(USRSHAREDIR)
CONFIGURE_OPTIONS += --sysconfdir=$(ETCDIR)
CONFIGURE_OPTIONS += --local-rust-root=$(RUST_BOOTSTRAP_PATH)
CONFIGURE_OPTIONS += --enable-extended       # Build and install cargo too.
CONFIGURE_OPTIONS += --default-linker=$(CC)
CONFIGURE_OPTIONS += --set rust.default-linker=$(CC)
CONFIGURE_OPTIONS += --enable-rpath
CONFIGURE_OPTIONS += --disable-codegen-tests
CONFIGURE_OPTIONS += --disable-dist-src
CONFIGURE_OPTIONS += --disable-llvm-static-stdcpp
CONFIGURE_OPTIONS += --enable-ninja
CONFIGURE_OPTIONS += --enable-vendor
CONFIGURE_OPTIONS += --disable-docs
CONFIGURE_OPTIONS += --disable-compiler-docs
CONFIGURE_OPTIONS += --release-channel=stable
CONFIGURE_OPTIONS += --python=$(PYTHON)
CONFIGURE_OPTIONS += --enable-llvm-link-shared
CONFIGURE_OPTIONS += --llvm-root=$(CLANG_ROOT)

COMPONENT_PRE_BUILD_ACTION=     rustup default stable;

# Cleanup standard environment!
COMPONENT_BUILD_ENV =
COMPONENT_BUILD_ENV += CC=$(CC)
COMPONENT_BUILD_ENV += CFLAGS="$(CFLAGS)"
COMPONENT_BUILD_ENV += LDFLAGS="-L$(OPENSSL_PREFIX)/lib/$(MACH64) -lssl 
-lcrypto"
COMPONENT_BUILD_ENV += CXX=$(CXX)
COMPONENT_BUILD_ENV += CPPFLAGS="-I$(OPENSSL_PREFIX)/include"
COMPONENT_BUILD_ENV += CXXFLAGS="$(CXXFLAGS)"
COMPONENT_BUILD_ENV += AR=$(GNUAR)
COMPONENT_BUILD_ENV += RUSTC=$(CARGO_HOME)/bin/rustc
# Enforce linker consistency
COMPONENT_BUILD_ENV += RUSTFLAGS="-C linker=$(CC)"
COMPONENT_BUILD_ENV += RUST_BACKTRACE=1

GMAKE = $(PYTHON)
COMPONENT_BUILD_GMAKE_ARGS =
COMPONENT_BUILD_TARGETS = build
COMPONENT_BUILD_ARGS = ./x.py -vv

COMPONENT_INSTALL_ARGS = ./x.py
# Cleanup standard environment
COMPONENT_INSTALL_ENV =
COMPONENT_INSTALL_ENV += $(COMPONENT_BUILD_ENV)
# Set install path
COMPONENT_INSTALL_ENV += DESTDIR=$(PROTO_DIR)

COMPONENT_PRE_INSTALL_ACTION = mkdir -p $(PROTO_DIR)

RUSTC_BIN_POST = cargo
RUSTC_BIN_POST+= clippy-driver
RUSTC_BIN_POST+= rls
RUSTC_BIN_POST+= rustc
RUSTC_BIN_POST+= rustdoc

#RUSTC_DRIVER_HASH=637b1017ef7a0c2f
# Create symlinks in place of copies to generate proper link actions
# Edit runpath so that libraries are resolved both in the proto area and 
system-wide
#COMPONENT_POST_INSTALL_ACTION= \
   ( $(RM) $(PROTOUSRLIBDIR)/*.so; \
     $(MKDIR) $(PROTOUSRLIBDIR.$(BITS)); \
     $(RM) $(PROTOUSRLIBDIR.$(BITS))/*.so; \
     cd $(PROTOUSRLIBDIR.$(BITS)); \
     $(LN) -s ../rustlib/$(RUST_ARCH)/lib/*.so .; \
     for file in $(RUSTC_BIN_POST); \
     do \
       /usr/bin/elfedit -e \
         'dyn:value -s  RUNPATH 
"$(GCC_LIBDIR):$$ORIGIN/../lib/rustlib/$(RUST_ARCH)/lib:$$ORIGIN/../lib/$(MACH64)"' 
\
         $(PROTOUSRBINDIR)/$$file ; \
       /usr/bin/elfedit -e \
         'dyn:value -s  RPATH 
"$(GCC_LIBDIR):$$ORIGIN/../lib/rustlib/$(RUST_ARCH)/lib:$$ORIGIN/../lib/$(MACH64)"' 
\
         $(PROTOUSRBINDIR)/$$file ; \
     done; \
     for file in $(PROTOUSRLIBDIR)/rustlib/$(RUST_ARCH)/lib/*.so; \
     do \
       /usr/bin/elfedit -e 'dyn:value -s  RUNPATH 
"$(GCC_LIBDIR):$$ORIGIN:$$ORIGIN/../../$(MACH64)"' $$file ; \
       /usr/bin/elfedit -e 'dyn:value -s  RPATH 
"$(GCC_LIBDIR):$$ORIGIN:$$ORIGIN/../../$(MACH64)"' $$file ; \
     done; \
   )

# Build dependencies (make sure completions are installed)
REQUIRED_PACKAGES += utility/bash-completion
REQUIRED_PACKAGES += $(GCC_RUNTIME_PKG)
REQUIRED_PACKAGES += $(GXX_RUNTIME_PKG)
REQUIRED_PACKAGES += developer/clang-13
REQUIRED_PACKAGES += library/libssh2
REQUIRED_PACKAGES += library/http-parser
# Auto-generated dependencies
REQUIRED_PACKAGES += library/security/openssl-11
REQUIRED_PACKAGES += library/zlib
REQUIRED_PACKAGES += SUNWcs
REQUIRED_PACKAGES += system/library
REQUIRED_PACKAGES += system/library/math
REQUIRED_PACKAGES += web/curl

Am 18.06.2022 um 19:31 schrieb Gary Mills:
> On Sat, Jun 18, 2022 at 03:49:33PM +0200, Friedrich Kink via oi-dev wrote:
>> I try to prepare new rustc package with current version 1.61.0. So far
>> building and installing is already working. But publishing respectively make
>> REQUIRED_PACKAGES immediately bails out with the following error message:
> [...]
>> truss shows that make REQUIRED_PACKAGE really tries to open the file
>> /usr/share/src/myoi-userland/components/developer/rust/RESOLVE_DEPS= Any
>> idea what goes wrong here? To simplify things I just used sample manifest
>> p5m file to exclude home made errors.
> First of all, I'm pleased that somebody else is working on rust: I
> thought I was the only one.
>
> I anticipated that the upgrade would be difficult, but it's essential
> to upgrade any packages that still use clang-90 .  Rust is one of
> these.  Consequently, I did the upgrade by stages.  The first stage
> was to build and publish the original rust package with no change.Thanks a
> I found I had to make one change: COMPONENT_PRE_CONFIGURE_ACTION
> had to copy files, instead of creating symlinks or hard links.  Then,
> build and publish were successful
>
> Subsequent stages were to upgrade clang, to upgrade python, and to
> convert the Makefile to the new style.  I'm still stuck in the second
> stage.  You clearly have gotten further.  I found many things that did
> not work, but nothing successful.  The original rust version (1.44.1)
> is too old to build with clang-13.  I chose 1.60.0, since it had a
> bootstrap archive available from Joyent.  I also found that this
> version will not build with the clang compilers.  I had to revert to
> gcc for these.  Still, my builds terminated with this error:
>
>      libLLVM-14-rust-1.60.0-stable.so is missing
>
> I don't know how to get past that error.
>



More information about the oi-dev mailing list