public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* undefined reference when building GCC-4.8.1 MinGW-W64
@ 2022-09-06 11:23 i.nixman
  2022-09-06 11:36 ` i.nixman
  0 siblings, 1 reply; 5+ messages in thread
From: i.nixman @ 2022-09-06 11:23 UTC (permalink / raw)
  To: gcc-help

Hello guys!

a long time ago I successfully built this version of the GCC-4.8.1, and 
I'm pretty sure I used the same options.

but now, on stage3 I get a linking error:

x86_64-w64-mingw32-g++   -g -DIN_GCC   -fno-exceptions -fno-rtti 
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings 
-Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long 
-Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H 
-static-libstdc++ -static-libgcc -pipe -fno-ident 
-L/home/Raj/mingw-gcc-4.8.1/x86_64-481-posix-sjlj-rt_v9/mingw64/opt/lib 
-L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-zlib-static/lib 
-L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-static/lib  
-Wl,--stack,12582912 -o cc1plus.exe \
       cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/decl.o cp/expr.o 
cp/pt.o cp/typeck2.o cp/class.o cp/decl2.o cp/error.o cp/lex.o 
cp/parser.o cp/ptree.o cp/rtti.o cp/typeck.o cp/cvt.o cp/except.o 
cp/friend.o cp/init.o cp/method.o cp/search.o cp/semantics.o cp/tree.o 
cp/repo.o cp/dump.o cp/optimize.o cp/mangle.o cp/cp-objcp-common.o 
cp/name-lookup.o cp/cxx-pretty-print.o cp/cp-gimplify.o attribs.o 
incpath.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o 
c-family/c-format.o c-family/c-gimplify.o c-family/c-lex.o 
c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o 
c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o 
c-family/c-semantics.o c-family/c-ada-spec.o tree-mudflap.o i386-c.o 
winnt-cxx.o msformat-c.o default-c.o cc1plus-checksum.o libbackend.a 
main.o  libcommon-target.a libcommon.a ../libcpp/libcpp.a 
../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a  -liconv 
../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a 
../libdecnumber/libdecnumber.a  
-L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-static/lib 
-lcloog-isl 
-L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-static/lib 
-lisl 
-L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-static/lib 
-L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-static/lib 
-L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-static/lib 
-lmpc -lmpfr -lgmp   -lz
cp/except.o: In function `nothrow_libfn_p(tree_node const*)':
C:\msys64\home\Raj\mingw-gcc-4.8.1\x86_64-481-posix-sjlj-rt_v9\build\gcc-4.8.1\gcc/../../../../src/gcc-4.8.1/gcc/cp/except.c:1025: 
undefined reference to `libc_name_p(char const*, unsigned int)'
collect2.exe: error: ld returned 1 exit status


any ideas?



thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: undefined reference when building GCC-4.8.1 MinGW-W64
  2022-09-06 11:23 undefined reference when building GCC-4.8.1 MinGW-W64 i.nixman
@ 2022-09-06 11:36 ` i.nixman
  2022-09-06 12:54   ` Xi Ruoyao
  0 siblings, 1 reply; 5+ messages in thread
From: i.nixman @ 2022-09-06 11:36 UTC (permalink / raw)
  To: Gcc Help

On 2022-09-06 11:23, i.nixman--- via Gcc-help wrote:
> Hello guys!
> 
> a long time ago I successfully built this version of the GCC-4.8.1,
> and I'm pretty sure I used the same options.
> 
> but now, on stage3 I get a linking error:
> 
> x86_64-w64-mingw32-g++   -g -DIN_GCC   -fno-exceptions -fno-rtti
> -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
> -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long
> -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H
> -static-libstdc++ -static-libgcc -pipe -fno-ident
> -L/home/Raj/mingw-gcc-4.8.1/x86_64-481-posix-sjlj-rt_v9/mingw64/opt/lib
> -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-zlib-static/lib
> -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-static/lib
>  -Wl,--stack,12582912 -o cc1plus.exe \
>       cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/decl.o cp/expr.o
> cp/pt.o cp/typeck2.o cp/class.o cp/decl2.o cp/error.o cp/lex.o
> cp/parser.o cp/ptree.o cp/rtti.o cp/typeck.o cp/cvt.o cp/except.o
> cp/friend.o cp/init.o cp/method.o cp/search.o cp/semantics.o cp/tree.o
> cp/repo.o cp/dump.o cp/optimize.o cp/mangle.o cp/cp-objcp-common.o
> cp/name-lookup.o cp/cxx-pretty-print.o cp/cp-gimplify.o attribs.o
> incpath.o c-family/c-common.o c-family/c-cppbuiltin.o
> c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o
> c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o
> c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o
> c-family/c-semantics.o c-family/c-ada-spec.o tree-mudflap.o i386-c.o
> winnt-cxx.o msformat-c.o default-c.o cc1plus-checksum.o libbackend.a
> main.o  libcommon-target.a libcommon.a ../libcpp/libcpp.a
> ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a  -liconv
> ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a
> ../libdecnumber/libdecnumber.a
> -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-static/lib
> -lcloog-isl
> -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-static/lib
> -lisl
> -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-static/lib
> -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-static/lib
> -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-static/lib
> -lmpc -lmpfr -lgmp   -lz
> cp/except.o: In function `nothrow_libfn_p(tree_node const*)':
> C:\msys64\home\Raj\mingw-gcc-4.8.1\x86_64-481-posix-sjlj-rt_v9\build\gcc-4.8.1\gcc/../../../../src/gcc-4.8.1/gcc/cp/except.c:1025:
> undefined reference to `libc_name_p(char const*, unsigned int)'
> collect2.exe: error: ld returned 1 exit status
> 
> 
> any ideas?
> 
> 
> 
> thanks!

I think this problem may occur due to the use of this patch:

https://github.com/niXman/mingw-builds/blob/develop/patches/gcc/gcc-4.6-fix_mismatch_in_gnu_inline_attributes.patch

right?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: undefined reference when building GCC-4.8.1 MinGW-W64
  2022-09-06 11:36 ` i.nixman
