Hello,

I have been stuck on this linker error for a while now, and I was wondering if 
anyone knows how to fix it?
I have attached the log file, the run script, the target.mk file, and the three 
program files (squid.cc and squid.h are based on the code I found in fs_tool).

Best,
Rumen

#include <base/component.h>
#include "squid.h"

void Component::construct(Genode::Env &env) {
    PH_snapshot::Main main(env);
    char hello[20] = "hello world";
    main._new_file("/squid-cache/hello", (void*) hello, 20);
}
#include "squid.h"

namespace PH_snapshot {
    using namespace Genode;
    struct Main;
}

void PH_snapshot::Main::_new_file(char const *path, void *payload, size_t size) {

    Path p(path);

    try {
        New_file nf(_root_dir, p);

        if ( nf.append((const char*)payload, size) != New_file::Append_result::OK ) {
            warning("couldn't write to file!");
        }
 
    } catch (New_file::Create_failed) {
        warning("couldn't create file!");
    }
}



#pragma once

#include <base/component.h>
#include <base/sleep.h>
#include <base/attached_rom_dataspace.h>
#include <base/heap.h>
#include <os/vfs.h>
#include <vfs/file_system_factory.h>
#include <base/buffered_output.h>


namespace PH_snapshot {
    using namespace Genode;
    struct Main;
}

typedef struct vm_page {
    int id;
} vm_page;

struct PH_snapshot::Main
{
    Env &_env;
    Heap _heap { _env.ram(), _env.rm() };

    Main(Env &env) : _env(env) {}

	Attached_rom_dataspace _config { _env, "config" };

	Vfs::Global_file_system_factory _fs_factory { _heap };

	Vfs::Simple_env _vfs_env { _env, _heap, _config.xml().sub_node("vfs") };

	typedef Directory::Path Path;

	Directory _root_dir { _vfs_env };

	void _new_file       (char const *path, void *payload, size_t size);
};
make: Entering directory '/home/rumen/genode/build/x86_64'
including /home/rumen/genode/tool/run/power_on/linux
including /home/rumen/genode/tool/run/log/linux
including /home/rumen/genode/tool/run/boot_dir/linux
including /home/rumen/genode/repos/squid/run/squid.run
building targets:  core init timer server/lx_block server/report_rom server/vfs lib/vfs lib/vfs_lwext4 test/libc_vfs lib/ld lib/libc lib/libm lib/posix app/squid

spawn make core init timer server/lx_block server/report_rom server/vfs lib/vfs lib/vfs_lwext4 test/libc_vfs lib/ld lib/libc lib/libm lib/posix app/squid
make[1]: Entering directory '/home/rumen/genode/build/x86_64'
  Library vfs.abi.so
  Library ld.abi.so
  Library base.lib.a
  Library ldso_so_support.lib.a
  Library vfs.lib.so
  Library format.lib.a
  Library lwext4.lib.a
  Library vfs_lwext4.lib.so
  Library syscall-linux.lib.a
  Library base-linux-common.lib.a
  Library timeout.lib.a
  Library startup-linux.lib.a
  Library cxx.lib.a
  Library seccomp.lib.a
  Library base-linux.lib.a
  Library ld-linux.lib.so
  Library ld.lib.so
  Library libc.abi.so
  Library libc-string.lib.a
  Library libc-locale.lib.a
  Library libc-stdlib.lib.a
  Library libc-stdio.lib.a
  Library libc-gen.lib.a
  Library libc-gdtoa.lib.a
  Library libc-inet.lib.a
  Library libc-stdtime.lib.a
  Library libc-regex.lib.a
  Library libc-compat.lib.a
  Library libc-setjmp.lib.a
  Library libc-mem.lib.a
  Library libc-resolv.lib.a
  Library libc-isc.lib.a
  Library libc-nameser.lib.a
  Library libc-net.lib.a
  Library libc-rpc.lib.a
  Library libc-tzcode.lib.a
  Library libc-libkern.lib.a
  Library libc.lib.so
  Library libm.abi.so
  Library libm.lib.so
  Library posix.abi.so
  Library posix.lib.so
  Program app/squid/squid
    LINK     squid
/usr/local/genode/tool/23.05/bin/../lib/gcc/x86_64-pc-elf/12.3.0/../../../../x86_64-pc-elf/bin/ld: main.o: in function `PH_snapshot::Main::Main(Genode::Env&)':
/home/rumen/genode/repos/squid/src/app/squid/squid.h:26: undefined reference to `Vfs::Global_file_system_factory::Global_file_system_factory(Genode::Allocator&)'
collect2: error: ld returned 1 exit status
make[3]: *** [/home/rumen/genode/repos/base/mk/prg.mk:214: squid] Error 1
make[2]: *** [var/libdeps:728: squid.prg] Error 2
make[1]: *** [Makefile:351: gen_deps_and_build_targets] Error 2
make[1]: Leaving directory '/home/rumen/genode/build/x86_64'
Error: Genode build failed
make: Leaving directory '/home/rumen/genode/build/x86_64'

Attachment: squid.run
Description: squid.run

TARGET   = squid
SRC_CC   = main.cc squid.cc
LIBS     = lwext4 base format

INC_DIR += $(call select_from_ports,lwext4)/include
INC_DIR += $(REP_DIR)/src/lib/lwext4/include

CC_OPT += -DCONFIG_USE_DEFAULT_CFG=1
CC_OPT += -DCONFIG_HAVE_OWN_ERRNO=1
CC_OPT += -DCONFIG_HAVE_OWN_ASSERT=1
CC_OPT += -DCONFIG_BLOCK_DEV_CACHE_SIZE=256

vpath     %.c $(LWEXT4_DIR)/src
vpath     %.c $(LWEXT4_DIR)/blockdev
vpath qsort.c $(REP_DIR)/src/lib/lwext4/
vpath    %.cc $(REP_DIR)/src/lib/lwext4/

_______________________________________________
users mailing list -- users@lists.genode.org
To unsubscribe send an email to users-le...@lists.genode.org
Archived at 
https://lists.genode.org/mailman3/hyperkitty/list/users@lists.genode.org/message/UK65Z2MSKVBOV2DWDAH3HNVQK3GQCW2N/

Reply via email to