Devicetree
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
To: Timur Tabi <timur-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Cc: devicetree-discuss
	<devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org>
Subject: Re: dtc build failures on OS X
Date: Wed, 20 May 2009 09:46:11 +0200	[thread overview]
Message-ID: <20090520074611.GW17539@game.jcrosoft.org> (raw)
In-Reply-To: <ed82fe3e0905191908v8c5fcdft953c4e1ba7969f2a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1300 bytes --]

On 21:08 Tue 19 May     , Timur Tabi wrote:
> I'm trying to build dtc on Mac OS X.  The compilation seems to go
> okay, but the linker dies.  First, it says this:
> 
> 	 LD libfdt/libfdt.so
> ld: unknown option: --version-script=libfdt/version.lds
> collect2: ld returned 1 exit status
> 
> A Google search suggested that I can just delete the --version-script
> option.  I did that, and now I get this error:
> 
> 	 LD libfdt/libfdt.so
> ld: unknown option: -soname
> collect2: ld returned 1 exit status
> 
> This web page: http://lists.apple.com/archives/unix-porting/2003/Oct/msg00032.html
> had some suggestions on how to fix that, so my Makefile now looks like
> this:
> 
> $(LIBFDT_lib):
>         @$(VECHO) LD $@
>         $(CC) $(LDFLAGS) -fPIC -Wl,-dylib_install_name -Wl,$(notdir
> $@) -shared -o $(LIBFDT_objdir)/libfdt-$(DTC_VERSION).so $^
>         ln -s libfdt-$(DTC_VERSION).so $(LIBFDT_objdir)/libfdt.so
> 
> But now I get this error:
> 
> 	 LD libfdt/libfdt.so
> Undefined symbols:
>   "_main", referenced from:
>       start in crt1.10.5.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
> 
> So now I'm stuck.  Has anyone tried this before?  Can anyone tell me
> how to fix this?
-shared is incorrect on mac os it's -dynamiclib
see attached patch

Best Regards,
J.

[-- Attachment #2: 0001-add-Mac-OS-X-support.patch --]
[-- Type: text/x-diff, Size: 1985 bytes --]

>From 37a2ddc183fa381cc025adf8e9d9d143029fe159 Mon Sep 17 00:00:00 2001
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
Date: Wed, 20 May 2009 09:50:31 +0200
Subject: [PATCH] add Mac OS X support

use dylib shared lib extention
allow to specifiy os specific shared lib link option
Mac OS use -dynamiclib instead of -shared, -install_name instead of -soname
and does not support --version-script

to buid on it do

make OSX=y

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
---
 Makefile |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index be0fc8b..d8b3353 100644
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,14 @@ BINDIR = $(PREFIX)/bin
 LIBDIR = $(PREFIX)/lib
 INCLUDEDIR = $(PREFIX)/include
 
+ifdef OSX
+SHAREDLIB_EXT=dylib
+SHAREDLIB_LINK_OPTIONS=-dynamiclib -Wl,-install_name -Wl,
+else
+SHAREDLIB_EXT=so
+SHAREDLIB_LINK_OPTIONS=-shared -Wl,--version-script=$(LIBFDT_version) -Wl,-soname,
+endif
+
 #
 # Overall rules
 #
@@ -116,7 +124,7 @@ endif
 LIBFDT_objdir = libfdt
 LIBFDT_srcdir = libfdt
 LIBFDT_archive = $(LIBFDT_objdir)/libfdt.a
-LIBFDT_lib = $(LIBFDT_objdir)/libfdt.so
+LIBFDT_lib = $(LIBFDT_objdir)/libfdt.$(SHAREDLIB_EXT)
 LIBFDT_include = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_INCLUDES))
 LIBFDT_version = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_VERSION))
 
@@ -220,8 +228,8 @@ clean: libfdt_clean tests_clean
 
 $(LIBFDT_lib):
 	@$(VECHO) LD $@
-	$(CC) $(LDFLAGS) -fPIC -Wl,--version-script=$(LIBFDT_version) -Wl,-soname,$(notdir $@) -shared -o $(LIBFDT_objdir)/libfdt-$(DTC_VERSION).so $^
-	ln -s libfdt-$(DTC_VERSION).so $(LIBFDT_objdir)/libfdt.so
+	$(CC) $(LDFLAGS) -fPIC $(SHAREDLIB_LINK_OPTIONS)$(notdir $@) -o $(LIBFDT_objdir)/libfdt-$(DTC_VERSION).$(SHAREDLIB_EXT) $^
+	ln -sf libfdt-$(DTC_VERSION).$(SHAREDLIB_EXT) $(LIBFDT_objdir)/libfdt.$(SHAREDLIB_EXT)
 
 %.lex.c: %.l
 	@$(VECHO) LEX $@
-- 
1.6.0.4


[-- Attachment #3: Type: text/plain, Size: 194 bytes --]

_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org
https://ozlabs.org/mailman/listinfo/devicetree-discuss

  parent reply	other threads:[~2009-05-20  7:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-20  2:08 dtc build failures on OS X Timur Tabi
     [not found] ` <ed82fe3e0905191908v8c5fcdft953c4e1ba7969f2a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-05-20  4:43   ` David Gibson
2009-05-20  7:46   ` Jean-Christophe PLAGNIOL-VILLARD [this message]
     [not found]     ` <20090520074611.GW17539-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org>
2009-05-26  3:37       ` Timur Tabi
     [not found]         ` <ed82fe3e0905252037r574e56ecjd8689b800c74561f-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-05-26 18:07           ` [PATCH V2] add Mac OS X support Jean-Christophe PLAGNIOL-VILLARD
     [not found]             ` <1243361246-1743-1-git-send-email-plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
2009-05-27  3:37               ` Timur Tabi
2009-06-13 19:21               ` Jean-Christophe PLAGNIOL-VILLARD
     [not found]                 ` <20090613192148.GN25406-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org>
2009-07-15 17:26                   ` Timur Tabi
     [not found]                     ` <ed82fe3e0907151026w4c957398s63ce7d8dae7c5460-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-07-16  0:43                       ` Jon Loeliger
     [not found]                         ` <E1MRF4Z-0005vL-Hl-CYoMK+44s/E@public.gmane.org>
2009-07-16  2:12                           ` Timur Tabi
2009-07-16  2:33               ` Jon Loeliger
2009-05-20 12:38   ` dtc build failures on OS X Segher Boessenkool
     [not found]     ` <C44AFDDE-9BB1-4914-8B26-5816D83B909A-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2009-05-20 23:08       ` David Gibson
     [not found]         ` <20090520230823.GB10487-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
2009-05-21 17:46           ` Segher Boessenkool
     [not found]             ` <82CF1AB0-22C1-4C33-B6E1-B8816AF2E094-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2009-05-22  1:29               ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090520074611.GW17539@game.jcrosoft.org \
    --to=plagnioj-sclmfoaustbwk0htik3j/w@public.gmane.org \
    --cc=devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org \
    --cc=timur-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox