www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Linking problem on Mac OS X

reply Robert Rouse <robert.e.rouse gmail.com> writes:
Running a simple compile and link

dmd test.d

produces

gcc-4.2: Invalid argument

What can I provide to track this down?
Dec 24 2011
parent reply Andrew Wiley <wiley.andrew.j gmail.com> writes:
On Sat, Dec 24, 2011 at 6:29 PM, Robert Rouse <robert.e.rouse gmail.com> wrote:
 Running a simple compile and link

 dmd test.d

 produces

 gcc-4.2: Invalid argument

 What can I provide to track this down?

Run with `dmd -v` to get the linker commandline.
Dec 24 2011
next sibling parent Robert Rouse <robert.e.rouse gmail.com> writes:
The full output was as follows:

binary    dmd
version   v2.057
config    /usr/local/bin/dmd.conf
parse     test
importall test
import    object	(/usr/local/Cellar/dmd/2.057/src/druntime/import/object.di)
import    std.stdio	(/usr/local/Cellar/dmd/2.057/src/phobos/std/stdio.d)
import    core.stdc.stdio	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/stdc/stdio.di)
import    core.stdc.config	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/stdc/config.di)
import    core.stdc.stddef	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/stdc/stddef.di)
import    core.stdc.stdarg	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/stdc/stdarg.di)
import    std.c.stdio	(/usr/local/Cellar/dmd/2.057/src/phobos/std/c/stdio.d)
import    std.stdiobase	(/usr/local/Cellar/dmd/2.057/src/phobos/std/stdiobase.d)
import    core.stdc.errno	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/stdc/errno.di)
import    core.stdc.stdlib	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/stdc/stdlib.di)
import    core.memory	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/memory.di)
import    core.stdc.string	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/stdc/string.di)
import    core.stdc.wchar_	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/stdc/wchar_.di)
import    core.stdc.time	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/stdc/time.di)
import    core.stdc.stdint	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/stdc/stdint.di)
import    core.stdc.signal	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/stdc/signal.di)
import    std.algorithm	(/usr/local/Cellar/dmd/2.057/src/phobos/std/algorithm.d)
import    std.c.string	(/usr/local/Cellar/dmd/2.057/src/phobos/std/c/string.d)
import    std.array	(/usr/local/Cellar/dmd/2.057/src/phobos/std/array.d)
import    core.bitop	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/bitop.di)
import    std.ascii	(/usr/local/Cellar/dmd/2.057/src/phobos/std/ascii.d)
import    std.conv	(/usr/local/Cellar/dmd/2.057/src/phobos/std/conv.d)
import    core.stdc.math	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/stdc/math.di)
import    std.exception	(/usr/local/Cellar/dmd/2.057/src/phobos/std/exception.d)
import    std.range	(/usr/local/Cellar/dmd/2.057/src/phobos/std/range.d)
import    std.functional	(/usr/local/Cellar/dmd/2.057/src/phobos/std/functional.d)
import    std.metastrings	(/usr/local/Cellar/dmd/2.057/src/phobos/std/metastrings.d)
import    std.traits	(/usr/local/Cellar/dmd/2.057/src/phobos/std/traits.d)
import    std.typetuple	(/usr/local/Cellar/dmd/2.057/src/phobos/std/typetuple.d)
import    std.typecons	(/usr/local/Cellar/dmd/2.057/src/phobos/std/typecons.d)
import    std.format	(/usr/local/Cellar/dmd/2.057/src/phobos/std/format.d)
import    core.vararg	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/vararg.di)
import    std.bitmanip	(/usr/local/Cellar/dmd/2.057/src/phobos/std/bitmanip.d)
import    std.math	(/usr/local/Cellar/dmd/2.057/src/phobos/std/math.d)
import    std.string	(/usr/local/Cellar/dmd/2.057/src/phobos/std/string.d)
import    core.exception	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/exception.di)
import    std.regex	(/usr/local/Cellar/dmd/2.057/src/phobos/std/regex.d)
import    std.internal.uni	(/usr/local/Cellar/dmd/2.057/src/phobos/std/internal/uni.d)
import    std.uni	(/usr/local/Cellar/dmd/2.057/src/phobos/std/uni.d)
import    std.internal.uni_tab	(/usr/local/Cellar/dmd/2.057/src/phobos/std/internal/uni_tab.d)
import    std.utf	(/usr/local/Cellar/dmd/2.057/src/phobos/std/utf.d)
import    std.system	(/usr/local/Cellar/dmd/2.057/src/phobos/std/system.d)
import    std.container	(/usr/local/Cellar/dmd/2.057/src/phobos/std/container.d)
import    std.file	(/usr/local/Cellar/dmd/2.057/src/phobos/std/file.d)
import    std.datetime	(/usr/local/Cellar/dmd/2.057/src/phobos/std/datetime.d)
import    core.time	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/time.di)
import    core.sys.posix.time
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/time.di)
import    core.sys.posix.config
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/config.di)
import    core.sys.posix.sys.types
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/sys/types.di)
import    core.sys.posix.signal
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/signal.di)
import    core.sys.posix.sys.time
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/sys/time.di)
import    core.sys.posix.sys.select
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/sys/select.di)
import    core.sys.osx.mach.kern_return
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/osx/mach/kern_return.di)
import    std.path	(/usr/local/Cellar/dmd/2.057/src/phobos/std/path.d)
import    core.sys.posix.pwd
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/pwd.di)
import    core.sys.posix.stdlib
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/stdlib.di)
import    core.sys.posix.sys.wait
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/sys/wait.di)
import    std.process	(/usr/local/Cellar/dmd/2.057/src/phobos/std/process.d)
import    std.c.stdlib	(/usr/local/Cellar/dmd/2.057/src/phobos/std/c/stdlib.d)
import    core.thread	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/thread.di)
import    core.sync.mutex	(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sync/mutex.di)
import    core.sync.exception
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sync/exception.di)
import    core.sys.posix.pthread
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/pthread.di)
import    core.sys.posix.sched
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/sched.di)
import    core.sys.posix.semaphore
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/semaphore.di)
import    core.sys.osx.mach.thread_act
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/osx/mach/thread_act.di)
import    core.sys.osx.mach.port
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/osx/mach/port.di)
import    core.sys.posix.unistd
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/unistd.di)
import    core.sys.posix.inttypes
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/inttypes.di)
import    core.stdc.inttypes
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/stdc/inttypes.di)
import    core.sys.posix.sys.mman
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/sys/mman.di)
import    std.c.process	(/usr/local/Cellar/dmd/2.057/src/phobos/std/c/process.d)
import    std.c.stddef	(/usr/local/Cellar/dmd/2.057/src/phobos/std/c/stddef.d)
import    std.internal.processinit
(/usr/local/Cellar/dmd/2.057/src/phobos/std/internal/processinit.d)
import    core.sys.posix.arpa.inet
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/arpa/inet.di)
import    core.sys.posix.sys.socket
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/sys/socket.di)
import    core.sys.posix.sys.uio
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/sys/uio.di)
import    core.sys.posix.dirent
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/dirent.di)
import    core.sys.posix.fcntl
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/fcntl.di)
import    core.sys.posix.sys.stat
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/sys/stat.di)
import    core.sys.posix.utime
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/utime.di)
import    core.sys.posix.stdio
(/usr/local/Cellar/dmd/2.057/src/druntime/import/core/sys/posix/stdio.di)
semantic  test
semantic2 test
semantic3 test
code      test
function  main
function  writeln
function  __dgliteral1283
function  enforce
gcc-4.2 test.o -o test -m64 -lphobos2 -lpthread -lm
gcc-4.2: Invalid argument
Dec 24 2011
prev sibling parent Robert Rouse <robert.e.rouse gmail.com> writes:
Nevermind! I figured it out. Apparently CC was set in my system 
incorrectly. I found the culprit and removed it. It works now.

So if anyone else runs across this, look at your CC environment variable.

(I saw a similar issue posted in one of the other newsgroups that just 
said "Post in learn instead" basically instead of answering the 
question, but it looks like that person never did)


In article 
<mailman.1898.1324773448.24802.digitalmars-d-learn puremagic.com>,
 Andrew Wiley <wiley.andrew.j gmail.com> wrote:

 On Sat, Dec 24, 2011 at 6:29 PM, Robert Rouse <robert.e.rouse gmail.com> 
 wrote:
 Running a simple compile and link

 dmd test.d

 produces

 gcc-4.2: Invalid argument

 What can I provide to track this down?

Run with `dmd -v` to get the linker commandline.

Dec 24 2011