Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building on Mac #7

Closed
algobardo opened this issue Apr 3, 2014 · 6 comments
Closed

Building on Mac #7

algobardo opened this issue Apr 3, 2014 · 6 comments

Comments

@algobardo
Copy link

Hi,
i'm trying to build on Mac,
when i run configure i get

checking if performance counters are usable...
result: no (cannot compile ocamlutil/stats_stubs.c.in)

however stats_stubs.o is generated, but making returns linking error

ld: warning: ignoring file ocamlutil/stats_stubs.o, file was built for i386 which is not the architecture being linked (x86_64): ocamlutil/stats_stubs.o
Undefined symbols for architecture x86_64:
"_has_performance_counters", referenced from:
.L172 in stats.o
_camlStats__28 in stats.o
"_read_pentium_perfcount", referenced from:
.L215 in stats.o
_camlStats__28 in stats.o
"_reset_performance_counters", referenced from:
.L178 in stats.o
.L175 in stats.o
_camlStats__28 in stats.o
"_sample_pentium_perfcount_10", referenced from:
.L168 in stats.o
_camlStats__28 in stats.o
"_sample_pentium_perfcount_20", referenced from:
.L170 in stats.o
_camlStats__28 in stats.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
File "caml_startup", line 1:

can you help me to build it ?

@kmicinski
Copy link
Member

This looks like you've built for i386, but you need to build with the CCFLAGS=-arch i386.

There's a note about this in the readme, have you tried using this option? Make sure to do a make clean beforehand.

@algobardo
Copy link
Author

Setted CFLAGS and CCFLAGS as in the readme.

Il giorno 03/apr/2014, alle ore 16:04, Kristopher Micinski notifications@github.com ha scritto:

This looks like you've built for i386, but you need to build with the CCFLAGS=-arch i386.

There's a note about this in the readme, have you tried using this option? Make sure to do a make clean beforehand.


Reply to this email directly or view it on GitHub.

@kmicinski
Copy link
Member

I just tried a fresh build on my mac, and got the same error. Using ocaml
4.01.0 (from opam) I was able to progress farther:

Undefined symbols for architecture x86_64:
  "_read_ppc", referenced from:
      _read_pentium_perfcount in stats_stubs.o
ld: symbol(s) not found for architecture x86_64

That's the error I got, and I'm not sure what's happening with it. I will
look into the issue today.

Kris

On Thu, Apr 3, 2014 at 10:39 AM, algobardo notifications@github.com wrote:

Setted CFLAGS and CCFLAGS as in the readme.

Il giorno 03/apr/2014, alle ore 16:04, Kristopher Micinski <
notifications@github.com> ha scritto:

This looks like you've built for i386, but you need to build with the
CCFLAGS=-arch i386.

There's a note about this in the readme, have you tried using this
option? Make sure to do a make clean beforehand.

Reply to this email directly or view it on GitHub.

Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-39458766
.

@jsjeon
Copy link
Member

jsjeon commented Jun 20, 2014

Performance counters are borrowed from CIL, C Intermediate Language. It seems hardware counters are no longer maintained, and thus discarded from redexer as well. (./configure is removed, too.) Please update the repo, and just make again.

Thanks,
Jinseong

@jsjeon jsjeon closed this as completed Jun 20, 2014
@matthewhammer
Copy link

I'm trying to compile CEAL and I'm getting the following error, which Kris got above:

Linking bytecode obj/x86_DARWIN/cilly.byte.exe
+ clang -Wl,-no_compact_unwind -o 'obj/x86_DARWIN/cilly.byte.exe'   '-L/usr/local/lib/ocaml' -g '/var/folders/t7/_4_c10rn4jxbn0qx2wrtyk480000gp/T/camlprim96cdda.c' '-lcamlstr' '-lunix' '-lunix' '-lstr' 'obj/x86_DARWIN/perfcount.o' '-lcamlrun' -I'/usr/local/lib/ocaml' -lcurses -lpthread
Undefined symbols for architecture x86_64:
  "_read_ppc", referenced from:
      _read_pentium_perfcount in perfcount.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
File "_none_", line 1:
Error: Error while building custom runtime system
make: *** [obj/x86_DARWIN/cilly.byte.exe] Error 2

What was the fix for this?

@kmicinski
Copy link
Member

In our case I think the answer was to simply remove the old deprecated
performance counters (that used hardware counters) from redexer and use
software counters instead: that didn't link to this problematic function.
The old advice that fixed this was setting CCFLAGS=-arch i386 in the
configuration.

In general, though, these linking issues seem to be because there is some
weirdness with clang: I'm sorry I can't be more helpful than that though.

Maybe you could track down the hardware counters in CEAL and hack them out
like we did in redexer?

Kris

On Sun, Mar 15, 2015 at 1:03 PM, Matthew Hammer notifications@github.com
wrote:

I'm trying to compile CEAL and I'm getting the following error, which Kris
got above:

Linking bytecode obj/x86_DARWIN/cilly.byte.exe

  • clang -Wl,-no_compact_unwind -o 'obj/x86_DARWIN/cilly.byte.exe' '-L/usr/local/lib/ocaml' -g '/var/folders/t7/_4_c10rn4jxbn0qx2wrtyk480000gp/T/camlprim96cdda.c' '-lcamlstr' '-lunix' '-lunix' '-lstr' 'obj/x86_DARWIN/perfcount.o' '-lcamlrun' -I'/usr/local/lib/ocaml' -lcurses -lpthread
    Undefined symbols for architecture x86_64:
    "_read_ppc", referenced from:
    _read_pentium_perfcount in perfcount.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    File "none", line 1:
    Error: Error while building custom runtime system
    make: *** [obj/x86_DARWIN/cilly.byte.exe] Error 2

What was the fix for this?


Reply to this email directly or view it on GitHub
#7 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants