[erlang-questions] R16B03-1 installation glitch

Richard A. O'Keefe ok@REDACTED
Tue Feb 18 05:57:28 CET 2014


System:
    Mac OS X 10.7.5 on an Intel Core 2 Duo.
C compiler selected by configure:
    i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1

After running configure, with results described in my previous message,
I ran 'make'.
...
make -f x86_64-apple-darwin11.4.2/Makefile TYPE=opt
can't open x86_64-apple-darwin11.4.2/opt/smp/erl_compile_flags.h for writing at utils/make_compiler_flags line 65.
...
m/beam_emu.c -o obj/x86_64-apple-darwin11.4.2/opt/smp/beam_emu.o
beam/beam_emu.c: In function 'process_main':
beam/beam_emu.c:1281: warning: cast from pointer to integer of different size
In file included from beam/beam_emu.c:1291:
x86_64-apple-darwin11.4.2/opt/smp/beam_hot.h:12: warning: cast from pointer to integer of different size
x86_64-apple-darwin11.4.2/opt/smp/beam_hot.h:21: warning: cast from pointer to integer of different size
x86_64-apple-darwin11.4.2/opt/smp/beam_hot.h:30: warning: cast from pointer to integer of different size
x86_64-apple-darwin11.4.2/opt/smp/beam_hot.h:39: warning: cast from pointer to integer of different size
x86_64-apple-darwin11.4.2/opt/smp/beam_hot.h:48: warning: cast from pointer to integer of different size
x86_64-apple-darwin11.4.2/opt/smp/beam_hot.h:61: warning: cast from pointer to integer of different size
x86_64-apple-darwin11.4.2/opt/smp/beam_hot.h:69: warning: cast from pointer to integer of different size
x86_64-apple-darwin11.4.2/opt/smp/beam_hot.h:77: warning: cast from pointer to integer of different size
x86_64-apple-darwin11.4.2/opt/smp/beam_hot.h:85: warning: cast from pointer to integer of different size
x86_64-apple-darwin11.4.2/opt/smp/beam_hot.h:93: warning: cast from pointer to integer of different size
x86_64-apple-darwin11.4.2/opt/smp/beam_hot.h:101: warning: cast from pointer to integer of different size
...
[lots more]
...
beam/beam_emu.c:1322: warning: cast from pointer to integer of different size
beam/beam_emu.c:1322: warning: cast from pointer to integer of different size
beam/beam_emu.c:1322: warning: cast from pointer to integer of different size
beam/beam_emu.c:1351: warning: cast from pointer to integer of different size
beam/beam_emu.c:1351: warning: cast from pointer to integer of different size
beam/beam_emu.c:1351: warning: cast from pointer to integer of different size
beam/beam_emu.c:1368: warning: cast from pointer to integer of different size
beam/beam_emu.c:1368: warning: cast from pointer to integer of different size
beam/beam_emu.c:1368: warning: cast from pointer to integer of different size
...
[lots more]
...
In file included from beam/beam_emu.c:4548:
x86_64-apple-darwin11.4.2/opt/smp/beam_cold.h:13: warning: cast from pointer to integer of different size
x86_64-apple-darwin11.4.2/opt/smp/beam_cold.h:23: warning: cast from pointer to integer of different size
x86_64-apple-darwin11.4.2/opt/smp/beam_cold.h:32: warning: cast from pointer to integer of different size
x86_64-apple-darwin11.4.2/opt/smp/beam_cold.h:41: warning: cast from pointer to integer of different size

...
[lots more]
...
drivers/unix/unix_efile.c: In function 'efile_fdatasync':
drivers/unix/unix_efile.c:446: warning: implicit declaration of function 'fdatasync'
...
beam/beam_emu.c: In function 'process_main':
beam/beam_emu.c:1281: warning: cast from pointer to integer of different size
In file included from beam/beam_emu.c:1291:
x86_64-apple-darwin11.4.2/opt/plain/beam_hot.h:12: warning: cast from pointer to integer of different size
x86_64-apple-darwin11.4.2/opt/plain/beam_hot.h:21: warning: cast from pointer to integer of different size
x86_64-apple-darwin11.4.2/opt/plain/beam_hot.h:30: warning: cast from pointer to integer of different size
x86_64-apple-darwin11.4.2/opt/plain/beam_hot.h:39: warning: cast from pointer to integer of different size
...
[lots more]
...
drivers/unix/unix_efile.c: In function 'efile_fdatasync':
drivers/unix/unix_efile.c:446: warning: implicit declaration of function 'fdatasync'
...
../unix/run_erl.c:44:1: warning: "_XOPEN_SOURCE" redefined
<command-line>: warning: this is the location of the previous definition
../unix/run_erl.c: In function 'error_logf':
../unix/run_erl.c:1169: warning: implicit declaration of function 'vsyslog'
...
Makefile:71: warning: overriding commands for target `clean'
/home/cshome/o/ok/Downloads/otp_src_R16B03-1/make/otp_subdir.mk:28: warning: ignoring old commands for target `clean'
...
erlc -W  +debug_info +nowarn_shadow_vars +warn_missing_spec +warn_untyped_record -o../ebin hipe.erl
../../compiler/src/beam_disasm.hrl:34: Warning: record function has field(s) without type information
...
erlc -W  +debug_info +warn_unused_import +warn_exported_vars +warn_missing_spec  -o../ebin hipe_icode_cfg.erl
../flow/cfg.inc:177: Warning: missing specification for function params/1
../flow/cfg.inc:181: Warning: missing specification for function params_update/2
...
/o/ok/Downloads/otp_src_R16B03-1/lib/ic/priv/ Term.java
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
CLASSPATH=/home/cshome/o/ok/Downloads/otp_src_R16B03-1/lib/ic/java_src/:/home/cshome/o/ok/Downloads/otp_src_R16B03-1/lib/jinterface/priv/ javac  -d /home/cshome/o/ok/Downloads/otp_src_R16B03-1/lib/ic/priv/ TermHolder.java
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
...
connect/ei_resolve.c: In function 'copy_hostent':
connect/ei_resolve.c:207: warning: cast from pointer to integer of different size
connect/ei_resolve.c:223: warning: cast from pointer to integer of different size
connect/ei_resolve.c:253: warning: cast from pointer to integer of different size
...
anlib: file: /home/cshome/o/ok/Downloads/otp_src_R16B03-1/lib/erl_interface/obj/x86_64-apple-darwin11.4.2/libei.a(decode_bignum.o) has no symbols
ranlib: file: /home/cshome/o/ok/Downloads/otp_src_R16B03-1/lib/erl_interface/obj/x86_64-apple-darwin11.4.2/libei.a(decode_long.o) has no symbols
...
[more like that]
...
crypto.c: In function 'init':
crypto.c:654: warning: 'CRYPTO_num_locks' is deprecated (declared at /usr/include/openssl/crypto.h:415)
crypto.c:666: warning: 'CRYPTO_set_mem_functions' is deprecated (declared at /usr/include/openssl/crypto.h:447)
crypto.c:670: warning: 'CRYPTO_set_locking_callback' is deprecated (declared at /usr/include/openssl/crypto.h:418)
crypto.c:671: warning: 'CRYPTO_set_id_callback' is deprecated (declared at /usr/include/openssl/crypto.h:425)
crypto.c:672: warning: 'CRYPTO_set_dynlock_create_callback' is deprecated (declared at /usr/include/openssl/crypto.h:438)
crypto.c:673: warning: 'CRYPTO_set_dynlock_lock_callback' is deprecated (declared at /usr/include/openssl/crypto.h:439)
crypto.c:674: warning: 'CRYPTO_set_dynlock_destroy_callback' is deprecated (declared at /usr/include/openssl/crypto.h:440)
crypto.c: In function 'info_lib':
crypto.c:750: warning: 'SSLeay_version' is deprecated (declared at /usr/include/openssl/crypto.h:382)
...
[a tedious great many more like that]

There is no fdatasync() in the Mac OS X documentation or
in Apple's headers.  There is SYS_fdatasync in syscall.h.

The warnings in connect/ei_resolve.c refer to uses of
align_buf(buffer, buflen)
This is a macro,
#define align_buf(buf,len) \
  for (;(((unsigned)buf) & EI_ALIGNBYTES); (buf)++,len--)

Changing (unsigned) to (uintptr_t) should make the
warnings go away.  I'm guessing that (UWord) might
be the right thing to use here.  Yes, I know that
the code as written will in fact work on typical C
systems; but why not silence the warning so real
warnings stand out better?

Some of the warnings in beam_emu.c seem to be due to
StoreBifResult(n, res), sometimes via STORE_ARITH_RESULT.

I'm wondering if this might be down to
#define Goto(Rel) {Go = (int)(Rel); goto emulator_loop;}
because in StoreBifResult, we find
	Goto(stb_next);
three times, and there are three warning messages for
each use, and stb_next is a pointer-to-BeamInstr, so it
is definitely wider than an int.

Here is the StoreBifResult macro:

#define StoreBifResult(Dst, Result)                          \
  do {                                                       \
    BeamInstr* stb_next;                                         \
    Eterm stb_reg;                                           \
    stb_reg = Arg(Dst);                                      \
    I += (Dst) + 2;                                          \
    stb_next = (BeamInstr *) *I;                                 \
    CHECK_TERM(Result);                                      \
    switch (beam_reg_tag(stb_reg)) {                         \
    case R_REG_DEF:                                          \
      r(0) = (Result); Goto(stb_next);                       \
    case X_REG_DEF:                                          \
      xb(x_reg_offset(stb_reg)) = (Result); Goto(stb_next);  \
    default:                                                 \
      yb(y_reg_offset(stb_reg)) = (Result); Goto(stb_next);  \
    }                                                        \
  } while (0)

where
   register BeamInstr *I;

So I is a pointer to a BeamInstr.
   It is advanced by Dst+2 words.
   It is deferenced.  This yields a UWord.
   That UWord is coerced to a pointer and saved in stb_reg.
   Eventually Goto does Go = (int)stb_reg;
   coercing the pointer to an int and treating it as an opcode.

UWord (64 bits) -> BeamInstr * (64 bits) is not technically
safe in ISO C, but in practice is OK.  BeamInstr * (64 bits)
to int (32) bits is not safe in principle or in practice.
In _this_ case, it seems to be safe.

It would have been nice to be warned to expect these messages,
though.

beam_cold.h:  NextPF(#, next); -> Goto(*I) -> same issue.

The obvious question is, since this _is_ gcc,
why was the NO_JUMP_TABLE variant selected?












More information about the erlang-questions mailing list