Re: GNU ToolChains Cross Compiler C/C++library issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Kai,
I have realized that I forgot to define the library, I defined the lib.
and  the problem I stated where all these functions(abort, fstatr,...) that
depend on OPSYS are defined (implemented) disappeared.
The problem is fixed. Thanks for your guidance.

 But now I'm getting another problem when I t have tried to compile the the
basic code below






*#include <vector>using namespace std;int main() {       std::vector <int>
v ; //cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
 v.push_back(10);       return 0;}*

the line *v.push_back(10);  *gives undefined *reference *errors








*x86_64-pc-elf-ld: warning: cannot find entry symbol _start; defaulting to
0000000000000080x86_64-pc-elf-ld: x86_64-pc-elf-ld: DWARF error: can't find
.debug_ranges section.src\TugCross.o: in function `std::vector<int,
std::allocator<int> >::_M_check_len(unsigned int, char const*)
const':TugCross.cpp:(.text._ZNKSt6vectorIiSaIiEE12_M_check_lenEjPKc[_ZNKSt6vectorIiSaIiEE12_M_check_lenEjPKc]+0x4e):
undefined reference to `std::__throw_length_error(char
const*)'x86_64-pc-elf-ld: src\TugCross.o: in function
`__gnu_cxx::new_allocator<int>::allocate(unsigned int, void
const*)':TugCross.cpp:(.text._ZN9__gnu_cxx13new_allocatorIiE8allocateEjPKv[_ZN9__gnu_cxx13new_allocatorIiE8allocateEjPKv]+0x44):
undefined reference to
`std::__throw_bad_array_new_length()'x86_64-pc-elf-ld:
TugCross.cpp:(.text._ZN9__gnu_cxx13new_allocatorIiE8allocateEjPKv[_ZN9__gnu_cxx13new_allocatorIiE8allocateEjPKv]+0x49):
undefined reference to `std::__throw_bad_alloc()'x86_64-pc-elf-ld: link
errors found, deleting executable `TugCross'*

When I change the optimization level other than 0, the problem goes away.
I guess  it's a static library issue, at the link stage.

Other then tha,t when  I try to create a string using* std::string *

I encounter  the errors:

*TugCross.cpp:(.text+0x2b): undefined reference to
`std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >::basic_string()'x86_64-pc-elf-ld:
TugCross.cpp:(.text+0x3d): undefined reference to
`std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >::~basic_string()'*

Any idea?
Thanks in advance
Tuğrul







On Tue, Aug 1, 2023 at 1:18 AM Kai Ruottu <kai.ruottu@xxxxxxxxxxx> wrote:

>
> Tuğrul Akyüz via Gcc-help kirjoitti 31.7.2023 klo 10.07:
> > Hello
> >
> > I built a GNU toolchain using the main parameter below:
> >
> > build=i686-w64-mingw32
> >
> > host=i686-w64-mingw32
> >
> > target=x86_64-pc-elf
> >
> > I used GCC 11.3 , binutil 2.40 and newlib 4.3.0
> >
> > I created executives with prefix x86_64-pc-elf-...exe
> >
> D:\MinGWCompUpdates\msys\1.0\build\x86_64-pc-elf_11.3.0_odk\x86_64-pc-elf\newlib\x86_64-pc-elf\x32\pic\newlib/../../../../../../newlib-4.3.0/newlib/libc/stdlib/abort.c:59:
> > undefined reference to `_exit'
> >
> >
> D:\MinGWCompUpdates\msys\1.0\build\x86_64-pc-elf_11.3.0_odk\x86_64-pc-elf\newlib\x86_64-pc-elf\x32\pic\newlib/../../../../../../newlib-4.3.0/newlib/libc/reent/fstatr.c:55:
> > undefined reference to `fstat'
> >
> >
> D:\MinGWCompUpdates\msys\1.0\build\x86_64-pc-elf_11.3.0_odk\x86_64-pc-elf\newlib\x86_64-pc-elf\x32\pic\newlib/../../../../../../newlib-4.3.0/newlib/libc/reent/isattyr.c:52:
> > undefined reference to `isatty'
>
> A simple question for this case is : What is the x86_64 firmware/board
> you expect the executables being made?
>
> Newlib has the hardware/firmware dependent things collected in the
> "libgloss" library, "glue library" and the undefined functions
> should be in it for different hardware/firmware choices. The 32-bit
> 'i*86-elf' target used to have nothing as default, I don't know
> whether the 64-bit 'x86_64-elf' now has some "development board" with a
> known firmware as the default. Like a mainboard in a PC
> with the BIOS or something in solid memory providing basic input/output
> routines.
>
> OK, I had only the newlib-4.1.0 sources now and there was no 'x86_64'
> subdir in its libgloss sources. The 'i386' one seemed to
> have support for the Cygnus "Cygmon" firmware monitor :
>
> "/*
>   * Standard x86 syscalls for user programs running under Cygmon
>   *
>   * Copyright (c) 1998, 2000 Cygnus Support
>   *
>   * The authors hereby grant permission to use, copy, modify, distribute,
>   * and license this software and its documentation for any purpose,
> provided
>   * that existing copyright notices are retained in all copies and that
> this
>   * notice is included verbatim in any distributions. No written agreement,
>   * license, or royalty fee is required for any of the authorized uses.
>   * Modifications to this software may be copyrighted by their authors
>   * and need not follow the licensing terms described here, provided that
>   * the new terms are clearly indicated on the first page of each file
> where
>   * they apply.
>   */"
>
>
>




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux