0

I would like to build and install libconfig as 64-bit on my Mac OS X (v10.8.3). Which are the commands that I could use inside the terminal? If I simply use ./configure and sudo make install the library will be installed as 32-bit.

Otherwise... How can I correctly remove the library from my system after installation process (library is in /usr/local/ path)?

Kind regards, Vi.

timrau
  • 22,578
  • 4
  • 51
  • 64
vdenotaris
  • 13,297
  • 26
  • 81
  • 132
  • 1
    You can do a `make uninstall` in the project directory. I encountered the same problem with the 32bit version. This seems (at first sight and googleing) be related to the output of `uname -p`, which is i386. Don't ask me why, sadly I do not know. – Mario Mueller Aug 06 '13 at 20:49

1 Answers1

2

You probably need to pass CFLAGS='-arch x86_64' on the configure command line to set the architecture correctly:

./configure CFLAGS='-arch x86_64'

Update:

Adding CFLAGS doesn't change how configure detects the system, it just changes what gets passed to gcc. But it will build as a 64-bit executable:

$ file lib/.libs/libconfig.*.dylib
lib/.libs/libconfig.9.dylib: Mach-O 64-bit dynamically linked shared library x86_64

If you really want the configure output to be correct, then you need to pass in a --build parameter:

$ ./configure --build=x86_64-apple-darwin10.8.0
checking build system type... x86_64-apple-darwin10.8.0
checking host system type... x86_64-apple-darwin10.8.0
checking target system type... x86_64-apple-darwin10.8.0
...

The resultant library is also 64-bit:

$ file lib/.libs/libconfig.*.dylib
lib/.libs/libconfig.9.dylib: Mach-O 64-bit dynamically linked shared library x86_64

Admittedly, using the --build option is the better choice here. However, since gcc on Mac OS X can build "fat" binaries, it kind of blurs the line a little about what machine you're building for, since it can build for both i386 and x86_64.

John Szakmeister
  • 44,691
  • 9
  • 89
  • 79
  • Unfortunately this did not help, as passing arch flags to C or CXX does not influence the detection of the `configure` call. Configure spits out: `checking build system type... i386-apple-darwin12.4.0 checking host system type... i386-apple-darwin12.4.0 checking target system type... i386-apple-darwin12.4.0` – Mario Mueller Aug 06 '13 at 20:50
  • @MarioMueller Changing `CFLAGS` doesn't change how configure recognizes the system. I updated my answer with more information, and an alternate way, if you want configure's detection to be correct. – John Szakmeister Aug 07 '13 at 10:05