|
|
#1 |
|
Prospect
Join Date: Oct 2009
Posts: 11
|
gcc is building for wrong architecture
Hi list,
I recently moved from a linux-based machine to a macbook and I am trying to compile some plugins I made for various programs. Gcc is however building my plugins for the wrong architecture. I'm not sure how to debug this, but I get errors like (for a Pure Data external): /Users/richardeakin/pd/reakin/incr/incr.pd_darwin: mach-o, but wrong architecture and (for a python module): gcc-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -arch i386 -arch ppc -arch x86_64 build/temp.macosx-10.6-universal-2.6/pysms_wrap.o -L../src -L/opt/local/lib -lsndfile -lgsl -lgslcblas -lsms -o _pysms.so ld: warning: in /usr/local/lib/libsndfile.dylib, file is not of required architecture ld: warning: in /opt/local/lib/libgsl.dylib, file is not of required architecture ld: warning: in /opt/local/lib/libgslcblas.dylib, file is not of required architecture ld: warning: in ../src/libsms.a, file is not of required architecture ld: warning: in /usr/local/lib/libsndfile.dylib, file is not of required architecture ld: warning: in /opt/local/lib/libgsl.dylib, file is not of required architecture ld: warning: in /opt/local/lib/libgslcblas.dylib, file is not of required architecture ld: warning: in ../src/libsms.a, file is not of required architecture I installed Xcode from the manufacture's disk and I don't know how I set this up wrong. As I am using scons for the first plugin and python's distutils for the second, I would think they could figure out I was on an intel mac and build appropriately. Anyone have suggestions? Thanks Rich |
|
|
|
|
|
#2 |
|
All Star
Join Date: May 2004
Posts: 911
|
It could be that some component has been built for 32 bit and what you're trying to compile now is targeted for 64 bit. Under MacPorts I try to install everything as 32 / 64 bit universal to avoid these problems. MacPorts may be able to help in some cases by building one of your dependencies this way. It then wouldn't matter which architecture your build was targeting.
|
|
|
|
|
|
#3 |
|
Prospect
Join Date: Oct 2009
Posts: 11
|
I think I understand the problem then.. my application is 32bit, but gcc is compiling my plug-ins as 64bit. I am not sure, however, anyone know of a way to check these type of things? Also, is there a way to check if the libraries I have installed are 32, 64bit, or universal?
|
|
|
|
|
|
#4 |
|
Prospect
Join Date: Oct 2009
Posts: 11
|
So, the problem is that my system is building x86_64 type binaries, when the application I have is compiled for i386. I'm now realizing what you mean by getting MacPorts to give you universal binaries (how do you specify this, by the way?), but I can't get my own compiled code, or libraries compiled from source, to compile as i386. I suppose the ALL have to be i386 for the end plugin to work.
Any advice is welcome... still new to this world of programming. |
|
|
|
|
|
#5 |
|
All Star
Join Date: May 2004
Posts: 911
|
For MacPorts you can either use the universal variant for relevant ports, or set it as a default variant by editing /opt/local/etc/macports/variants.conf
For setting the arch you want to compile, I'd start with either some searches or reading some MacPorts portfiles. Or installing something under MacPorts with a specific arch using the debug flags. I'm sure searching would provide better info on archs. |
|
|
|
|
|
#6 |
|
Prospect
Join Date: Oct 2009
Posts: 11
|
Thanks for the tips on Macports. I found that if I type something like
Code:
sudo port install libsndfile +universal But, what I can't seem to figure out is how to compile my own plugins as i386, in order to match my app that can only be compiled in 32bit (by the way, i've been searching the net the entire day so far on how to do this). All I can find is that I should have to specify the flag '-arch i386' to gcc, but the linker complains that this is the wrong architecture and just builds the x86_64 version anyway. Dunno.. |
|
|
|
|
|
#7 |
|
Prospect
Join Date: Oct 2009
Posts: 11
|
Ah, found out that I need to specify it to the linker too. That part is solved..
|
|
|
|
![]() |
| Tags |
| gcc wrong architecture |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|