containers / libkrun

A dynamic library providing Virtualization-based process isolation capabilities

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ld Unable to find krun_set_data_disk

tylerfanelli opened this issue · comments

When running the latest example of examples/launch-tee.c, I receive the following message:

libkrun/examples/launch-tee.c:81: undefined reference to krun_set_data_disk'

This API was introduced in #102

Will investigate.

Looks like the linker is pulling an older version of libkrun-sev.so w/o krun_set_data_disk. I would check which library is trying to pull.

@slp I've been making slight changes to some other APIs and those changes are visible to me. I think that shows that im on the latest branch of libkrun, correct? The issue persists.

"Works on my machine" 😄 @tylerfanelli .

Jokes aside, it does build & link nicely in a clean podman container according to the instructions below - so I have to agree with @slp that it seems to be some weirdness with your setup.

Download a source from Github

# download the latest source
$ wget https://github.com/containers/libkrun/archive/refs/heads/main.tar.gz -O- | tar -xzf -

$ cd libkrun-main

Save this to libkrun-main/Makefile.podman. It assumes that:

  • you have podman on your system
  • libkrunfw-sev.so and associated symlinks are properly installed in /usr/local/lib64
# SPDX-License-Identifier: Apache-2

IMAGE_NAME := libkrun-builder

define CONTAINERFILE
	FROM docker.io/library/rust:1.66-slim-bullseye

	RUN apt-get update \
		&& apt-get install -y --no-install-recommends patchelf make pkg-config libssl-dev \
		&& rm -rf /var/lib/apt/lists/*
    COPY libkrunfw* /usr/local/lib64/
endef
export CONTAINERFILE

all:
	echo "$$CONTAINERFILE" | podman build --tag $(IMAGE_NAME) -f - /usr/local/lib64
	podman run --rm --tty --interactive -e CARGO_HOME=/build/.cargo \
		--mount 'type=bind,source=$(shell pwd),target=/build' --workdir /build \
		--user '$(shell id -u):$(shell id -g)' $(1) $(IMAGE_NAME) $(2)

Now build interactively in a clean podman container with:

# Build and enter container
$ make -f Makefile.podman

# the following is executed in podman container
> make SEV=1 clean all install

> cd example
> make SEV=1 clean all

@blenessy I've found the mistake. I was properly updating libkrun-sev.so, yet my <libkrun.h> wasn't being properly updated. Thus, I was seeing changes to all other APIs (which were already a part of libkrun.h, yet not recognizing krun_set_data_disk. My mistake, thanks for pointing that out.