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

Unable to compiler egalito #30

Open
basavesh opened this issue Oct 18, 2020 · 8 comments
Open

Unable to compiler egalito #30

basavesh opened this issue Oct 18, 2020 · 8 comments

Comments

@basavesh
Copy link

Not sure why this dependency is not met. Let me know if I should install some library for this. Trying on a fresh install of ubuntu 20.04

make[2]: Entering directory '/root/egalito/dep/rtld' gcc -std=c99 -Wall -Wextra -Wno-format -Wno-int-conversion -Wno-unused-parameter -g -o build_x86_64/load_test load_test.c readlink -f /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/ld-linux-x86-64.so.2 > build_x86_64/interpreter readelf --dyn-syms /usr/lib/x86_64-linux-gnu/ld-2.31.so | grep rtld_global@ | awk '{ print $3 }' > build_x86_64/rtld_global_size readelf --dyn-syms /usr/lib/x86_64-linux-gnu/ld-2.31.so | grep rtld_global_ro@ | awk '{ print $3 }' > build_x86_64/rtld_global_ro_size gdb -n -q -x reconstruct.py -x rtld.gdb /usr/lib/x86_64-linux-gnu/ld-2.31.so | grep -v 'done\.' | grep -v 'Reading symbols' \ | sed 's/struct rtld/struct my_rtld/' > build_x86_64/rtld.h Python Exception <class 'gdb.error'> No struct type named rtld_global.: rtld.gdb:2: Error in sourced command file: Error occurred in Python: No struct type named rtld_global.

@dwks
Copy link
Contributor

dwks commented Oct 18, 2020

You need the libc and libstdc++ debug packages. On your system, it should be libc6-dbg and libstdc++6-7-dbg. Please try installing those and doing a clean rebuild.

@basavesh
Copy link
Author

basavesh commented Oct 18, 2020

I have those libraries.

root@b1a068da59c6:/egalito# apt install libc6-dbg libstdc++6-7-dbg
Reading package lists... Done
Building dependency tree
Reading state information... Done
libstdc++6-7-dbg is already the newest version (7.5.0-6ubuntu2).
libc6-dbg is already the newest version (2.31-0ubuntu9.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@b1a068da59c6:
/egalito# make clean
make -C app clean
make[1]: Entering directory '/root/egalito/app'
rm -rf build_x86_64/ .symlinks etshell etshell2 pyshell etobjdump etsandbox libsandbox.so etcoverage libcoverage.so etharden libcet.so etelf etprofile ettwocode etorder
make[1]: Leaving directory '/root/egalito/app'
make -C src clean
make[1]: Entering directory '/root/egalito/src'
rm -rf build_x86_64/ .symlinks loader libegalito.a libegalito.so libaddon.so ex example symbols.elf
make[1]: Leaving directory '/root/egalito/src'
make -C test clean
make[1]: Entering directory '/root/egalito/test'
make[1]: *** No rule to make target 'clean'. Stop.
make[1]: Leaving directory '/root/egalito/test'
make: *** [Makefile:38: clean] Error 2
root@b1a068da59c6:~/egalito# make
make -C dep
make[1]: Entering directory '/root/egalito/dep'
make -C rtld
make[2]: Entering directory '/root/egalito/dep/rtld'
gdb -n -q -x reconstruct.py -x rtld.gdb /usr/lib/x86_64-linux-gnu/ld-2.31.so | grep -v 'done.' | grep -v 'Reading symbols'
| sed 's/struct rtld/struct my_rtld/' > build_x86_64/rtld.h
Python Exception <class 'gdb.error'> No struct type named rtld_global.:
rtld.gdb:2: Error in sourced command file:
Error occurred in Python: No struct type named rtld_global.

@dwks
Copy link
Contributor

dwks commented Oct 18, 2020

It looks like Ubuntu 20.04 has moved away from .build-id references for debug files, and starting to use full paths (like Fedora). Egalito handles both but Ubuntu's GDB doesn't seem to be configured that way. I added a hack to the ubuntu20.04 branch to work around this until GDB can find symbol files properly.

https://github.com/columbia/egalito/tree/ubuntu20.04

@basavesh
Copy link
Author

Thank You! did make some progress. But, could not build it.

Here is the error.

make -C config
make[1]: Entering directory '/home/basavesh/egalito/config'
make[1]: Leaving directory '/home/basavesh/egalito/config'
make -C src
make[1]: Entering directory '/home/basavesh/egalito/src'
CXX transform/data.cpp
In file included from transform/data.cpp:8:
./../dep/rtld/pthread.h:1:63: error: too many decimal points in number
1 | (No debugging symbols found in /usr/lib/x86_64-linux-gnu/libc-2.31.so)
| ^~~~~~~
./../dep/rtld/pthread.h:1:4: error: expected ‘)’ before ‘debugging’
1 | (No debugging symbols found in /usr/lib/x86_64-linux-gnu/libc-2.31.so)
| ~ ^~~~~~~~~~
| )
transform/data.cpp: In member function ‘address_t DataLoader::allocateTLS(address_t, size_t, size_t*)’:
transform/data.cpp:33:37: error: invalid application of ‘sizeof’ to incomplete type ‘DataLoader::allocateTLS(address_t, size_t, size_t*)::my_pthread’
33 | size += sizeof(struct my_pthread);
| ^
make[1]: *** [../env.mk:180: build_x86_64/transform/data.o] Error 1
make[1]: Leaving directory '/home/basavesh/egalito/src'
make: *** [Makefile:21: src] Error 2

@dwks
Copy link
Contributor

dwks commented Oct 18, 2020

It's doing code generation. Look at generate1.cpp for example. Every time it can't find a debug package gdb will print an error message and that ends up in the code instead. Try adding

add-symbol-file /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.31.so

to dep/rtld/symbols.gdb. You can also test with

gdb /lib/x86_64-linux-gnu/libc-2.31.so
gdb /lib/x86_64-linux-gnu/ld-2.28.so

Basically, those two have to find symbols.

@basavesh
Copy link
Author

I'm still having issues with Ubuntu 20.04. However, I'm able to compile it fine in Ubuntu 18.04. Thank you!

Error in Ubuntu 20.04
transform/data.cpp:8:14: fatal error: ../dep/rtld/pthread.h: No such file or directory
8 | #include "../dep/rtld/pthread.h"
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [../env.mk:180: build_x86_64/transform/data.o] Error 1
make[1]: Leaving directory '/root/egalito/src'
make: *** [Makefile:21: src] Error 2

@dwks
Copy link
Contributor

dwks commented Oct 19, 2020

The "dep/rtld" doesn't do make clean very well unless you explicitly go to that directory. To avoid problems, you can clone again from scratch. Glad 18.04 worked.

@benner
Copy link

benner commented Dec 10, 2021

On Ubuntu 21.04:

diff --git a/dep/rtld/symbols.gdb b/dep/rtld/symbols.gdb
index 8ab65314..6582030a 100644
--- a/dep/rtld/symbols.gdb
+++ b/dep/rtld/symbols.gdb
@@ -1 +1 @@
-symbol-file /usr/lib/debug/lib/x86_64-linux-gnu/ld-2.31.so
+symbol-file /usr/lib/debug/lib/x86_64-linux-gnu/ld-2.33.so

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

3 participants