« first day (3564 days earlier)      last day (216 days later) » 

 
3 hours later…
3:23 PM
@HostileForksaysdonttrustSE static: yes did nothing. exact same size result. How to compile with older versions?
 
4:22 PM
@iArnold How about fixing the static switch if it's not working.
 
4:55 PM
@iArnold It looks like it is doing -static-libgcc, which is only some helpers for code compiled with GCC (TCC has a similar lib called libtcc1.a). This would be for instance if the machine you were on didn't have multiplication, but the C standard says you can multiply...so they'd make * in your code turn into a call to __multiply as a function and then you'd have to link against the compiler support library for it to work.
 
5:10 PM
-Wl,-Bstatic -libc -Wl,-Bdynamic looks like what's needed on the make line.
@iArnold ^-- Try deleting your r3 executable and adding the above to the linker line (last line of the makefile, last line that runs with all the tons of xxx.o files).
 
@HostileForksaysdonttrustSE Yes it does a -static-libgcc and trying your next suggestion
including the -static-libgcc or do I delete that now?
/usr/bin/ld: cannot find -libc
collect2: error: ld returned 1 exit status
 
@iArnold Maybe it's glibc
 
sounds good. trying
 
@iArnold Could also just be -lc
e.g. the lib is implicit
 
gcc: error: unrecognized debug output level ‘libc’
That -lc did it
It is now a bit bigger.
Too bad, it did not solve the problem.
 
5:20 PM
It is complaining about missing libc symbols?
Well, I tried it and I'm getting it saying it's dynamically linking glibc entry points. (objdump -T r3)
 
I can see those in the DYNAMIC_SYMBOL_TABLE
GLIBC_2.29 pow and log and GLIBC_2.28 fcntl64
 
@iArnold Instead of the -Wl,-Bstatic -lc -Wl-,-Bdynamic ... try just -static
Really we should switch to using musl. They are more philosophically aligned; glibc kind of sucks.
 
Got three warnings now.
/usr/bin/ld: objs/library/library-posix.o: in function `Open_Library':
library-posix.c:(.text+0x1af): warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: objs/dns/mod-dns.o: in function `DNS_Actor':
mod-dns.c:(.text+0x2fef): warning: Using 'gethostbyaddr' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: objs/network/dev-net.o: in function `Lookup_Socket':
 
@iArnold Well, they've gotten increasingly unfriendly about static linking over time I guess. The dlopen() I knew, but not the gethost stuff.
 
Looks like it DID the trick.
At only approximately cost of an extra 1.4 MB
 
5:35 PM
@iArnold It won't be able to do network name resolution. The reasoning is here
Basically, long story short, glibc has decided static linking is not a use case for them any longer.
And aren't interested in supporting it.
You might be able to just put the correct glibc.so in the same directory as your executable, and it would pick it up like a DLL. I don't know.
@iArnold Using musl might not be hard: musl-libc.org/how.html
It makes it look like all you have to do is call musl-gcc instead of gcc once you install it.
Famous last words, of course.
 
"watch me do this, it is superdupersafe" <FAIL>&<Darwin-Award>
 
@iArnold I'm trying and I will see if it "just works"
 
Worst thing that realy can happen is me "bricking" the server instance I got at my hosting provider. I can live with that and with asking for the next time again to restart it for me ;-)
 
5:50 PM
Emscripten uses musl, actually
So we already have a musl-based build out there, though it isn't building everything (e.g. it wouldn't be trying to build network abilities like gethostbyname etc, as that's all in the browser)
 
6:09 PM
$ objdump -T r3

r3:     file format elf64-x86-64

objdump: r3: not a dynamic object
DYNAMIC SYMBOL TABLE:
no symbols
@iArnold ^-- well, musl seems to work and generates a working executable.
 
@HostileForksaysdonttrustSE Musl generated a complete staticly linked program. How much bigger is it compared to the regular one?
 
I'm not using any kind of build settings for comparison.
I make a highly variant set of builds and would have to do something different to get a number that meant anything.
Anyway, getting musl is not hard. git clone git://git.musl-libc.org/musl then cd musl then ./configure then make then sudo make install.
If you want a small copy, say git clone git://git.musl-libc.org/musl --depth 1
That won't pull down all the version history, just the last commit.
The build system doesn't make it as easy to do changes of what compiler you use as I would like. It should be defaulting to $(CC) and use whatever CC is in your environment.
@iArnold Unfortunately, rebmake is somewhat intractable. I built it by doing export cc=/usr/local/musl/bin/musl-gcc and then search-and-replacing in the makefile for gcc and replacing with $(CC). Then I changed the formerly -static-libgcc that became -static-lib$(CC) with that replacement to just -static
I guess the way Shixin intended was that you change the compiler by making a new config and changing the "toolset". :-/
 
6:24 PM
Anyway, won't work because the mysql library is expecting it is external. Linking errors without the mysql library at the end `mysql_config --libs` results in errors like
/usr/bin/ld: objs/mysql/mod-mysql.o: in function `N_MYSQL_mysql_get_client_info':
mod-mysql.c:(.text+0x148a): undefined reference to `mysql_get_client_info'
(and that for all the functions)
And with the `mysql_config --libs` at the end it is full of these
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libmysqlclient.a(my_file.cc.o): in function `MyFileEnd()':
 