@ 2022-09-06 12:54   ` Xi Ruoyao
  2022-09-07 11:04     ` i.nixman
  0 siblings, 1 reply; 5+ messages in thread
From: Xi Ruoyao @ 2022-09-06 12:54 UTC (permalink / raw)
  To: i.nixman, Gcc Help

On Tue, 2022-09-06 at 11:36 +0000, i.nixman--- via Gcc-help wrote:
> On 2022-09-06 11:23, i.nixman--- via Gcc-help wrote:
> > Hello guys!
> > 
> > a long time ago I successfully built this version of the GCC-4.8.1,
> > and I'm pretty sure I used the same options.
> > 
> > but now, on stage3 I get a linking error:
> > 
> > x86_64-w64-mingw32-g++   -g -DIN_GCC   -fno-exceptions -fno-rtti
> > -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
> > -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long
> > -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H
> > -static-libstdc++ -static-libgcc -pipe -fno-ident
> > -L/home/Raj/mingw-gcc-4.8.1/x86_64-481-posix-sjlj-
> > rt_v9/mingw64/opt/lib
> > -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-zlib-static/lib
> > -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-
> > static/lib
> >  -Wl,--stack,12582912 -o cc1plus.exe \
> >       cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/decl.o
> > cp/expr.o
> > cp/pt.o cp/typeck2.o cp/class.o cp/decl2.o cp/error.o cp/lex.o
> > cp/parser.o cp/ptree.o cp/rtti.o cp/typeck.o cp/cvt.o cp/except.o
> > cp/friend.o cp/init.o cp/method.o cp/search.o cp/semantics.o
> > cp/tree.o
> > cp/repo.o cp/dump.o cp/optimize.o cp/mangle.o cp/cp-objcp-common.o
> > cp/name-lookup.o cp/cxx-pretty-print.o cp/cp-gimplify.o attribs.o
> > incpath.o c-family/c-common.o c-family/c-cppbuiltin.o
> > c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o
> > c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o
> > c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o
> > c-family/c-semantics.o c-family/c-ada-spec.o tree-mudflap.o i386-c.o
> > winnt-cxx.o msformat-c.o default-c.o cc1plus-checksum.o libbackend.a
> > main.o  libcommon-target.a libcommon.a ../libcpp/libcpp.a
> > ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a  -
> > liconv
> > ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a
> > ../libdecnumber/libdecnumber.a
> > -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-
> > static/lib
> > -lcloog-isl
> > -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-
> > static/lib
> > -lisl
> > -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-
> > static/lib
> > -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-
> > static/lib
> > -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-
> > static/lib
> > -lmpc -lmpfr -lgmp   -lz
> > cp/except.o: In function `nothrow_libfn_p(tree_node const*)':
> > C:\msys64\home\Raj\mingw-gcc-4.8.1\x86_64-481-posix-sjlj-
> > rt_v9\build\gcc-4.8.1\gcc/../../../../src/gcc-
> > 4.8.1/gcc/cp/except.c:1025:
> > undefined reference to `libc_name_p(char const*, unsigned int)'
> > collect2.exe: error: ld returned 1 exit status
> > 
> > 
> > any ideas?
> > 
> > 
> > 
> > thanks!
> 
> I think this problem may occur due to the use of this patch:
> 
> https://github.com/niXman/mingw-builds/blob/develop/patches/gcc/gcc-4.6-fix_mismatch_in_gnu_inline_attributes.patch

This patch has never been in mainline GCC.  And it's 2022 so you should
not use gcc-4.8 or 4.6 anymore.

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: undefined reference when building GCC-4.8.1 MinGW-W64
  2022-09-06 12:54   ` Xi Ruoyao
@ 2022-09-07 11:04     ` i.nixman
  2022-09-07 14:35       ` LIU Hao
  0 siblings, 1 reply; 5+ messages in thread
From: i.nixman @ 2022-09-07 11:04 UTC (permalink / raw)
  To: Xi Ruoyao, Gcc Help

On 2022-09-06 12:54, Xi Ruoyao wrote:
> On Tue, 2022-09-06 at 11:36 +0000, i.nixman--- via Gcc-help wrote:
>> On 2022-09-06 11:23, i.nixman--- via Gcc-help wrote:
>> > Hello guys!
>> >
>> > a long time ago I successfully built this version of the GCC-4.8.1,
>> > and I'm pretty sure I used the same options.
>> >
>> > but now, on stage3 I get a linking error:
>> >
>> > x86_64-w64-mingw32-g++   -g -DIN_GCC   -fno-exceptions -fno-rtti
>> > -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
>> > -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long
>> > -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H
>> > -static-libstdc++ -static-libgcc -pipe -fno-ident
>> > -L/home/Raj/mingw-gcc-4.8.1/x86_64-481-posix-sjlj-
>> > rt_v9/mingw64/opt/lib
>> > -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-zlib-static/lib
>> > -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-
>> > static/lib
>> >  -Wl,--stack,12582912 -o cc1plus.exe \
>> >       cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/decl.o
>> > cp/expr.o
>> > cp/pt.o cp/typeck2.o cp/class.o cp/decl2.o cp/error.o cp/lex.o
>> > cp/parser.o cp/ptree.o cp/rtti.o cp/typeck.o cp/cvt.o cp/except.o
>> > cp/friend.o cp/init.o cp/method.o cp/search.o cp/semantics.o
>> > cp/tree.o
>> > cp/repo.o cp/dump.o cp/optimize.o cp/mangle.o cp/cp-objcp-common.o
>> > cp/name-lookup.o cp/cxx-pretty-print.o cp/cp-gimplify.o attribs.o
>> > incpath.o c-family/c-common.o c-family/c-cppbuiltin.o
>> > c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o
>> > c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o
>> > c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o
>> > c-family/c-semantics.o c-family/c-ada-spec.o tree-mudflap.o i386-c.o
>> > winnt-cxx.o msformat-c.o default-c.o cc1plus-checksum.o libbackend.a
>> > main.o  libcommon-target.a libcommon.a ../libcpp/libcpp.a
>> > ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a  -
>> > liconv
>> > ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a
>> > ../libdecnumber/libdecnumber.a
>> > -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-
>> > static/lib
>> > -lcloog-isl
>> > -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-
>> > static/lib
>> > -lisl
>> > -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-
>> > static/lib
>> > -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-
>> > static/lib
>> > -L/home/Raj/mingw-gcc-4.8.1/prerequisites/x86_64-w64-mingw32-
>> > static/lib
>> > -lmpc -lmpfr -lgmp   -lz
>> > cp/except.o: In function `nothrow_libfn_p(tree_node const*)':
>> > C:\msys64\home\Raj\mingw-gcc-4.8.1\x86_64-481-posix-sjlj-
>> > rt_v9\build\gcc-4.8.1\gcc/../../../../src/gcc-
>> > 4.8.1/gcc/cp/except.c:1025:
>> > undefined reference to `libc_name_p(char const*, unsigned int)'
>> > collect2.exe: error: ld returned 1 exit status
>> >
>> >
>> > any ideas?
>> >
>> >
>> >
>> > thanks!
>> 
>> I think this problem may occur due to the use of this patch:
>> 
>> https://github.com/niXman/mingw-builds/blob/develop/patches/gcc/gcc-4.6-fix_mismatch_in_gnu_inline_attributes.patch
> 
> This patch has never been in mainline GCC.  And it's 2022 so you should
> not use gcc-4.8 or 4.6 anymore.

great, but without that patch I still get the error:

In file included from ../../../../src/gcc-4.8.1/gcc/cp/except.c:1005:
cfns.gperf:101:1: error: 'const char* libc_name_p(const char*, unsigned 
int)' redeclared inline with 'gnu_inline' attribute
cfns.gperf:26:14: note: 'const char* libc_name_p(const char*, unsigned 
int)' previously declared here
cfns.gperf:26:14: warning: inline function 'const char* 
libc_name_p(const char*, unsigned int)' used but never defined

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: undefined reference when building GCC-4.8.1 MinGW-W64
  2022-09-07 11:04     ` i.nixman
@ 2022-09-07 14:35       ` LIU Hao
  0 siblings, 0 replies; 5+ messages in thread
From: LIU Hao @ 2022-09-07 14:35 UTC (permalink / raw)
  To: i.nixman, Xi Ruoyao, Gcc Help


[-- Attachment #1.1: Type: text/plain, Size: 1523 bytes --]

在 2022-09-07 19:04, i.nixman--- via Gcc-help 写道:
> 
> great, but without that patch I still get the error:
> 
> In file included from ../../../../src/gcc-4.8.1/gcc/cp/except.c:1005:
> cfns.gperf:101:1: error: 'const char* libc_name_p(const char*, unsigned int)' redeclared inline with 
> 'gnu_inline' attribute
> cfns.gperf:26:14: note: 'const char* libc_name_p(const char*, unsigned int)' previously declared here
> cfns.gperf:26:14: warning: inline function 'const char* libc_name_p(const char*, unsigned int)' used 
> but never defined

For the sake of simplicity, I suspect it is possible to make `libc_name_p()` a `static __inline` 
function, as I see it be referenced only ever once in 'except.c'.

When attempting to compile 'except.c' as C++ with GCC 4.8 and with the patch which you have 
mentioned, this function is a `gnu_inline` function with an implicit `extern` [1], so rule 1.3 [2] 
applies: Because optimization is not enabled, a call to an external function is emitted; and because 
no out-of-line definition is available, undefined reference is the result.

Use of the `gnu_inline` attribute on an `extern` function requires there be a definition that is 
compiled without `gnu_inline` or `inline`. Probably it can be removed when `__cplusplus` is defined.


[1] This differs from C, where `inline` has a distinct meaning from `extern inline`.
[2] https://github.com/lhmouse/mcfgthread/wiki/Differences-between-GNU,-C99-and-C---%60inline%60


-- 
Best regards,
LIU Hao

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-07 14:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-06 11:23 undefined reference when building GCC-4.8.1 MinGW-W64 i.nixman
2022-09-06 11:36 ` i.nixman
2022-09-06 12:54   ` Xi Ruoyao
2022-09-07 11:04     ` i.nixman
2022-09-07 14:35       ` LIU Hao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).