Opened 16 years ago

Closed 14 years ago

#16331 closed defect (fixed)

ruby-1.8.7-p72 Configure error - build failure for x86_64 [universal or single arch]

Reported by: m@… Owned by: kimuraw (kimura wataru)
Priority: Normal Milestone:
Component: ports Version: 1.6.0
Keywords: x86-64, universal, ruby, pthreads Cc:
Port:

Description

[svn rev. 39307] Darwin 9

The port does not build on x86_64 due to 2 different issues: 1 - Similar to what was reported on https://trac.macports.org/ticket/15635, there is a core dump while building with pthreads configured.

/usr/bin/gcc-4.0 -O2 -arch x86_64  -fno-common -pipe -fno-common    -DRUBY_EXPORT  -I. -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -c dmyext.c
ar rcu libruby-static.a array.o bignum.o class.o compar.o dir.o dln.o enum.o enumerator.o error.o eval.o file.o gc.o hash.o inits.o io.o marshal.o math.o numeric.o object.o pack.o parse.o process.o prec.o random.o range.o re.o regex.o ruby.o signal.o sprintf.o st.o string.o struct.o time.o util.o variable.o version.o  dmyext.o
/usr/bin/gcc-4.0 -O2 -arch x86_64  -fno-common -pipe -fno-common    -DRUBY_EXPORT  -I. -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -c main.c
/usr/bin/gcc-4.0 -O2 -arch x86_64  -fno-common -pipe -fno-common    -DRUBY_EXPORT  -I. -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -c dmydln.c
/usr/bin/gcc-4.0 -arch x86_64 -O2 -arch x86_64  -fno-common -pipe -fno-common    -DRUBY_EXPORT  -L. -L/opt/local/lib  main.o dmydln.o libruby-static.a -lpthread -ldl -lobjc   -o miniruby
make: *** [.rbconfig.time] Abort trap

2 - Configure does not set a value for EXTLDFLAGS what leads to have libruby.1.8.7.dylibld linked for i386 while the objects were compiled x86_64 (or fat).

cc -dynamiclib -undefined suppress -flat_namespace -install_name /opt/local/lib/libruby.dylib -current_version 1.8.7 -compatibility_version 1.8   array.o bignum.o class.o compar.o dir.o dln.o enum.o enumerator.o error.o eval.o file.o gc.o hash.o inits.o io.o marshal.o math.o numeric.o object.o pack.o parse.o process.o prec.o random.o range.o re.o regex.o ruby.o signal.o sprintf.o st.o string.o struct.o time.o util.o variable.o version.o  dmyext.o  -o libruby.1.8.7.dylibld: warning in array.o, file is not of required architecture
ld: warning in bignum.o, file is not of required architecture

and the eventual error:

making ruby
/usr/bin/gcc-4.0  -O2 -arch x86_64  -fno-common -pipe -fno-common    -DRUBY_EXPORT  -L. -L/opt/local/lib  main.o  -lruby -ldl -lobjc   -o rubyld: warning in ./libruby.dylib, file is not of required architecture
Undefined symbols:  "_ruby_options", referenced from:
      _main in main.o
  "_ruby_run", referenced from:
      _main in main.o
  "_ruby_init", referenced from:
      _main in main.o  "_ruby_init_stack", referenced from:
      _main in main.old: symbol(s) not found
collect2: ld returned 1 exit status
make[1]: *** [ruby] Error 1
make: *** [all] Error 2

In order to have the port installed I had to patch both the Portfile and the Makefile.in (files attached to the ticket). For the sake of simplicity a x86_64 variant was created instead of having 'fixed' the universal.

Attachments (4)

patch-Makefile.in.diff (350 bytes) - added by m@… 16 years ago.
Patch for Makefile.in that sets EXTLDFLAGS for x86_64 (to be called by x86_64 variant)
patch-portfile.diff (399 bytes) - added by m@… 16 years ago.
Variant x86_64 added to Portfile
test-x86_64-thread_hooks.out (6.2 KB) - added by m@… 16 years ago.
results of test phase +x86_64 +thread_hooks (r39392) OK
patch-config.guess.diff (517 bytes) - added by kimuraw (kimura wataru) 16 years ago.
correct archdir of darwin x86_64

Download all attachments as: .zip

Change History (15)

Changed 16 years ago by m@…

Attachment: patch-Makefile.in.diff added

Patch for Makefile.in that sets EXTLDFLAGS for x86_64 (to be called by x86_64 variant)

Changed 16 years ago by m@…

Attachment: patch-portfile.diff added

Variant x86_64 added to Portfile

comment:1 Changed 16 years ago by blb@…

Milestone: Port Bugs
Owner: changed from macports-tickets@… to kimuraw@…

Assigning to maintainer.

comment:2 Changed 16 years ago by kimuraw (kimura wataru)

Status: newassigned

I merged the patch at r39392 as a platform variant "x86_64".

I cannot test the port on an x86_64 machine. Please tell me the result of `sudo port test ruby'.

comment:3 Changed 16 years ago by m@…

I'll attach the debug information for the test with +x86_64 and +thread_hooks. It does not seem to raise any error.

Changed 16 years ago by m@…

results of test phase +x86_64 +thread_hooks (r39392) OK

comment:4 Changed 16 years ago by m@…

I seems to me that by setting the cflags/args/patches as darwin x86_64 specific they will be ignored as the platform is recognized as i386 (for legacy reasons?) as proof:

[root@mig01 ruby-1.8.7-p72]# file libruby.dylib libruby.dylib: Mach-O dynamically linked shared library i386

that's why when I patched the portfile a variant was added

comment:5 Changed 16 years ago by jmroot (Joshua Root)

Apple's gcc builds for i386 by default when running on x86_64, so that's the arch that ends up in tcl_platform(machine), which is where we get the os.arch value.

comment:6 Changed 16 years ago by m@…

so it means that the suggested cflags/args/patch should have been kept as a variant and not as platform specific as implemented in r39392, right?

comment:7 Changed 16 years ago by ryandesign (Ryan Carsten Schmidt)

Well, in MacPorts, there is no "platform" that has x86_64. The platform for darwin is always either powerpc or i386.

If you change it to a variant it would work, but the correct solution is to fix the universal variant. We don't want each port to invent a new way to support 64-bit builds.

comment:8 Changed 16 years ago by m@…

Sure, makes sense. I was afraid of breaking the settings for other platforms by patching the universal variant. Most of the information I found on the guide & wiki doesn't go very deep, and unfortunately I don't have much time to infer from the source code in Tcl. Could you please let me know where one can efficiently find further information?

comment:9 Changed 16 years ago by kimuraw (kimura wataru)

Thanks all, I reverted the change of r39392.

If you can build ruby for x86_64 without macports, please send me the complete log of configure and make step. It seems ruby-1.8.7 does not support for darwin x86_64 in config.guess. I make a patch for config.guess. The patch affects archdir of lib/ruby.

Changed 16 years ago by kimuraw (kimura wataru)

Attachment: patch-config.guess.diff added

correct archdir of darwin x86_64

comment:10 Changed 15 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

comment:11 Changed 14 years ago by kimuraw (kimura wataru)

Resolution: fixed
Status: assignedclosed

x86_64 is now available ruby-1.8.7-p174 with macports-1.8.0 on Mac OS X 10.6 Snow Leopard.

Note: See TracTickets for help on using tickets.