Russell E. Owen
2012-04-17 19:53:27 UTC
I am using scons 2.1.0 to compile C code into a library on Mac OS X
using XCode 4.3.2's clang 3.1 compiler.
I want to build a universal (32-bit and 64-bit) shared library (dylib).
I've found that I can easily build a universal static library, but I can
only build a 64-bit-only dynamic library.
The SConstruct file and log are appended below.
Any suggestions would be most welcome. I can certainly live with a
static library, but would rather not have to. I didn't find anything in
the manual or a web search, though I expect I've overlooking something
basic.
-- Russell
My SConstruct file looks like this:
env = Environment(
CC = "clang",
CFLAGS = "-arch i386 -arch x86_64",
)
staticLib = env.StaticLibrary(
target = "sla",
source =Glob("src/*.c"),
)
# I'd rather use a dylib, but this is 64-bit only; why?
env.SharedLibrary(
target = "sla",
source = libSrcList,
)
Partial log:
localhost$ scons -j 1
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
clang -o src/dafin.o -c -arch i386 -arch x86_64 src/dafin.c
clang -o src/obs.o -c -arch i386 -arch x86_64 src/obs.c
...
ar rc libsla.a src/dafin.o src/obs.o...
ranlib libsla.a
clang -o src/dafin.os -c -arch i386 -arch x86_64 -fPIC src/dafin.c
clang -o src/obs.os -c -arch i386 -arch x86_64 -fPIC src/obs.c
...
clang -o libsla.dylib -dynamiclib src/dafin.os src/obs.os...
The results:
localhost$ file libsla.a
libsla.a: Mach-O universal binary with 2 architectures
libsla.a (for architecture i386): current ar archive random library
libsla.a (for architecture x86_64): current ar archive random library
localhost$ file libsla.dylib
libsla.dylib: Mach-O 64-bit dynamically linked shared library x86_64
------------------------------------------------------
http://scons.tigris.org/ds/viewMessage.do?dsForumId=1272&dsMessageId=2949230
To unsubscribe, send an e-mail to [users-***@scons.tigris.org].
using XCode 4.3.2's clang 3.1 compiler.
I want to build a universal (32-bit and 64-bit) shared library (dylib).
I've found that I can easily build a universal static library, but I can
only build a 64-bit-only dynamic library.
The SConstruct file and log are appended below.
Any suggestions would be most welcome. I can certainly live with a
static library, but would rather not have to. I didn't find anything in
the manual or a web search, though I expect I've overlooking something
basic.
-- Russell
My SConstruct file looks like this:
env = Environment(
CC = "clang",
CFLAGS = "-arch i386 -arch x86_64",
)
staticLib = env.StaticLibrary(
target = "sla",
source =Glob("src/*.c"),
)
# I'd rather use a dylib, but this is 64-bit only; why?
env.SharedLibrary(
target = "sla",
source = libSrcList,
)
Partial log:
localhost$ scons -j 1
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
clang -o src/dafin.o -c -arch i386 -arch x86_64 src/dafin.c
clang -o src/obs.o -c -arch i386 -arch x86_64 src/obs.c
...
ar rc libsla.a src/dafin.o src/obs.o...
ranlib libsla.a
clang -o src/dafin.os -c -arch i386 -arch x86_64 -fPIC src/dafin.c
clang -o src/obs.os -c -arch i386 -arch x86_64 -fPIC src/obs.c
...
clang -o libsla.dylib -dynamiclib src/dafin.os src/obs.os...
The results:
localhost$ file libsla.a
libsla.a: Mach-O universal binary with 2 architectures
libsla.a (for architecture i386): current ar archive random library
libsla.a (for architecture x86_64): current ar archive random library
localhost$ file libsla.dylib
libsla.dylib: Mach-O 64-bit dynamically linked shared library x86_64
------------------------------------------------------
http://scons.tigris.org/ds/viewMessage.do?dsForumId=1272&dsMessageId=2949230
To unsubscribe, send an e-mail to [users-***@scons.tigris.org].