View previous topic :: View next topic |
Author |
Message |
braver
Joined: 08 Mar 2009 Posts: 2
|
Posted: Sun Mar 08, 2009 2:27 am Post subject: dsss on darwin |
|
|
OK, got the new shiny dmd for Mac OSX, tried to compile DSSS:
make -f Makefile.dmd.posix
-- get
./rebuild/rebuild -full -Irebuild sss/main.d -ofdsss
Error: version identifier 'Posix' is reserved and cannot be set
...
OK, google it, edit rebuild/rebuild.conf/dmd-posix and cut out -version=Posix form the dmd-posix layout:
[compile]
cmd=dmd -version=Posix -c $i
=>
cmd=dmd -c $i
-- then, make again, get:
rebuild/util/fdt.d(52): Error: version identifier 'Posix' is reserved and cannot be set
rebuild/util/fdt.d(54): Error: version identifier 'Posix' is reserved and cannot be set
-- hmm, more mindless hackery -- replacing Posix there with say Unix (why not?) =>
rebuild/util/fdt.d(70): module unix cannot read file 'std/c/unix/unix.d'
Now on Mac, it's really not there, so I'm stuck. I can further randomly replace it by linux present on Mac, but I wonder what's the right thing to do!
Cheers,
Alexy |
|
Back to top |
|
|
braver
Joined: 08 Mar 2009 Posts: 2
|
Posted: Wed Mar 11, 2009 10:13 pm Post subject: |
|
|
OK -- so I installed DSSS.pkg from Anders and changed default to dmd-posix, and went to compile tango with dsss build. Since I don't know dsss and rebuild, I just gave it some stuff it complained about, e.g. --prefix=/usr/local.
Now it went ahead and made a first batch of object files, I could see with -objfiles. Then it choked with:
/s/w/d/tango/tango-D1 dsss build --prefix=/usr/local -objfiles
Creating imports for DD-tango-core
...
Creating imports for DD-tango-time
tango/core => DD-tango-core
dsss_objs/D/tango.core.Array.o
...
dsss_objs/D/tango.core.Version.o
ar: no archive members specified
usage: ar -d [-TLsv] archive file ...
-- and changing [liblink] section to
cmd=echo ar rc $o $i
-- showed two ar's per each:
ar rc lib.a objects.o
ar rc lib.a
-- it's the second one which is the offender.
Where can I check what's intended to be given to ar there? Is it instead of ranlib? I'm on Mac and COMMAND_MODE matters -- I've set it to either legacy or unix03, changing ar rc to ar -rc for the latter, or unset altogether, with the same results. |
|
Back to top |
|
|
obijohn
Joined: 07 Feb 2006 Posts: 24
|
Posted: Sat Mar 14, 2009 2:58 pm Post subject: |
|
|
You don't need DSSS to build Tango. Follow the linux manual build and install instructions here about halfway down the page. I didn't use the install-dmd.sh script and instead followed the manual instructions. Worked perfectly for me.
I've got the binary DSSS 0.78 for mac installed, and I'm using it fine now (I just didn't use it to build Tango since I wanted to do it myself, although I did use it to build the Tango API docs). You were correct to take out the "-version=Posix" flag in your config file, but there are two other things you need to watch for. One is that there are some "version"/"noversion" defines in there (above the [compiler] block). You need to make sure "version=Posix" is still set or some packages (like gtkD) will fail to compile. Also, you need to change the "cmd=" line in the [liblink] block to read:
Code: | cmd=if [ ! -z "$o" ]; then ar rc $o $i; fi |
This is due to a problem with ar on OS X in creating dynamic libraries (this fix is needed for a lot of library packages).
Here's my entire dmd-tango config file: Code: |
profile=tango
compiler=dmd
inifile=dmd.conf
exeext=
objext=o
version=DigitalMars
noversion=GNU
version=linux
noversion=Unix
version=Posix
noversion=Windows
noversion=Win32
noversion=Win64
version=X86
noversion=PPC
noversion=X86_64
version=D_InlineAsm
version=D_InlineAsm_X86
noversion=D_InlineAsm_PPC
noversion=D_InlineAsm_X86_64
version=LittleEndian
noversion=BigEndian
version=Tango
[compile]
cmd=dmd -version=Tango -c $i
flag=$i
incdir=-I$i
libdir=-L-L$i
optimize=-O
version=-version=$i
[link]
oneatatime=yes
cmd=dmd -L-ltango-base-dmd $i -of$o
libdir=-L-L$i
lib=-L-l$i
flag=-L$i
[liblink]
safe=yes
oneatatime=yes
cmd=if [ ! -z "$o" ]; then ar rc $o $i; fi
libdir=
lib=
flag=
[postliblink]
cmd=ranlib $i
[shliblink]
shlibs=no
[dyliblink]
dylibs=no
|
|
|
Back to top |
|
|
funsheep
Joined: 24 Jan 2007 Posts: 25
|
Posted: Mon Mar 30, 2009 9:01 am Post subject: Compiling DSSS to use new dmd |
|
|
Hi,
when i'm using the download-package of dsss 0.78 for mac os. When i try to run it, it says gdc was not in $Path. I would like to use the new dmd compiler for mac os and i don't want to install gdc, nor use it.
So i tried to build dsss/ rebuild for myself with the dmd compiler. I tried everything what was written here, but it still, after modifying the rebuild/rebuild.conf/dmd-posix file, it says
"Error: version identifier 'Posix' is reserved and cannot be set"
What is the right thing to do to compile dsss 0.78 with dmd and phobos - not tango - under mac os? |
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Mon Mar 30, 2009 3:28 pm Post subject: |
|
|
Remove "Posix" in rebuild/rebuild.conf/dmd-posix |
|
Back to top |
|
|
funsheep
Joined: 24 Jan 2007 Posts: 25
|
Posted: Tue Mar 31, 2009 2:52 am Post subject: |
|
|
Thanks for the reply. I tested it, but then i get:
Code: | rebuild/util/fdt.d(69): module unix cannot read file 'std/c/unix/unix.d'
|
Ok. Here is how far i got:
After that, i replaced the std.c.unix.unix import for darwin with std.c.osx.osx
then he can't find the struct_stat - that, however, is defined in std.c.linux.linux for osx. i then replaced it by stc.c.linux.linux. after that teh compiler complainted about the st_mtime variable in struct_stat. looking through linux.d, osx defines a timespec struct. so i changed line 469 of ftd.d
from
Code: | mDT = lFileInfo.st_mtime; |
to
Code: |
version(linux)
{
mDT = lFileInfo.st_mtime;
} else version(OSX)
{
mDT = lFileInfo.st_mtimespec.tv_sec;
}
|
(forgive me my workaround style)
Now everything compiles, but the linker claims:
Code: | cp -f rebuild/defaults/dmd-posix rebuild/rebuild.conf/default
./rebuild/rebuild -full -Irebuild sss/main.d -ofdsss
ld: unknown option: --start-group
collect2: ld returned 1 exit status
--- errorlevel 1
make: *** [dsss] Error 255
|
currently i don't know what equivalent osx's ld has for --start-group. looking through the man pages i couldn't find anything similar. when i'm at home, i will try to google for that. |
|
Back to top |
|
|
funsheep
Joined: 24 Jan 2007 Posts: 25
|
Posted: Tue Mar 31, 2009 4:47 am Post subject: |
|
|
I did some search on the --start-group issue and found nothing except a comment in the google chrome compilescript. It seems that the GNU ld needs this parameter since he walks through all files only once. If there is a cycle of imported symbols between several files to be linked, he would need to search again. Through this switch this can be accomplished.
I then removed this switch, hoping the mac os ld does a second search when there are cycles in the files to be linked.
Now i got this:
Code: |
./rebuild/rebuild -full -Irebuild sss/main.d -ofdsss
`pwd`/dsss build
candydoc
docs
Error: hcf/..: 0
make: *** [dsss] Error 1
|
Seems as if the
Code: |
[hcf]
type = sourcelibrary
|
command in the dsss.conf does not work propably. Can someone point me into the right direction how to solve this? |
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Tue Mar 31, 2009 5:23 am Post subject: |
|
|
Oh, so your trying to compile dsss yourself, sorry missed that. Can't you just download the binary? It works for dmd too. BTW dsss 0.78 can't build libraries on osx, at least not with gdc, don't know if it works with dmd. DSSS 0.75 works. |
|
Back to top |
|
|
funsheep
Joined: 24 Jan 2007 Posts: 25
|
Posted: Tue Mar 31, 2009 7:24 am Post subject: |
|
|
Hi,
ok. I'll try that again. But as i first mentioned, it complains about gdc not being in $PATH. How do i fix that?
or do i have to config dsss to use dmd?
now, i have tried 0.75 but same problem:
Code: |
home:DerelictUtil home$ dsss build
Default prefix /usr is unwritable, using /Users/home/d instead.
Error: gdc is not in $PATH
Error: gdc is not in $PATH
Error: gdc is not in $PATH
Error: gdc is not in $PATH
Error: gdc is not in $PATH
|
|
|
Back to top |
|
|
funsheep
Joined: 24 Jan 2007 Posts: 25
|
Posted: Tue Mar 31, 2009 8:55 am Post subject: SOLVED |
|
|
Ok. Solved. I just understood how dsss/rebuild has to be configured. Had to change the default in rebuild/rebuild.conf to dmd-posix in the binary install. Thats all folks.
Thanks for the support. |
|
Back to top |
|
|
|