pkgsrc-Bugs archive

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

Re: pkg/54357: editor/ted editor does not build on macosx



The following reply was made to PR pkg/54357; it has been noted by GNATS.

From: =?utf-8?Q?cl=C3=A9ment_bouvier?= <clement.bouvier.europe%gmail.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: pkg-manager%netbsd.org@localhost,
 gnats-admin%netbsd.org@localhost,
 pkgsrc-bugs%netbsd.org@localhost
Subject: Re: pkg/54357: editor/ted editor does not build on macosx
Date: Wed, 10 Jul 2019 09:49:51 +0400

 Hi David,
 
 About the general part with macosx (with the context of the package).
 $ uname -a:
 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; =
 root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
 
 $ cat foo.c
 int i;
 
 $ cat bar.c
 extern int i;
 
 int inc(int s) {
     return i + s;=20
 }=20
 
 $ cat main.c
 #include <stdio.h>
 
 int inc(int s);
 
 int main(void) {
     printf("result: %d\n ", inc(1));
 }
 
 $ cc -c foo.c ; cc -c bar.c ; cc -c main.c
 
 $ nm -g foo.o
 0000000000000004 C _i
 
 $ nm -g bar.o
                                  U _i
 0000000000000000 T _inc
 
 $ nm -g main.o
                                  U _inc
 0000000000000000 T _main
                                  U _printf
 
 Now I want to create an archive with ar  and a table of symbols
 
 $ ar -rc foobar.a foo.o bar.o
 $ ranlib foobar.a
 
 Let's create the binary:
 $ cc -o app main.o foobar.a
 Undefined symbols for architecture x86_64:
      "_i", referenced from:
            _inc in foobar.a(bar.o)
           (maybe you meant: _inc)
 ld: symbol(s) not found for architecture x86_64
 clang: error: linker command failed with exit code 1 (use -v to see =
 invocation)
 
 Let's look at the TOC in foobar.a
 
 $ ar -x foobar.a '__.SYMDEF SORTED'
 $ od -c __.SYMDEF\ SORTED=20
 0000000   \b  \0  \0  \0  \0  \0  \0  \0  \b 002  \0  \0  \b  \0  \0  \0
 0000020    _   i   n   c  \0  \0  \0  \0                               =20=
 
 0000030
 
 There is no i symbol.
 Now the man of ranlib tells about -c flags:
 "Include  common  symbols  as  definitions  with  respect to the table =
 of contents.  This is seldom the intended behavior for linking from a
  library, as it forces the linking of a library member just because it =
 uses an uninitialized global that is undefined at that point  in  the
  linking.  This option is included only because this was the original =
 behavior of ranlib.  This option is not the default."
 
 Let's see:
 $ranlib -c foobar.a
 
 $ cc -o app main.o foobar.a ; ./app
 result: 1
 
 Now the TOC in footer.a has i symbol:
 
 $ ar -x  foobar.a '__.SYMDEF SORTED'
 $ od -c  __.SYMDEF\ SORTED
 0000000  020  \0  \0  \0  \0  \0  \0  \0   x  \0  \0  \0 003  \0  \0  \0
 0000020  020 002  \0  \0  \b  \0  \0  \0   _   i  \0   _   i   n   c  \0
 0000040
 
 About the ted editor, you have a linker error:
 
 Undefined symbols for architecture x86_64:
   "_UNI_DingbatsCodeSet", referenced from:
       _appFontOpenX11Fonts in appFrame.a(appFontX11.o)
   "_UNI_DingbatsToGlyphMapping", referenced from:
       _appFontOpenX11Fonts in appFrame.a(appFontX11.o)
       _utilTextConverterConvertFromUtf8 in =
 appUtil.a(utilTextConverter.o)
   "_UNI_SymbolCodeSet", referenced from:
       _appFontOpenX11Fonts in appFrame.a(appFontX11.o)
   "_UNI_SymbolToGlyphMapping", referenced from:
       _appFontOpenX11Fonts in appFrame.a(appFontX11.o)
       _utilTextConverterConvertFromUtf8 in =
 appUtil.a(utilTextConverter.o)
 ld: symbol(s) not found for architecture x86_64
 
 $ nm -g work/Ted-2.21/appFrame/appFontX11.o | grep _UNI
                  U _UNI_DingbatsCodeSet
                  U _UNI_DingbatsToGlyphMapping
                  U _UNI_SymbolCodeSet
                  U _UNI_SymbolToGlyphMapping
 
 $ grep -rn '_UNI_DingbatsCodeSet' work/Ted-2.21/
 Binary file work/Ted-2.21//appUtil/uniLegacyMapping.o matches
 Binary file work/Ted-2.21//appFrame/appFontX11.o matches
 Binary file work/Ted-2.21//lib/appUtil.a matches
 Binary file work/Ted-2.21//lib/appFrame.a matches
 
 $ nm -g work/Ted-2.21/appUtil/uniLegacyMapping.o
 0000000000000010 C _UNI_DingbatsCodeSet
 0000000000000010 C _UNI_DingbatsToGlyphMapping
 0000000000000010 C _UNI_SymbolCodeSet
 0000000000000010 C _UNI_SymbolToGlyphMapping
 
 The archive appFrame.a is built with ar and ranlib without the -c flags =
 (normal but it is not the default on macosx).
 
 Of course we can use the cflag -fno-common. We avoid the common-symbols =
 and so Ted finally builds.
 
 Do I answer to your question?
 
 Cl=C3=A9ment.
 
 
 
 
 
 > Le 9 juil. 2019 =C3=A0 21:00, David Holland =
 <dholland-pbugs%netbsd.org@localhost> a =C3=A9crit :
 >=20
 > The following reply was made to PR pkg/54357; it has been noted by =
 GNATS.
 >=20
 > From: David Holland <dholland-pbugs%netbsd.org@localhost>
 > To: gnats-bugs%netbsd.org@localhost
 > Cc:=20
 > Subject: Re: pkg/54357: editor/ted editor does not build on macosx
 > Date: Tue, 9 Jul 2019 16:57:06 +0000
 >=20
 > On Sun, Jul 07, 2019 at 01:05:00PM +0000, =
 clement.bouvier.europe%gmail.com@localhost wrote:
 >> +# ranlib on macos does not include common-symbol in the table of =
 contents.
 >=20
 > Is this true in general or caused by something about this package?
 > Because if the former, I find it hard to believe this hasn't exploded
 > 5000 other packages...
 >=20
 > --=20
 > David A. Holland
 > dholland%netbsd.org@localhost
 >=20
 


Home | Main Index | Thread Index | Old Index