-
Notifications
You must be signed in to change notification settings - Fork 47
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
Streamline the build of golang-related libraries #304
Comments
Thank you very much @tor-m6 for attending this issue via pull request #312. Your commit is very much appreciated. I merged it to staging just now. Now that you have moved the library builds to lib/mk/ files, do you see the potential to simplify the build instructions (src/test/go_app/README.golang) by adding |
Thank you @nfeske for prompt review. I still had some issues related to the fact that every lib here is build via go configure script. AFAIK I can't build somehow "natively" set of 4 libs, only one-by-one, and I use CUSTOM_DEPENDENCES to glue gnu_build.mk Anyway, I don't want to run them fully as a part of final application build. The reason is a latest changes (not sure where) - all these libs, together with separate libgcc.a/etc somehow added by libgo build script (Makefile generated after configure run) to inside libgo.a by complete scatter of my 3 libs into object files! as a result, if I add these libs into application target.mk like this it fail during linking process because of 2 kind of errors:
So, after some try I found stupid solution for first problem - just remove added .a files manually from inside my libgo.mk/etc file during installation (see finished.tag rule) For second problem I made another tricky way. I removed direct reference from LIBS variable in target.mk and libgo.mk - due to this these libraries do not appears in build script for libgo.a and later for any go_app, content of these 3 libs stored inside libgo.a and sufficient to link applications. At least I don't know how to NOT to append libatomic.a/etc to the list of libraries in normal way. While, they also had some .h files (generated/copied from distro) which is placed in the way how libgo configure/Makefile assume (outside of var/libcache/libgo/ build dir -dirty hack). May be you can suggest some other ways to work with these supplemental libs (I also suspect that they could be need for some other gcc compilers in the future, may be). I suspect that this should be done inside file like import-libatomic.mk, but I can't cut libatomic.a from the internal variables of lib.mk / included files. Any suggestions? |
Thank you very much for the additional details, and for exploring the direction I suggested. The symptoms remind me of past situations where make variables were passed as environment variables to sub makes, which then ended up hard overriding variables in the sub make. The most recent example is genodelabs/genode#4725. When grepping the Genode source tree for
Your analysis is right. But I think that the idea to side step the use of the Maybe @cproc's experience with porting the tool chain to Genode can be of help? |
I do not use LIB_A - it just filled from LIBS which is modified inside target.mk... Now I get rid of it - anyway, this is still not the best solution |
Issue genodelabs/genode#4743 has a fix for the problem that |
thanks, applied. About duplicated symbols... during assembling of main libgo.a libtool completely disassemble related static libraries (libatomic.a/etc) into object files and add them "one by one" into libgo.a during "link" operation. |
One way to solve the duplicated symbols problem could be to let |
something wrong with this patch. I removed build dirs, and try when I press CtrlC it says something like admin@genode_tap:~/gen/22.11$ make -C build/x86_64/ KERNEL=linux BOARD=linux lib/libbacktrace VERBOSE= VERBOSE_MK= |
Hm, I cannot reproduce this problem, unfortunately. Do you get some helpful information when you remove the |
a bit more. for lib in libatomic; do |
also I found that progress.log is empty - not filled by libs, probable key of the problem is here I removed it and comment out this string in libatomic.mk Library build progress log - generated by dep_prg.mk and dep_lib.mkBuild artifact posix.lib.soLIBS_READY += posix and in the output |
When I add the LLL/AAA output, the first message I see is
It does not contain |
As we're currently addressing issues with different versions of GNU Make in genodelabs/genode#4725, may I ask which version do you both use currently? |
4.1 |
4.2.1 |
now I try to kill some files (libdeps and progress.log) from build dir and found circular rule in build/x86_64/var/libdeps libatomic.lib: check_ports libatomic.lib posix.lib |
I set make to 4.1 now, when I try to build run/rm_sub (no relation to libatomic/etc) in libdep I found
|
I applied patch below before your - may be this is the reason? gnu_build.mk: pass static libraries in '-l:' format
|
I use the following branches: https://github.com/genodelabs/genode/tree/staging (last commit 0bc124a) When I build |
I made a clean copy based on staged - everything works ok (probably my working copy was somehow damaged), except that: when I build and run go_app, then removed var/libcache/libatomic and try to rebuild application - it rebuild libatomic but do not update libgo (while it is explicitly use their includes and take .o files and include them into libgo.a). something not correct in dependence handling... |
When I build go for Linux (with
A solution with |
probably we need to be sure that user is aware that if libatomic/etc was build/rebuild then libgo should be updated as well, may be manually. Like message in the end of build. may be it worth to make the same dirty hack to go outside library build environmnt? We know that both libbacktrace.lib.a and backtrace.a are in var/libcache/libbacktrace and .../backtrace accordingly. we can point to some known object from libbacktrace as above to be sure that it will hit if library not exist or empty |
Commit f6402e8 builds the |
It seems like this issue got automatically closed when the original commit went to the master branch. |
I tried to run the The However, it seems there's some issue when running Output from `make -C ... run/go_app` command
|
I check this recently and still not have a time to fix Problem that after latest updates, seems that naming of binaries and access to them via run file changed To work successfully, I need to provide symbolic names for every binary to be able to unwind stack as golang requires. “Deadlock ahead” is a result of panic being hit during symlink processing, relate to the fact what we did not find a binary name inside run file. I emulate it inside the code , as stated in 23.11 branch of Genode-world from my repo. @cproc may be there are easier way to have a binary names in the way that libbacktrace from gcc will work correctly? Stack unwinding is a normal part of golang support code work on every goroutine context change, not "an exception"... This is what I typically use to generate in run file all names in vfs section (and I am not that happy - this is complex and error-prune). Like for each binary which can appears in the stack
|
Seems that now rtc driver became mandatory to clock_gettime() in libc. fixed in commit 7f5eeeef84787cf07dfebbd1fac224e22f6c0333 Bug related to "deadlock ahead" fixed temporary in tor-m6/genode@658283c |
Currently, the golang-related libraries (libatomic, libffi, libbacktrace) are built via target.mk files hosted under src/lib/.
With the upcoming change of genodelabs/genode#4599, those target.mk files will no longer be reachable for triggering the manual build of these targets.
I see two possible ways to go forward.
var/libcache/<libname>/
. So the symlinks installed at bin/ must point to this place.To me, the second option looks preferable because it has the potential to eliminate the manual steps of using golang (as described at https://github.com/genodelabs/genode-world/tree/master/src/test/go_app). The go application could then specify the required libs as LIBS dependency, which would trigger the build automatically.
Whichever way we chose, we'l need to adjust the documentation and perform a basic functional test.
@tor-m6 What do you think? Would you be willing to implement either of both options? Or do you see a simpler alternative?
The text was updated successfully, but these errors were encountered: