Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined reference to errors #41

Open
tomcruiseqi opened this issue Jan 16, 2024 · 1 comment
Open

undefined reference to errors #41

tomcruiseqi opened this issue Jan 16, 2024 · 1 comment

Comments

@tomcruiseqi
Copy link

Hello:

When I build with
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/programs/mylibvmi -DENABLE_KVM=ON -DENABLE_XEN=OFF -DENABLE_BAREFLANK=OFF
and then run make -j6, there are so many undefined references errors:

/usr/bin/ld: CMakeFiles/vmifs.dir/vmifs.c.o: in function `vmifs_read':
/home/qzt/fuzzers/kvm-vmi/libvmi/tools/vmifs/vmifs.c:94: undefined reference to `g_try_malloc0'
/usr/bin/ld: /home/qzt/fuzzers/kvm-vmi/libvmi/tools/vmifs/vmifs.c:99: undefined reference to `g_free'
/usr/bin/ld: /home/qzt/fuzzers/kvm-vmi/libvmi/tools/vmifs/vmifs.c:102: undefined reference to `g_free'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_direct_hash'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_slist_free_full'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_malloc'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_queue_unlink'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_hash_table_remove'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_str_equal'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_slist_free'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_hash_table_remove_all'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_int64_equal'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_hash_table_lookup'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_queue_get_length'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_queue_find_custom'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_queue_pop_tail'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_strconcat'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_hash_table_new'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_slist_find_custom'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_slist_prepend'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_hash_table_iter_next'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_direct_equal'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_queue_foreach'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_hash_table_new_full'
/usr/bin/ld: ../../libvmi/libvmi.so.0.0.15: undefined reference to `g_hash_table_size'

After many tries, I found that this code (line 33 in [ROOT]/CMakeLists.txt) is doing the bad thing:
string(REGEX REPLACE "-l" "" GLIB_LDFLAGS ${GLIB_LDFLAGS})
when i comment out this line, everything works fine.

I don't know if there will be some other problems, so I made this issue.

@PawBud
Copy link

PawBud commented Apr 24, 2024

I tried something different(alongside this). I simply switched the version of CMake (from 3.25.1 which i was using and getting the same error) to 3.2.0, due to this thread .

TLDR:- It seems to be a CMake 3.21+ related issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants