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' [00;33mLibrary[0m vfs.abi.so [00;33mLibrary[0m ld.abi.so [00;33mLibrary[0m base.lib.a [00;33mLibrary[0m ldso_so_support.lib.a [00;33mLibrary[0m vfs.lib.so [00;33mLibrary[0m format.lib.a [00;33mLibrary[0m lwext4.lib.a [00;33mLibrary[0m vfs_lwext4.lib.so [00;33mLibrary[0m syscall-linux.lib.a [00;33mLibrary[0m base-linux-common.lib.a [00;33mLibrary[0m timeout.lib.a [00;33mLibrary[0m startup-linux.lib.a [00;33mLibrary[0m cxx.lib.a [00;33mLibrary[0m seccomp.lib.a [00;33mLibrary[0m base-linux.lib.a [00;33mLibrary[0m ld-linux.lib.so [00;33mLibrary[0m ld.lib.so [00;33mLibrary[0m libc.abi.so [00;33mLibrary[0m libc-string.lib.a [00;33mLibrary[0m libc-locale.lib.a [00;33mLibrary[0m libc-stdlib.lib.a [00;33mLibrary[0m libc-stdio.lib.a [00;33mLibrary[0m libc-gen.lib.a [00;33mLibrary[0m libc-gdtoa.lib.a [00;33mLibrary[0m libc-inet.lib.a [00;33mLibrary[0m libc-stdtime.lib.a [00;33mLibrary[0m libc-regex.lib.a [00;33mLibrary[0m libc-compat.lib.a [00;33mLibrary[0m libc-setjmp.lib.a [00;33mLibrary[0m libc-mem.lib.a [00;33mLibrary[0m libc-resolv.lib.a [00;33mLibrary[0m libc-isc.lib.a [00;33mLibrary[0m libc-nameser.lib.a [00;33mLibrary[0m libc-net.lib.a [00;33mLibrary[0m libc-rpc.lib.a [00;33mLibrary[0m libc-tzcode.lib.a [00;33mLibrary[0m libc-libkern.lib.a [00;33mLibrary[0m libc.lib.so [00;33mLibrary[0m libm.abi.so [00;33mLibrary[0m libm.lib.so [00;33mLibrary[0m posix.abi.so [00;33mLibrary[0m posix.lib.so [01;33mProgram[0m 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'
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/