OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 2:50 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 47 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: [UEFI bare bones/x-compiler config] - LD not finding li
PostPosted: Wed Jan 06, 2021 3:26 pm 
Offline
Member
Member
User avatar

Joined: Thu Aug 11, 2005 11:00 pm
Posts: 1110
Location: Tartu, Estonia
I suspect that on these systems libgcc is built as a shared library instead of a static one. (I haven't checked, since I haven't targeted any of those recently.)

_________________
Programmers' Hardware Database // GitHub user: xenos1984; OS project: NOS


Top
 Profile  
 
 Post subject: Re: [UEFI bare bones/x-compiler config] - LD not finding li
PostPosted: Wed Jan 06, 2021 3:28 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
If so, is there a straightforward way to force it to be built as a static library?

And are there any notable reasons why not to do so, and if so, how do I work around them? I can understand why those triplets would default to that, given that those target triplets are meant mainly for systems which support DLLs/shared libraries, but I would expect that there would be times when a static version would be called for even in general programming practice.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Last edited by Schol-R-LEA on Wed Jan 06, 2021 3:32 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [UEFI bare bones/x-compiler config] - LD not finding li
PostPosted: Wed Jan 06, 2021 3:30 pm 
Offline
Member
Member

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 1071
Try passing --disable-shared to configure

_________________
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg


Top
 Profile  
 
 Post subject: Re: [UEFI bare bones/x-compiler config] - LD not finding li
PostPosted: Wed Jan 06, 2021 3:33 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5137
I agree with nexos. The documentation isn't clear on whether static libraries will be built when shared libraries are built.


Top
 Profile  
 
 Post subject: Re: [UEFI bare bones/x-compiler config] - LD not finding li
PostPosted: Wed Jan 06, 2021 3:35 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
nexos wrote:
Try passing --disable-shared to configure


OK, I'll try that now. I assume that this applies only to GCC, and not to the build for binutils - though I suppose it could, for the assembler and linker.

EDIT: For the time being, I am passing it to configure in both scripts, though I don't expect it has any effect on Binutils.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Last edited by Schol-R-LEA on Wed Jan 06, 2021 3:37 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [UEFI bare bones/x-compiler config] - LD not finding li
PostPosted: Wed Jan 06, 2021 3:37 pm 
Offline
Member
Member

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 1071
Schol-R-LEA wrote:
If so, is there a straightforward way to force it to be built as a static library?

And are there any notable reasons why not to do so, and if so, how do I work around them? I can understand why those triplets would default to that, given that those target triplets are meant mainly for systems which support DLLs/shared libraries, but I would expect that there would be times when a static version would be called for even in general programming practice.

There is a good chance it is building shared libraries. Windows itself does support DLLs, so libgcc ought to be build as a DLL. For freestanding environments, shared libraries won't be supported (at least at first), so we must tell configure to not use shared libs. But as Octocontrabass said, the docs are unclear as to what the defaults are.

_________________
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg


Top
 Profile  
 
 Post subject: Re: [UEFI bare bones/x-compiler config] - LD not finding li
