Hi,
Unfortunately none of these options will tell you if a x86_64 Mac OS X
GCC installation will support cross-compiling for PPC, let alone LLVM.
For my Mac 10.6 build machine, it is x86_64 but the Xcode installed
supports cross-compiling for the PPC and i386 targets. This is the
challenge, determining which targets can be cross-compiled. This is a
Mac only issue as this cross-compilation is used to build the
'Universal binary', or in this case 3 way PPC, i386, and x86_64.
There is no such concept in Linux or Windows.
This is a really tough problem, made much more difficult by having
LLVM pretending to be GCC (probably via LLVM-GCC). The only option
might to to have the sconstruct script generate a temporary directory,
dump a basic C file in there, try to compile it with the different
-arch targets, check for errors, and finally delete the temporary
directory. I haven't encountered LLVM on a Mac system yet. Do you
know how it is on yours?
Regards,
Edward
On 2 December 2013 21:06, Troels Emtekær Linnet <tlinnet@xxxxxxxxx> wrote:
How about something like this?
http://www.cl.cam.ac.uk/~cs448/git/trunk/src/SConstruct
http://stackoverflow.com/questions/11377274/how-to-determine-which-compiler-was-requested
Could there be created a short "print" sconstruct file to test in?
I tested the relax .dmg version, and it look good with no errors.
I though receive some errors with the compiled version, which I will post
soon.
Best
Troels Emtekær Linnet
2013/12/2 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:
Ah, there's the problem right there! That is not gcc. It is LLVM
pretending to be gcc, but failing in mimicking it's behaviour
correctly! It does not support ppc, but it is responding like a gcc
version that does. Hmmm, I'm not sure what a solution would be for
testing LLVM verses gcc, or to determine which architectures LLVM
supports. If you do find out, that could be quite useful for that
sconstruct method.
Cheers,
Edward
On 2 December 2013 18:30, Troels Emtekær Linnet <tlinnet@xxxxxxxxx> wrote:
Hi Edward.
---------
tlinnet@linmac:relax_trunk$ gcc -v
Configured with:
--prefix=/Applications/Xcode.app/Contents/Developer/usr
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
-------
It is the ppc who give the problem
tlinnet@linmac:relax_trunk$ gcc -o target_functions/c_chi2.os -c
-I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
-arch i386 -fPIC target_functions/c_chi2.c
tlinnet@linmac:relax_trunk$ gcc -o target_functions/c_chi2.os -c
-I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
-arch x86_64 -fPIC target_functions/c_chi2.c
tlinnet@linmac:relax_trunk$ gcc -o target_functions/c_chi2.os -c
-I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
-arch ppc -fPIC target_functions/c_chi2.c
In file included from target_functions/c_chi2.c:20:
In file included from /usr/include/stdio.h:64:
/usr/include/sys/cdefs.h:655:2: error: Unsupported architecture
#error Unsupported architecture
^
In file included from target_functions/c_chi2.c:20:
In file included from /usr/include/stdio.h:67:
In file included from /usr/include/_types.h:27:
In file included from /usr/include/sys/_types.h:33:
/usr/include/machine/_types.h:34:2: error: architecture not supported
#error architecture not supported
^
In file included from target_functions/c_chi2.c:20:
In file included from /usr/include/stdio.h:67:
In file included from /usr/include/_types.h:27:
/usr/include/sys/_types.h:94:9: error: unknown type name '__int64_t'
typedef __int64_t __darwin_blkcnt_t; /* total blocks */
^
/usr/include/sys/_types.h:95:9: error: unknown type name '__int32_t'
typedef __int32_t __darwin_blksize_t; /* preferred block size */
^
/usr/include/sys/_types.h:96:9: error: unknown type name '__int32_t'
typedef __int32_t __darwin_dev_t; /* dev_t */
^
/usr/include/sys/_types.h:99:9: error: unknown type name '__uint32_t'
typedef __uint32_t __darwin_gid_t; /* [???] process and
group IDs */
^
/usr/include/sys/_types.h:100:9: error: unknown type name '__uint32_t'
typedef __uint32_t __darwin_id_t; /* [XSI] pid_t, uid_t,
or gid_t*/
^
/usr/include/sys/_types.h:101:9: error: unknown type name '__uint64_t'
typedef __uint64_t __darwin_ino64_t; /* [???] Used for 64
bit inodes */
^
/usr/include/sys/_types.h:107:9: error: unknown type name
'__darwin_natural_t'
typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by mach */
^
/usr/include/sys/_types.h:109:9: error: unknown type name '__uint16_t'
typedef __uint16_t __darwin_mode_t; /* [???] Some file
attributes */
^
/usr/include/sys/_types.h:110:9: error: unknown type name '__int64_t'
typedef __int64_t __darwin_off_t; /* [???] Used for file
sizes */
^
/usr/include/sys/_types.h:111:9: error: unknown type name '__int32_t'
typedef __int32_t __darwin_pid_t; /* [???] process and
group IDs */
^
/usr/include/sys/_types.h:131:9: error: unknown type name '__uint32_t'
typedef __uint32_t __darwin_sigset_t; /* [???] signal set */
^
/usr/include/sys/_types.h:132:9: error: unknown type name '__int32_t'
typedef __int32_t __darwin_suseconds_t; /* [???] microseconds */
^
/usr/include/sys/_types.h:133:9: error: unknown type name '__uint32_t'
typedef __uint32_t __darwin_uid_t; /* [???] user IDs */
^
/usr/include/sys/_types.h:134:9: error: unknown type name '__uint32_t'
typedef __uint32_t __darwin_useconds_t; /* [???] microseconds */
^
In file included from target_functions/c_chi2.c:20:
In file included from /usr/include/stdio.h:71:
/usr/include/sys/_types/_va_list.h:31:9: error: unknown type name
'__darwin_va_list'; did you mean '__builtin_va_list'?
typedef __darwin_va_list va_list;
^
note: '__builtin_va_list' declared here
In file included from target_functions/c_chi2.c:20:
In file included from /usr/include/stdio.h:72:
/usr/include/sys/_types/_size_t.h:30:9: error: unknown type name
'__darwin_size_t'; did you mean '__darwin_ino_t'?
typedef __darwin_size_t size_t;
^
/usr/include/sys/_types.h:103:26: note: '__darwin_ino_t' declared here
typedef __darwin_ino64_t __darwin_ino_t; /* [???] Used for inodes
*/
^
In file included from target_functions/c_chi2.c:20:
In file included from /usr/include/stdio.h:434:
/usr/include/sys/_types/_ssize_t.h:30:9: error: unknown type name
'__darwin_ssize_t'
typedef __darwin_ssize_t ssize_t;
^
19 errors generated.
Troels Emtekær Linnet
2013/12/2 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:
Hi,
From that it looks like you can compile for all three architectures!
Ok, maybe try the following then:
$ gcc -o target_functions/c_chi2.os -c
-I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
-arch i386 -fPIC target_functions/c_chi2.c
$ gcc -o target_functions/c_chi2.os -c
-I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
-arch ppc -fPIC target_functions/c_chi2.c
$ gcc -o target_functions/c_chi2.os -c
-I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
-arch x86_64 -fPIC target_functions/c_chi2.c
Which of these gives the error message? You obviously have partially
functional cross-compiler but one of these architectures is broken! I
also don't like the 'Clang' messages. Normally the error message will
show gcc, not clang. Maybe try running:
$ gcc -v
This is just to be sure that this is gcc and not clang pretending to be
gcc.
Regards,
Edward
On 2 December 2013 18:11, Troels Emtekær Linnet <tlinnet@xxxxxxxxx>
wrote:
Hi Edward.
I get:
tlinnet@linmac:~$ gcc -arch i386
clang: error: no input files
tlinnet@linmac:~$ gcc -arch ppc
clang: error: no input files
tlinnet@linmac:~$ gcc -arch x86_64
clang: error: no input files
So it seems that is possible.
I have installed xcode, where the preferences show that
Command line tools: Xcode 5.0.2 (5A3005) is installed.
As long as the simple fix is to change that line, it is fine for me.
Could one get some inspiration from the blender project?
http://wiki.blender.org/index.php/Dev:Doc/Building_Blender/Linux/scons
Best
Troels
Troels Emtekær Linnet
2013/12/2 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:
Hi Troels,
This change is not really a solution as that will prevent me from
compiling the universal binaries required for the Mac app
(http://www.nmr-relax.com/download.html#Mac_OS_X). What is rather
needed is a reliable way of detecting which target architectures gcc
on the Mac can compile for. You can see from the code that it will
run:
$ gcc -arch i386
$ gcc -arch ppc
$ gcc -arch x86_64
This then checks for the text "no input files" which is only printed
for supported architectures. If you run these commands yourself, what
do you see? This should give error messages for all non-supported
architectures. There might be however a cleaner way of performing
this, however there doesn't seem to be a standard way on Mac OS X that
I can find. I really don't know why your gcc is printing "no input
files" for each of these but then failing to compile.
Regards,
Edward
On 2 December 2013 17:19, Troels Emtekær Linnet <tlinnet@xxxxxxxxx>
wrote:
Hi Edward.
For a long time I thought it was a problem with xcode.
And I have tried alot...
But it was simple, I just altered the archs, and it worked.
-----------
def det_arch(self):
"""Nasty hack to make Scons behave properly with
cross-compilation on Mac OS X!
@return: The list of CPU architects to cross compile.
@rtype: list of str
"""
# The list of archectures to try.
#archs = ['i386', 'ppc', 'x86_64']
archs = ['x86_64']
-----------------
Troels Emtekær Linnet
2013/12/2 Edward d'Auvergne <edward@xxxxxxxxxxxxx>:
Hi,
I'm not sure what is happening here. This normally works. Maybe you
should look at the det_arch() method in the 'sconstruct' script, as
that is the likely failure point. I would guess that it is not able
to correctly determine the supported architectures on your system.
This has worked on numerous Macs before, so maybe there is something
different with the setup (Xcode is a likely culprit).
Regards,
Edward
On 1 December 2013 23:33, Troels Emtekær Linnet <tlinnet@xxxxxxxxx>
wrote:
Hi Edward.
I tried compiling relax on mac OS X Mavericks.
Should I in some way specify which kernel to build for?
I get these errors:
----------
linmac:relax_trunk tlinnet$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
###########################
# Compiling the C modules #
###########################
Building the relaxation curve fitting module
'target_functions/relax_fit.so'
gcc -o target_functions/c_chi2.os -c
-I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
-arch i386 -arch ppc -arch x86_64 -fPIC target_functions/c_chi2.c
In file included from target_functions/c_chi2.c:20:
In file included from /usr/include/stdio.h:64:
/usr/include/sys/cdefs.h:655:2: error: Unsupported architecture
#error Unsupported architecture
^
In file included from target_functions/c_chi2.c:20:
In file included from /usr/include/stdio.h:67:
In file included from /usr/include/_types.h:27:
In file included from /usr/include/sys/_types.h:33:
/usr/include/machine/_types.h:34:2: error: architecture not
supported
#error architecture not supported
^
In file included from target_functions/c_chi2.c:20:
In file included from /usr/include/stdio.h:67:
In file included from /usr/include/_types.h:27:
/usr/include/sys/_types.h:94:9: error: unknown type name '__int64_t'
typedef __int64_t __darwin_blkcnt_t; /* total blocks */
^
/usr/include/sys/_types.h:95:9: error: unknown type name '__int32_t'
typedef __int32_t __darwin_blksize_t; /* preferred block
size */
^
/usr/include/sys/_types.h:96:9: error: unknown type name '__int32_t'
typedef __int32_t __darwin_dev_t; /* dev_t */
^
/usr/include/sys/_types.h:99:9: error: unknown type name
'__uint32_t'
typedef __uint32_t __darwin_gid_t; /* [???] process and
group IDs */
^
/usr/include/sys/_types.h:100:9: error: unknown type name
'__uint32_t'
typedef __uint32_t __darwin_id_t; /* [XSI] pid_t,
uid_t,
or gid_t*/
^
/usr/include/sys/_types.h:101:9: error: unknown type name
'__uint64_t'
typedef __uint64_t __darwin_ino64_t; /* [???] Used for 64
bit inodes */
^
/usr/include/sys/_types.h:107:9: error: unknown type name
'__darwin_natural_t'
typedef __darwin_natural_t __darwin_mach_port_name_t; /* Used by
mach */
^
/usr/include/sys/_types.h:109:9: error: unknown type name
'__uint16_t'
typedef __uint16_t __darwin_mode_t; /* [???] Some file
attributes */
^
/usr/include/sys/_types.h:110:9: error: unknown type name
'__int64_t'
typedef __int64_t __darwin_off_t; /* [???] Used for
file sizes */
^
/usr/include/sys/_types.h:111:9: error: unknown type name
'__int32_t'
typedef __int32_t __darwin_pid_t; /* [???] process and
group IDs */
^
/usr/include/sys/_types.h:131:9: error: unknown type name
'__uint32_t'
typedef __uint32_t __darwin_sigset_t; /* [???] signal set
*/
^
/usr/include/sys/_types.h:132:9: error: unknown type name
'__int32_t'
typedef __int32_t __darwin_suseconds_t; /* [???]
microseconds */
^
/usr/include/sys/_types.h:133:9: error: unknown type name
'__uint32_t'
typedef __uint32_t __darwin_uid_t; /* [???] user IDs */
^
/usr/include/sys/_types.h:134:9: error: unknown type name
'__uint32_t'
typedef __uint32_t __darwin_useconds_t; /* [???]
microseconds */
^
In file included from target_functions/c_chi2.c:20:
In file included from /usr/include/stdio.h:71:
/usr/include/sys/_types/_va_list.h:31:9: error: unknown type name
'__darwin_va_list'; did you mean '__builtin_va_list'?
typedef __darwin_va_list va_list;
^
note: '__builtin_va_list' declared here
In file included from target_functions/c_chi2.c:20:
In file included from /usr/include/stdio.h:72:
/usr/include/sys/_types/_size_t.h:30:9: error: unknown type name
'__darwin_size_t'; did you mean '__darwin_ino_t'?
typedef __darwin_size_t size_t;
^
/usr/include/sys/_types.h:103:26: note: '__darwin_ino_t' declared
here
typedef __darwin_ino64_t __darwin_ino_t; /* [???] Used for
inodes */
^
In file included from target_functions/c_chi2.c:20:
In file included from /usr/include/stdio.h:434:
/usr/include/sys/_types/_ssize_t.h:30:9: error: unknown type name
'__darwin_ssize_t'
typedef __darwin_ssize_t ssize_t;
^
19 errors generated.
scons: *** [target_functions/c_chi2.os] Error 1
scons: building terminated because of errors.
linmac:relax_trunk tlinnet$
Troels Emtekær Linnet
_______________________________________________
relax (http://www.nmr-relax.com)
This is the relax-devel mailing list
relax-devel@xxxxxxx
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-devel