cannot build wxpdfdocument for osx32/64 with clang on linux (cross-compilation)

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

cannot build wxpdfdocument for osx32/64 with clang on linux (cross-compilation)

Frédéric Bron
Hi,

Here am I again with my cross-compilation...
I want to cross-compile wxpdfdoc on linux to target osx32 or 64.
But it does not work.

I build wxwidgets with static libraries (see procedure below).
Then I try to build wxpdfdoc as follows:
CC="i386-apple-darwin13-clang"
 CFLAGS="-g3"
 CXX="i386-apple-darwin13-clang++-libc++"
 CXXFLAGS="-g3 -std=c++14"
 OBJCXXFLAGS="-g3 -std=c++14"
 AR="i386-apple-darwin13-ar"
 AS="i386-apple-darwin13-as"
 RANLIB="i386-apple-darwin13-ranlib"
 WX_CONFIG=/softs/osx32-clang-3.9.1/debug/wx/bin/wx-config
 ../wxpdfdoc-bcfcd2f/configure
 --prefix=/softs/osx32-clang-3.9.1/debug/wxpdfdoc
 --build=x86_64-unknown-linux-gnu
 --host=i386-apple-darwin13
 --enable-static
 --disable-shared
 --with-wx-config=/softs/osx32-clang-3.9.1/debug/wx/bin/wx-config
 --with-wx-prefix=/softs/osx32-clang-3.9.1/debug/wx

Some checks:
> checking build system type... x86_64-unknown-linux-gnu
> checking host system type... i386-apple-darwin13
> checking whether we are cross compiling... yes

This may be the cause of my issues:
> checking for i386-apple-darwin13-objdump... no
> checking for objdump... objdump
> configure: WARNING: using cross tools not prefixed with host triplet

My cross compiler does not come with objdump. Instead, I have
i386-apple-darwin13-ObjectDump. I also have i386-apple-darwin13-nm but
not i386-apple-darwin13-objdump.

I see that when I cross-compile wxwidgets for osx, configure does not
look for objdump.

> checking if wxWidgets was built in STATIC mode... yes
> checking which wxWidgets toolkit was selected... osx_cocoa


Then when I run make, I get:

...

  CXXLD    libwxcode_osx_cocoau_pdfdoc-3.1.la

*** Warning: Linking the shared library
libwxcode_osx_cocoau_pdfdoc-3.1.la against the
*** static library
/softs/osx32-clang-3.9.1/debug/wx/lib/libwx_osx_cocoau_core-3.1-i386-apple-darwin13.a
is not portable!

*** Warning: Linking the shared library
libwxcode_osx_cocoau_pdfdoc-3.1.la against the
*** static library
/softs/osx32-clang-3.9.1/debug/wx/lib/libwx_baseu_xml-3.1-i386-apple-darwin13.a
is not portable!

*** Warning: Linking the shared library
libwxcode_osx_cocoau_pdfdoc-3.1.la against the
*** static library
/softs/osx32-clang-3.9.1/debug/wx/lib/libwx_baseu-3.1-i386-apple-darwin13.a
is not portable!
 CXXLD    samples/minimal/minimal
libtool: link: warning: `-no-install' is ignored for i386-apple-darwin13
libtool: link: warning: assuming `-no-fast-install' instead
/softs/osx32-clang-3.9.1/debug/build/wxpdfdoc-bcfcd2f/makefont/makefont.cpp:1497:18:
warning: comparison of unsigned expression >= 0 is always true
[-Wtautological-compare]
         if (cc >= 0 && cc < 0xFFFF)
             ~~ ^  ~
ld: warning: ignoring file ./.libs/libwxcode_osx_cocoau_pdfdoc-3.1.a,
file was built for archive which is not the architecture being linked
(i386): ./.libs/libwxcode_osx_cocoau_pdfdoc-3.1.a
Undefined symbols for architecture i386:
 "wxPdfLayer::SetZoom(double, double)", referenced from:
     LayerRadioGroup(bool) in layers.o
 "wxPdfLayer::AddChild(wxPdfLayer*)", referenced from:
     GroupedLayers(bool) in layers.o
     NestedLayers(bool) in layers.o
     AutomaticLayers(bool) in layers.o
     LayerRadioGroup(bool) in layers.o
 "wxPdfLayer::SetPrint(wxString const&, bool)", referenced from:
     LayerRadioGroup(bool) in layers.o

this is followed by many other similar error messages and then:
> ld: symbol(s) not found for architecture i386
> clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation)

Frédéric