Looks as if mysqlclient is C++ so it expects the C++ runtime (delete is a C++ operator).
Building executables on linux on one distribution and then running them "anywhere" is not particularly easy. There is a project called build-anywhere which is somewhat complex but accomplishes the goal by letting you "cross compile... from linux to linux"
@iArnold ^-- That is one of your best bets, but I think the long story short is, trying to build on one machine and take the executable off to another is something where you're going to have to get your hands dirty. If you are willing to set up a Linux VM at a version that matches your hosting provider and use that, it could be easier. I've done this for Travis installs that were problematic...just made a VM at that version.
No one said this stuff is easy.
 
@HostileForksaysdonttrustSE No fun taking the easy road right? Yes I kind of read that option to have a VM with the right setup. I think I was on Ubuntu19 back then and upgraded to 20, hard lesson learned: never ever upgrade your software ;-)
 
@iArnold The build-anywhere solution has a nice angle to it, in that because they made a toolchain that can build anywhere, they made it so you can download the already-built toolchain in a way that... runs anywhere. So no install process, you just unarchive the file and the compiler should work.
But then it's just a matter of getting the make.r to use that tool, which isn't as easy as it should be because it doesn't go through the natural $(CC) use of the CC environment variable but hardcodes gcc by default.
^-- cc: giuliolunati, no pun intended :-)
 
7:00 PM
Another possibility is that the dynamism requiring an updated symbol is a new thing in new gcc that can be worked around hackily, as done with fcntl64. Which gcc people don't like you doing. I guess I can look.
@iArnold actually, the glibc exports that are high are indeed GLIBC_2.28 fcntl64, GLIBC_2.29 log and GLIBC_2.29 pow. Hm. I have a workaround for the fcntl64 case. Wonder if I can hack up something for the log and pow.
@iArnold This actually might be easy. Hold on.
 
7:23 PM
@iArnold I think I have a workaround. Let me fix it up and commit it.
 
7:42 PM
@iArnold All right, I imagine this should work if you merge up. What you have to do is in the shell before you run the make.r script, say export USE_BACKDATED_GLIBC=1. Then run the make.r step, then build, and it should give you an executable that doesn't depend on too new a glibc.
These are things the glibc people don't like you to do, but, having the option is useful.
 
8:36 PM
@HostileForksaysdonttrustSE I think I have merged it successfully.
 
