last day (15 days later) » 

9:17 PM
thanks for taking the time to help me out.
this is driving me nuts
 
amn
Thank me when and if I'll be able to help ;)
Do you think you can attempt to isolate the cause?
 
yes sir :)
i don't know where to start.
 
amn
how many translation units (.cpp/.cxx files to be compiled) are there
?
and how proficient with Linux are you?
 
there is only 1 TL.
i am not very proficient in Linux.
but very proficient in C++.
 
amn
ok, it's a relatively good start :)
 
9:19 PM
most of the code is C++ template stuff (functions and classes) so the interesting stuff is all in headers.
 
amn
how many lines of code?
 
about 2000
 
amn
that's just the CPP file?
 
no
all the code in headers and the one cpp file.
 
amn
are you comfortable sharing the source code with me?
 
9:20 PM
on windows, it generates a 40 MB DLL.
 
amn
or you want to do it the way where I do it "blindly"? Just asking.
 
unfortunately, I cannot because my employer as the rights to it.
i wish i could...
 
amn
Fair is fair.
how many include files are included by the TL?
 
it is just absolutely bizarre that this works perfectly on my dev Linux box 100% of the time.
 
amn
It's most likely a bug in GCC
or linker
but alas, too early to say
 
9:21 PM
10 header files.
but I am using the exact same compiler on both machines.
 
amn
building 40Mb of x86 instructions by templates alone is not something I've seen too much of in the wild
 
I literally zipped up the compiler folder on the working box, and sshed it to the bad box.
 
amn
well, the fault doesn't have to appear just because you run the same compiler, something may be triggering it.
read: Linux setup
 
the bad box compiles "reasonable" c++ programs without issue.
ok.
that's a good point.
but how can I figure what I did wrong on the bad box?
 
amn
ok, have you tried pasting the code (with preprocessed include directives) to gcc.godbolt.org?
 
9:24 PM
no.
how can i do that?
there must be a gcc option to do that that I am not aware of.
 
amn
it's basically a website that runs the code you paste through a C++ compiler of your choosing, one that's installed already on the machine hosting the website
 
i get that.
how do I get the proprocessed source?
*preprocessed
 
amn
you run gcc in preprocessing mode, I think. Give me some minutes...
As far as I can tell now, you add the "-E" switch to however your g++ or gcc command line is.
since you only have one TL, you should only have one invocation of GCC.
 
right. Let me try that. be back in a few minutes.
it failed: <Compilation failed: Error sending request>
it was 53158 lines of code
it included the standard library source as well as some other stuff.
 
amn
Well, that's at least interesting.
 
9:37 PM
one thing that I did on both boxes is that I built a cross compiler using gcc-8.1 for arm64.
do you think that in the process, I messed up the config somehow?
 
amn
I built GCC myself only once, but I remember "Linux from Scratch" had a lot of things to say about the fragility of the process.
Anyway, there the chance for that, yet.
*yes
But.
The reason I asked you whether you were running your OS on physical hardware, is that if your host is Windows, you can easily spin up a virtual Linux machine and try to reproduce the issue with it.
 
I am running the OS natively on the hardware in both cases.
 
amn
In fact, even if your host is Linux, you can spin up a virtual Linux as well, but it's just a tiny bit more elaborate, unless you care to install VirtualBox.
You shouldn't have to build GCC yourself, why do you do that? GCC 8.2 is available in Arch Linux, among others.
 
well i didn't know that.
I need to get a version of gcc 8.2 that can build x64, x86, and arm64
 
amn
Arch can do all of that.
 
9:41 PM
but that all needs to work on Ubuntu x64 as the host OS.
really? does it have an arm64 compiler that runs on x64?
 
amn
You mean the program you build has to work on Ubuntu, or the compiler?
 
the compiler only.
 
amn
Ah, then we forget about Arch
 
I need to be able to build for all 3 targets on Ubuntu x64
ok.
 
amn
Ah, now it makes sense why you're building GCC.
To be honest, I am not sure there is ARM64 cross compiler in whichever GCC Ubuntu ships these days.
But I'll Google now...
 
9:46 PM
more specifically, I am using the teamcity CI system and I want that to build for all 3 targets...
 
amn
Right. It shouldn't matter because it invokes GCC which does all the heavy lifting, right?
I have never built for ARM 64-bit, is it what is called "aarch64"?
 
right.
yes. aarch64
building an aarch64 version of gcc-8.2 was hard.
 
amn
I can't even imagine :)
I've been reading up on all this cross compiling aarch64 business, and I am afraid I can't promptly help you there.
Meaning that if I do that will be a considerable effort on my part which will take days!
Have you looked into using Clang?
If the Ubuntu x86-64 requirement is because of the CI system, then at least you can get it to use clang as cc
Clang can cross compile without being compiled for target architecture, which in my opinion is a very good thing indeed
Another, perhaps more convenient if temporary solution, is to set up a hypervisor on your Ubuntu host, install and run Arch Linux machine in it, and install the following package: security.archlinux.org/package/aarch64-linux-gnu-gcc
 
10:03 PM
ok. i will try that.
thanks.
 
amn
Sorry I couldn't be of more help. Best of luck with this :)
I strongly advise you to update your question as best you can, filling out the details. You never know how much time you'll spent debugging this, while the time will work for you if you have a question sitting there on SO and someone may show up with just the solution or direction you need. Has worked for me more times than I even hoped for.
 
thank you.
 

last day (15 days later) »