PostPosted: Wed Jan 06, 2021 3:39 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
Very well, then. I will let you know the results when the builds finish.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: [UEFI bare bones/x-compiler config] - LD not finding li
PostPosted: Wed Jan 06, 2021 11:13 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
OK, I ran the script as it was, and got the following error:
Code:
checking how to run the C preprocessor... /lib/cpp
configure: error: in `/home/schol-r-lea/Deployments/cross-dev-utils/gcc/build/x86_64-w64-mingw32/x86_64-w64-mingw32/libgcc':
configure: error: C preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details
make: *** [Makefile:13779: configure-target-libgcc] Error 1


This is the first time this error has come up so far, but it does indicate that it is at least trying to build libgcc, even if there is some problem with the C pre-processor.

I have composed a simplified version of the install script to speed up the testing, having it compile only for the single target triplet, and only for C:

Code:
#!/bin/bash
GCC_SRC="/home/schol-r-lea/Deployments/cross-dev-utils/gcc"
GCC_BUILD="$GCC_SRC/build"
DEST="/home/schol-r-lea/opt/cross"

cd $GCC_SRC
# git pull origin master

cd $GCC_BUILD
TARGET="x86_64-w64-mingw32"
TARGET_DIR="$GCC_BUILD/$TARGET"
if [ ! -d $TARGET_DIR ]; then
   mkdir -p $TARGET_DIR
fi

cd $TARGET_DIR
$GCC_SRC/configure --target=$TARGET --prefix=$DEST --disable-nls \
                   --enable-languages=c \
                   --disable-shared \
                   --without-headers
make all-gcc
make all-target-libgcc
make install-gcc
make install-target-libgcc


Running this gives the following error message:
Code:
/usr/bin/install -c -m 644 b-header-vars /home/schol-r-lea/opt/cross/lib/gcc/x86_64-w64-mingw32/11.0.0/plugin/include/b-header-vars
make[1]: Leaving directory '/home/schol-r-lea/Deployments/common/gcc/build/x86_64-w64-mingw32/gcc'
/bin/sh /home/schol-r-lea/Deployments/cross-dev-utils/gcc/mkinstalldirs /home/schol-r-lea/opt/cross /home/schol-r-lea/opt/cross
make[1]: Entering directory '/home/schol-r-lea/Deployments/common/gcc/build/x86_64-w64-mingw32/x86_64-w64-mingw32/libgcc'
make[1]: *** No rule to make target 'install'.  Stop.
make[1]: Leaving directory '/home/schol-r-lea/Deployments/common/gcc/build/x86_64-w64-mingw32/x86_64-w64-mingw32/libgcc'
make: *** [Makefile:13221: install-target-libgcc] Error 2

What I don't understand about this error is the reference to a common/ directory in the directory above the one I am invoking the script from (/home/schol-r-lea/Deployments/cross-dev-utils). I would expect that, if anything, it would use a common/ directory in /home/schol-r-lea/Deployments/cross-dev-utils/gcc, rather than going two directories up the path.

EDIT: While the /home/schol-r-lea/Deployments/common/ directory does exist, which is where all of the actual source code is kept (the directories in cross-dev-utils/ are all symbolic links to same, something I'd forgotten about) there is no libgcc/ directory there.

I know I am building from the bleeding-edge versions of the GCC source tree, but I am hesitant to assume that there is a fault in the GCC build scripts. I can only assume something is wrong with my own script, but I am unsure what it would be.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: [UEFI bare bones/x-compiler config] - LD not finding li
PostPosted: Wed Jan 06, 2021 11:49 pm 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 898
Give 10.2.0 a try perhaps? I am building it with no problems for i686-elf and x86_64-elf.

I use binutils 2.35, GCC 10.2.0 and newlib 4.0.0. Perhaps not "bleeding edge" but the latest official release.

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: [UEFI bare bones/x-compiler config] - LD not finding li
PostPosted: Wed Jan 06, 2021 11:52 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
kzinti wrote:
Give 10.2.0 a try perhaps? I am building it with no problems for i686-elf and x86_64-elf.

I use binutils 2.35, GCC 10.2.0 and newlib 4.0.0. Perhaps not "bleeding edge" but the latest official release.


That would make sense to at least try, OK.

EDIT: No change. Do I need to download or clone the source code for LibGCC separately from the GCC code?

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: [UEFI bare bones/x-compiler config] - LD not finding li
PostPosted: Thu Jan 07, 2021 12:11 am 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 898
I use zipped source code from here:

http://ftp.gnu.org/gnu/binutils/
http://ftp.gnu.org/gnu/gcc/gcc-10.2.0/

libgcc comes with gcc, there is no separate download.

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: [UEFI bare bones/x-compiler config] - LD not finding li
PostPosted: Thu Jan 07, 2021 10:05 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
I tried compiling the 10.2.0 release, but got the same results.

On going back to the Master build, I removed the --enable-languages option, since it seems that the default is to build all supported languages for a given target triplet, which is what I actually want.

Also, I am getting the error about the C preprocessor failing a sanity check, again. This leads me to a question: given that cpp is a separate program from the compiler, is it bundled with Binutils, or with GCC? Do they both include their own versions? Or is there a separate package for cpp which I ought to download?

Since it is apparently using the system version at lib/cpp, would the mismatch in versions (10.2.0 vs. 11.0.0) be a factor?

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: [UEFI bare bones/x-compiler config] - LD not finding li
PostPosted: Fri Jan 08, 2021 12:16 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
As a quick update, I had a brainfart last night and tried pulling the 10.2.0 tagged branch over my current local, rather than using switch, the practical upshot being that I've had to delete my local and clone it fresh. I am currently building both binutils and gcc again, and hopefully by building the releases/gcc-10 branch I'll be able to see if the discrepancy in the versions of cpp was to blame for the most recent problem.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: [UEFI bare bones/x-compiler config] - LD not finding li
PostPosted: Fri Jan 08, 2021 5:01 pm 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
OK, so I am still getting the failed sanity check error regarding the default version of the C preprocessor when compiling for releases/gcc-10. Something seems to be off with the Manjaro system install for CPP, or at least, the compiling scripts for libgcc seems to think there is when compiling for this given target triplet and a static version of libgcc.

Is there any way to compile CPP independently, and then force the configuration script to compile with that different version?

For now, I am going to build a separate version of GCC for the dev host target triplet (x86_64-pc-linux-gnu) and use that as a bootstrap for the successive cross compiler builds.

If I can't solve this issue, or if other issues keep arising, I may need to shift to using LLVM/Clang for this project, instead.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: [UEFI bare bones/x-compiler config] - LD not finding li
PostPosted: Fri Jan 08, 2021 5:39 pm 
Offline
Member
Member

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 1071
How come you don't just just install the mingw packages from APT? That would be a lot easier. I have had many problems with Clang, so I would stay away from it.

_________________
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 47 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 151 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group