@iArnold Ok, in the shell window where you are going to run make.r, do that export USE_BACKDATED_GLIBC=1 thing.
(If you just say set x=1 then it will be true for a moment, and then the next command you run from the shell it won't be true anymore)
(export means "make the shell I'm running inherit this environment variable for future commands I run in this window")
 
@HostileForksaysdonttrustSE Hence the export of the "R3-MAKE" too.
 
Anyway, the hope is that your objdump -T r3 | grep GLIBC | more will not show any GLIBC numbers that are too high (e.g. 2.28 or 2.29)...the culprits were fcntl64, pow, and log that I found.
 
8:53 PM
This still gives me 0000000000000000 DF *UND* 0000000000000000 GLIBC_2.28 fcntl64
and the two pow and log on 2.29 lines.
Exe has the same size as a previous not working compilation
 
@iArnold Does the link line have -Wl,--wrap=fcntl64 -Wl,--wrap=log -Wl,--wrap=pow
 
No I'll add that.
 
@iArnold It should have been added automatically when you ran %make.r ... if you didn't get it, then you won't have the fcntl hack file. What happens if you type echo $USE_BACKDATED_GLIBC?
 
1
 
And you ran the make.r process, to generate a new makefile or whatever?
 
9:00 PM
I do
"$R3_MAKE" ../make.r config: ../configs/default-config.r debug: asserts optimize: 2 static: yes
to generate the file and create the exe.
First line of the link step
gcc -o r3 -fvisibility=hidden -rdynamic objs/a-constants.o objs/a-globals.o objs/a-lib.o <etc>
 
@iArnold I'm trying without a makefile to see if I get the same effect.
 
/usr/bin/ld: objs/n-math.o: in function `N_exp':
n-math.c:(.text+0x1ced): undefined reference to `__wrap_pow'
And some more.. and at the end
/usr/bin/ld: call-posix.c:(.text+0x3747): undefined reference to `__wrap_fcntl64'
/usr/bin/ld: objs/process/call-posix.o:call-posix.c:(.text+0x3762): more undefined references to `__wrap_fcntl64' follow
collect2: error: ld returned 1 exit status
 
$ git rev-parse HEAD
640895fae99b70f1f9aa0f894a157615f57d9342
@iArnold is that what you get on your command line in the ren-c directory as the current git commit?
 
No, I get : aca9ecc04b28423b23d5e6478fa0c3ce38751616
But that is from 4 days ago..
 
@iArnold So it probably won't work. If you have local changes, then git stash then git pull then git stash pop
 
9:14 PM
The master is up to date though. Now how do I gitfix the mysql branch to align with that...
 
If you are working on another branch, the general thing to do is rebase.
git rebase master
While you are on the mysql branch
Then you should see the commit in the git log.
 
@HostileForksaysdonttrustSE I had my local changes already brought to github. I did the rebase, but that was not what I wanted, I needed to pull, <git pull> and then a <git push origin>. Now changes were applied to the right branch and on github too and change is now labeled 640895f
 
@iArnold Okay, well depending on your working style... even if you've pushed changes to github you can overwrite them with git push --force. The idea is to avoid merge commits if you possibly can.
 
9:30 PM
@HostileForksaysdonttrustSE Admitted, a lot of trial and error going on there. If finally everything will be working, it is alway possible to recreate a clean branch to bring that into the mainline. That is the essence of the extra repository, to be able to do this falling and getting up again, hopefully with some more contributors in the future.
A giant step forward, but not entirely there yet.
AH01215: /cgi-bin/renc: error while loading shared libraries: libmysqlclient.so.21: cannot open shared object file: No such file or directory
 
@iArnold If you can't modify system directories, you might have to find that library file and put it in the same directory as the ren-c. It might load it. <shrug>
I don't know what the likelihood of statically linking libmysqlclient is; you might be able to do it with -static-libstdc++ -static -lmysqlclient
So try replacing the -lmysqlclient on your link line with that.
Given CONTINUE and GO are taken, I guess the word to ask the debugger to just keep going probably has to be RUN.
 

« first day (3564 days earlier)      last day (216 days later) »