* Procedure to build wxwidgets:
CC="i386-apple-darwin13-clang"\
  CFLAGS="-g3" CXX="i386-apple-darwin13-clang++-libc++"\
  CXXFLAGS="-g3 -std=c++14"\
  OBJCXXFLAGS="-g3 -std=c++14"\
  ../wxwidgets-3ae438b/configure\
  --prefix=/softs/osx32-clang-3.9.1/debug/wx\
  --build=x86_64-unknown-linux-gnu\
  --host=i386-apple-darwin13\
  --disable-shared\
  ...\
  --with-cxx=14\
  --with-osx\
  --disable-optimise\
  --enable-debug

make
make install

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users
Reply | Threaded
Open this post in threaded view
|

Re: cannot build wxpdfdocument for osx32/64 with clang on linux (cross-compilation)

Vadim Zeitlin-4
On Mon, 17 Apr 2017 18:47:52 +0200 Frédéric Bron wrote:

FB> Here am I again with my cross-compilation...
FB> I want to cross-compile wxpdfdoc on linux to target osx32 or 64.

 You seem to be cross-compiling for i386-apple-darwin target, what happens
if you try the x86_64-apple-darwin one?

FB> This may be the cause of my issues:
FB> > checking for i386-apple-darwin13-objdump... no
FB> > checking for objdump... objdump
FB> > configure: WARNING: using cross tools not prefixed with host triplet

 This check must be done by libtool, but AFAIK it only uses objdump for
some file type checks, so, hopefully, it should still work even without it.
Although it's weird that you don't have objdump because it does exist under
macOS, normally.

FB> ld: warning: ignoring file ./.libs/libwxcode_osx_cocoau_pdfdoc-3.1.a,
FB> file was built for archive which is not the architecture being linked
FB> (i386): ./.libs/libwxcode_osx_cocoau_pdfdoc-3.1.a

 This is the real problem. What is the actual architecture of this file?
You can run file(1) on it to check it and it would be really useful to know
this because I have no idea about what else could it be.

FB> Undefined symbols for architecture i386:
...
FB> this is followed by many other similar error messages and then:
FB> > ld: symbol(s) not found for architecture i386
FB> > clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation)

 If it doesn't find the library at all, it's not surprising that it fails
to link.

 Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/

attachment0 (203 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: cannot build wxpdfdocument for osx32/64 with clang on linux (cross-compilation)

Frédéric Bron
>  You seem to be cross-compiling for i386-apple-darwin target, what happens
> if you try the x86_64-apple-darwin one?

exactly the same:
*** Warning: Linking the shared library
libwxcode_osx_cocoau_pdfdoc-3.1.la against the
*** static library
/softs/osx64-clang-3.9.1/debug/wx/lib/libwx_osx_cocoau_core-3.1-x86_64-apple-darwin13.a
is not portable!

*** Warning: Linking the shared library
libwxcode_osx_cocoau_pdfdoc-3.1.la against the
*** static library
/softs/osx64-clang-3.9.1/debug/wx/lib/libwx_baseu_xml-3.1-x86_64-apple-darwin13.a
is not portable!

*** Warning: Linking the shared library
libwxcode_osx_cocoau_pdfdoc-3.1.la against the
*** static library
/softs/osx64-clang-3.9.1/debug/wx/lib/libwx_baseu-3.1-x86_64-apple-darwin13.a
is not portable!

  CXXLD    samples/minimal/minimal
libtool: link: warning: `-no-install' is ignored for x86_64-apple-darwin13
libtool: link: warning: assuming `-no-fast-install' instead
  CXXLD    samples/pdfdc/pdfdc
libtool: link: warning: `-no-install' is ignored for x86_64-apple-darwin13
libtool: link: warning: assuming `-no-fast-install' instead
ld: warning: ignoring file ./.libs/libwxcode_osx_cocoau_pdfdoc-3.1.a,
file was built for archive which is not the architecture being linked
(x86_64): ./.li>
ld: warning: ignoring file ./.libs/libwxcode_osx_cocoau_pdfdoc-3.1.a,
file was built for archive which is not the architecture being linked
(x86_64): ./.li>
  CXXLD    showfont/showfont
Undefined symbols for architecture x86_64:
  "wxPdfLayer::SetZoom(double, double)", referenced from:
      LayerRadioGroup(bool) in layers.o
  "wxPdfLayer::AddChild(wxPdfLayer*)", referenced from:
      GroupedLayers(bool) in layers.o
      NestedLayers(bool) in layers.o
      AutomaticLayers(bool) in layers.o
      LayerRadioGroup(bool) in layers.o
...

> FB> ld: warning: ignoring file ./.libs/libwxcode_osx_cocoau_pdfdoc-3.1.a,
> FB> file was built for archive which is not the architecture being linked
> FB> (i386): ./.libs/libwxcode_osx_cocoau_pdfdoc-3.1.a
>
>  This is the real problem. What is the actual architecture of this file?
> You can run file(1) on it to check it and it would be really useful to know
> this because I have no idea about what else could it be.

not sure this gives what you expected:
$ file libwxcode_osx_cocoau_pdfdoc-3.1.a
libwxcode_osx_cocoau_pdfdoc-3.1.a: current ar archive

Frédéric

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users
Reply | Threaded
Open this post in threaded view
|

Re[2]: cannot build wxpdfdocument for osx32/64 with clang on linux (cross-compilation)

Vadim Zeitlin-4
On Sat, 29 Apr 2017 18:08:24 +0200 Frédéric Bron wrote:

FB> >  You seem to be cross-compiling for i386-apple-darwin target, what happens
FB> > if you try the x86_64-apple-darwin one?
FB>
FB> exactly the same:
...
FB> ld: warning: ignoring file ./.libs/libwxcode_osx_cocoau_pdfdoc-3.1.a,
FB> file was built for archive which is not the architecture being linked
FB> (x86_64):

 The only explanation I have is that it ends up being compiled using the
native compiler and not the cross-compiler at all then...

FB> not sure this gives what you expected:
FB> $ file libwxcode_osx_cocoau_pdfdoc-3.1.a
FB> libwxcode_osx_cocoau_pdfdoc-3.1.a: current ar archive

 Apparently only macOS own "file" is smart enough to give the architecture
of the library. But try it on any of the object files, please, e.g.
"pdfdc.o": surely it should have the same architecture as the library
created from it and "file" should tell you what it is.

 Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/

attachment0 (203 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Re[2]: cannot build wxpdfdocument for osx32/64 with clang on linux (cross-compilation)

Frédéric Bron
> But try it on any of the object files, please, e.g.
> "pdfdc.o": surely it should have the same architecture as the library
> created from it and "file" should tell you what it is.

for osx32:
pdfxml.o: Mach-O i386 object, flags:<|SUBSECTIONS_VIA_SYMBOLS>
pdfdc.o: Mach-O i386 object, flags:<|SUBSECTIONS_VIA_SYMBOLS>

for osx64:
pdfxml.o: Mach-O 64-bit x86_64 object, flags:<|SUBSECTIONS_VIA_SYMBOLS>
pdfdc.o:  Mach-O 64-bit x86_64 object, flags:<|SUBSECTIONS_VIA_SYMBOLS>

sounds OK?

Frédéric

--
Please read http://www.wxwidgets.org/support/mlhowto.htm before posting.

To unsubscribe, send email to [hidden email]
or visit http://groups.google.com/group/wx-users
Reply | Threaded
Open this post in threaded view
|

Re[4]: cannot build wxpdfdocument for osx32/64 with clang on linux (cross-compilation)

Vadim Zeitlin-4
On Sat, 29 Apr 2017 20:30:40 +0200 Frédéric Bron wrote:

FB> > But try it on any of the object files, please, e.g.
FB> > "pdfdc.o": surely it should have the same architecture as the library
FB> > created from it and "file" should tell you what it is.
FB>
FB> for osx32:
FB> pdfxml.o: Mach-O i386 object, flags:<|SUBSECTIONS_VIA_SYMBOLS>
FB> pdfdc.o: Mach-O i386 object, flags:<|SUBSECTIONS_VIA_SYMBOLS>
FB>
FB> for osx64:
FB> pdfxml.o: Mach-O 64-bit x86_64 object, flags:<|SUBSECTIONS_VIA_SYMBOLS>
FB> pdfdc.o:  Mach-O 64-bit x86_64 object, flags:<|SUBSECTIONS_VIA_SYMBOLS>
FB>
FB> sounds OK?

 Just for the record: this problem is unrelated to wxWidgets and was/will
soon be fixed in wxPdfDocument itself.

 The only potentially useful, from wxWidgets point of view, conclusion here
is that the linker error message is completely misleading because the .a
file was, actually, of the right architecture but simply (mistakenly)
included another .a file (still for the right architecture too) and
stopping linking the static library with other libraries was enough to fix
the problem.

 Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
               http://www.tt-solutions.com/

attachment0 (203 bytes) Download Attachment