Error Linking a Static File for COBOL DB2 on RHEL - gcc

Compiling/Linking COBOL code for DB2 on a RHEL 8.6 server which is hitting an error.
Command running:
cob2 -F/etc/cob2.cfg -v myfile.cbl -L/opt/IBM/db2/V11.5/lib32 -I/opt/IBM/db2/V11.5/include/cobol_a -ldb2 -q"size(16384k)" -L. linkfile.a -o myfile.exe
db2level Informational tokens are "DB2 v11.5.0.0", "s1906101300", "DYN1906101300AMD64", and Fix Pack "0". Product is installed at "/opt/IBM/db2/V11.5"
cob2 -V Program cob2 Version 1.1.0 Built Mon Sep 27 10:39:30 2021
Error Message:
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib/Scrtl.0(.text+0x1c): unresolvable R_386_GOTOFF relocation against symbol '__libc_csu_fini'
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error ld returned 1 exit status.
Tried changing various options but running out of options now.
I was expecting/hoping for a clean compile and link, and the .exe file available.
No CFLAGS and/or LDFLAGS set.
gcc -v Using built-in specs. COLLECT GCC=gcc COLLECT LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable- __cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-objext --enable-linkr-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune-generic --with-arch_32=x86-64 --build=x86_64-redhat-linux Thread model: posix gcc version 8.5.0 20210514 (Red Hat 8.5.0-10) (GCC)
Incoming argument vector for cob2... [ 0] - 4: cpb2 [ 1] - 2: -# [ 2] - 15: -F/etc/cob2.cfg [ 3] - 2: -v [ 4] - 18: /tmp/out/myfile.cbl [ 5] - 10: linkfile.a [ 6] - 26: -L/opt/IBM/db2/V11.5/lib32 [ 7] - 36: -I/opt/IBM/db2/V11.5/include/cobol_a [ 8] - 5: -ldb2 [ 9] - 14: -qsize(16384K) [10] - 2: -o [11] - 20: /code/bin/myfile.exe
Outgoing environment variables... PATH: /opt/ibm/cobol/1.1.0/usr/bin/:/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/user1///bin/usr/bin/X11:/sbin:/:/code/bin:/code/scripts/home/user1//sqllib/bin LIBPATH: /home/user1//sqllib/lib:/usr/lib:/lib LD_LIBRARY_PATH: /opt/ibm/cobol/rte/usr/lib/:/opt/ibm/cobol/rte/:/opt/ibm/cobol1.1.0/usr/lib:home/user1/sqllib/lib32:/home/user1//sqllib/lib32/gskit NLSPATH: /opt/ibm/cobol/rte/usr/lib/usr/share/locale/%L/%N:/opt/ibm/cobol/rte/usr/share/locale/%L/%N:/opt/ibm/cobol/1.1.0/usr/share/locale/%L/%N:/opt/IBM/db2/V11.5/msg/%L/%N:/opt/IBM/db2/V11.5/msg/en_US/%N SYSLIB: /opt/IBM/db2/V11.5/include/cobol_a:/opt/IBM/db2/V11.5/include/cobol_a
Outgoing argument vector for /opt/ibm/cobol/1.1.0/usr/bin/cob3 ... [ 0] - 33 /opt/ibm/cobol/1.1.0/usr/bin/cob3 [ 1] - 14 -qsize(16384K)
exec: /opt/ibm/cobol/1.1.0/usr/bin/cob3 -qsize(16384K) /tmp/myfile.cbl
Outgoing argument vector for /usr/bin/gcc ... [ 0] - 12: /usr/bin/gcc [ 1] - 4: -m32 [ 2] - 7: -shared [ 3] - 5: -fPIC [ 4] - 9: -rdynamic [ 5] - 28: -fasynchronous -unwind -tables [ 6] - 20: -W1, --hash-style=gnu [ 7] - 18: -W1, --export-dynam [ 8] - 14: -W1, -Bsymbolic [ 9] - 14: -W1, --build-id [10] - 22: -W1, --enable-new-dtags [11] - 11: -W1, -zrelro [12] - 9: -W1, -znow [13] - 10: -W1, -zdefs [14] - 18: -W1, -z,noexecstack [15] - 12: -W1, -znotext [16] - 27: -W1, ---allow-shlib-undefined [17] - 4: -pie [18] - 5: -fPIE [19] - 15: --fwhole-program [20] - 15: -W1, --as-needed [21] - 8: myfile.o [22] - 10: linkfile.a [23] - 26: -L/opt/IBM/db2/V11.5/lib32 [24] - 5: ldb2 [25] - 2: -o [26] - 19: /code/bin/myfile.exe [27] - 15: -W1, --no-omagic [28] - 13: -W1, Bdynamic [29] - 15: -W1, --as-needed [30] - 31: L/opt/ibm/cobol/1.1.0/usr/lib/ [31] - 29: L/opt/ibm/cobol/rte/usr/lib/ [32] - 10: -lcob2_32s [33] - 10: -lcob2_32r [34] - 9: -ldfp_32r [35] - 3: -lm [36] - 9: -lpthread [37] - 150: -W1, -rpath,/opt/ibm/cobol/rte/usr/lib/:/opt/ibm/cobol/rte/:/opt/ibm/cobol/1.1.0/usr/lib/:/home/user1//sqllib/lib32:/home/user1/sqllib/lib32/gskit
exec: /usr/bin/gcc -m32 -shared -fPIC -rdynamic -fasynchronous -unwind -tables -W1, --hash-style=gnu -W1, --export-dynam -W1, -Bsymbolic -W1, --build-id -W1, --enable-new-dtags -W1, -zrelro -W1, -znow -W1, -zdefs -W1, -z,noexecstack -W1, -znotext -W1, ---allow-shlib-undefined -pie -fPIE --fwhole-program -W1, --as-needed myfile.o linkfile.a -L/opt/IBM/db2/V11.5/lib32 ldb2 -o /code/bin/myfile.exe -W1, --no-omagic -W1, Bdynamic -W1, --as-needed L/opt/ibm/cobol/1.1.0/usr/lib/ L/opt/ibm/cobol/rte/usr/lib/ -lcob2_32s -lcob2_32r -ldfp_32r -lm -lpthread -W1, -rpath,/opt/ibm/cobol/rte/usr/lib/:/opt/ibm/cobol/rte/:/opt/ibm/cobol/1.1.0/usr/lib/:/home/user1//sqllib/lib32:/home/user1/sqllib/lib32/gskit

You get this error when incompatible compilation/link options and object/library files are present.
In your case your linkfile.a library may be built with different compilation options than the defaults for cob2, causing the symptom.
To resolve this, you should either arrange for linkfile.a to be rebuilt with similar options to your cobol object file (typically the -fPIC option is significant, there may be others), or use a different library that is already built in a compatible manner .
If you cannot do that, you need to plan a different way to interface from COBOL with the functionality that is provided in your linkfile.a , so refer to the developer(s) of that functionality for advice.

Related

How can I use GCC to compile a binary file which can be used for my FPGA,where I have used verilog to synthesis

First I synthesized a CPU that supports RISCV32IM using verilog, but I can't test if the CPU is working properly. I hope a compiler(such as GCC) can generate instructions to help me test, but normal compilers can only generate EXE files that require the operating system. Obviously, my FPGA can't do this.
I only need a series of RISCV32IM instructions that can run on FPGA and can implement the corresponding functions. If I can, I want his first instruction to be the program entry, which will save me energy.
Of course you can it is somewhat trivial, you did or someone selected baremetal tab for you, it is a baremetal program I assume you want to run.
so.s
lui x2,0x22222
lui x3,0x33333
lui x4,0x44444
lui x5,0x55555
lui x6,0x66666
j .
riscv32-none-elf-as so.s -o so.o
riscv32-none-elf-objdump -d -Mnumeric so.o
so.o: file format elf32-littleriscv
Disassembly of section .text:
00000000 <.text>:
0: 22222137 lui x2,0x22222
4: 333331b7 lui x3,0x33333
8: 44444237 lui x4,0x44444
c: 555552b7 lui x5,0x55555
10: 66666337 lui x6,0x66666
14: 0000006f j 14 <.text+0x14>
now you can just
riscv32-none-elf-ld -Ttext=0 so.o -o so.elf
riscv32-none-elf-ld: warning: cannot find entry symbol _start; defaulting to 0000000000000000
riscv32-none-elf-objdump -d -Mnumeric so.elf
so.elf: file format elf32-littleriscv
Disassembly of section .text:
00000000 <__BSS_END__-0x1018>:
0: 22222137 lui x2,0x22222
4: 333331b7 lui x3,0x33333
8: 44444237 lui x4,0x44444
c: 555552b7 lui x5,0x55555
10: 66666337 lui x6,0x66666
14: 0000006f j 14 <__BSS_END__-0x1004>
but at least with arm and not sure about other binutils targets there are very very old, longstanding bugs in the tools when used like that (get gaps in the binary, etc). So
memmap
MEMORY
{
hello : ORIGIN = 0x00000000, LENGTH = 0x3000
}
SECTIONS
{
.text : { *(.text*) } > hello
.rodata : { *(.rodata*) } > hello
.bss : { *(.bss*) } > hello
.data : { *(.data*) } > hello
}
and
riscv32-none-elf-ld -T memmap so.o -o so.elf
riscv32-none-elf-objdump -d -Mnumeric so.elf
so.elf: file format elf32-littleriscv
Disassembly of section .text:
00000000 <.text>:
0: 22222137 lui x2,0x22222
4: 333331b7 lui x3,0x33333
8: 44444237 lui x4,0x44444
c: 555552b7 lui x5,0x55555
10: 66666337 lui x6,0x66666
14: 0000006f j 14 <.text+0x14>
so now you have an elf (or exe or whatever) you can
riscv32-none-elf-objcopy so.elf -O binary so.bin
hexdump -C so.bin
00000000 37 21 22 22 b7 31 33 33 37 42 44 44 b7 52 55 55 |7!"".1337BDD.RUU|
00000010 37 63 66 66 6f 00 00 00 |7cffo...|
00000018
or
riscv32-none-elf-objcopy --srec-forceS3 so.elf -O srec so.srec
cat so.srec
S00A0000736F2E7372656338
S3150000000037212222B731333337424444B75255554C
S30D00000010376366666F0000000D
S70500000000FA
or
riscv32-none-elf-objcopy so.elf -O ihex so.ihex
cat so.ihex
:1000000037212222B731333337424444B752555552
:08001000376366666F00000013
and so on.
Then you can also...
so.s
lui x2,0x00002
jal notmain
j .
.globl hello
hello:
ret
notmain.c
void hello ( unsigned int );
void notmain ( void )
{
unsigned int r;
for (r=0;r<32;r++)
{
hello(r);
}
}
build with commands like these
riscv32-none-elf-as -march=rv32im so.s -o so.o
riscv32-none-elf-gcc -O2 -c -fomit-frame-pointer -march=rv32im -mabi=ilp32 notmain.c -o notmain.o
riscv32-none-elf-ld -T memmap so.o notmain.o -o so.elf
riscv32-none-elf-objdump -D -Mnumeric so.elf
riscv32-none-elf-objcopy -O binary so.elf so.bin
giving
Disassembly of section .text:
00000000 <hello-0xc>:
0: 00002137 lui x2,0x2
4: 00c000ef jal x1,10 <notmain>
8: 0000006f j 8 <hello-0x4>
0000000c <hello>:
c: 00008067 ret
00000010 <notmain>:
10: ff010113 addi x2,x2,-16 # 1ff0 <notmain+0x1fe0>
14: 00812423 sw x8,8(x2)
18: 00912223 sw x9,4(x2)
1c: 00112623 sw x1,12(x2)
20: 00000413 li x8,0
24: 02000493 li x9,32
28: 00040513 mv x10,x8
2c: 00140413 addi x8,x8,1
30: fddff0ef jal x1,c <hello>
34: fe941ae3 bne x8,x9,28 <notmain+0x18>
38: 00c12083 lw x1,12(x2)
3c: 00812403 lw x8,8(x2)
40: 00412483 lw x9,4(x2)
44: 01010113 addi x2,x2,16
48: 00008067 ret
and you can use the .bin file or .srec or whatever you prefer.
basic bare metal stuff...gnu works great for this, very easy to use. llvm/clang is more complicated to figure out but technically will work as well.
I changed the line to
for (r=0;r<3200;r++)
because it was unrolling the loop. I gave up trying to keep track of the ever changing generic llvm tool command line options, so now I build specific for riscv32 and can then use the generic program names as cross tools...
clang -c -march=rv32im so.s -o so.o
clang -c -O2 -march=rv32im notmain.c -o notmain.o
ld.lld -T memmap so.o notmain.o -o so.elf
llvm-objcopy -O binary so.elf so.bin
llvm-objdump -D -Mnumeric so.elf
so.elf: file format elf32-littleriscv
Disassembly of section .text:
00000000 <.text>:
0: 37 21 00 00 lui x2, 2
4: ef 00 c0 00 jal 0x10 <notmain>
8: 6f 00 00 00 j 0x8 <.text+0x8>
0000000c <hello>:
c: 67 80 00 00 ret
00000010 <notmain>:
10: 13 01 01 ff addi x2, x2, -16
14: 23 26 11 00 sw x1, 12(x2)
18: 23 24 81 00 sw x8, 8(x2)
1c: 23 22 91 00 sw x9, 4(x2)
20: 13 04 00 00 li x8, 0
24: 37 15 00 00 lui x10, 1
28: 93 04 05 c8 addi x9, x10, -896
0000002c <.LBB0_1>:
2c: 13 05 04 00 mv x10, x8
30: ef f0 df fd jal 0xc <hello>
34: 13 04 14 00 addi x8, x8, 1
38: e3 1a 94 fe bne x8, x9, 0x2c <.LBB0_1>
3c: 83 20 c1 00 lw x1, 12(x2)
40: 03 24 81 00 lw x8, 8(x2)
44: 83 24 41 00 lw x9, 4(x2)
48: 13 01 01 01 addi x2, x2, 16
4c: 67 80 00 00 ret

Find the optimal combination of setting values for `number of processes` and `OMP_NUM_THREADS` in a particular computing task

The testing environment is Ubuntu 20.04.3 LTS installed on a machine with dual Intel Xeon E5-2699 v4 and Supermicro X10DAi motherboard. I try to compile and test VASP.6.3.0 with recent/latest Intel oneAPI base and hpc toolkits.
The test commands are as follows:
VASP_TESTSUITE_EXE_STD="mpirun -np $nranks -genv OMP_NUM_THREADS=$nthrds -genv I_MPI_PIN_DOMAIN=omp -genv KMP_AFFINITY=verbose,granularity=fine,compact,1,0 -genv KMP_STACKSIZE=512m /home/werner/Public/hpc/vasp/vasp.6.3.0/testsuite/../bin/vasp_std"
VASP_TESTSUITE_EXE_NCL="mpirun -np $nranks -genv OMP_NUM_THREADS=$nthrds -genv I_MPI_PIN_DOMAIN=omp -genv KMP_AFFINITY=verbose,granularity=fine,compact,1,0 -genv KMP_STACKSIZE=512m /home/werner/Public/hpc/vasp/vasp.6.3.0/testsuite/../bin/vasp_ncl"
VASP_TESTSUITE_EXE_GAM="mpirun -np $nranks -genv OMP_NUM_THREADS=$nthrds -genv I_MPI_PIN_DOMAIN=omp -genv KMP_AFFINITY=verbose,granularity=fine,compact,1,0 -genv KMP_STACKSIZE=512m /home/werner/Public/hpc/vasp/vasp.6.3.0/testsuite/../bin/vasp_gam"
I found that the time performance may be very different for a specific job with different combination of np (i.e., number of processes) and OMP_NUM_THREADS. In my test, I found that the combination of -np 16 and OMP_NUM_THREADS=16 is very time-consuming, and I terminated this testing step before it was over. For a summary of the time benchmarks corresponding to the tests here, see this file and the discussion here and for more detailed information.
So a natural question is: How to find the optimal combination of setting values for number of processes and OMP_NUM_THREADS in a particular computing task? Is there a rule of thumb?
The following is supplementary information as a reply to the comments given by Victor Eijkhout, Homer512 and Jérôme Richard:
See the related info give by inxi:
werner#X10DAi-00:~$ inxi -Cxxx
CPU: Topology: 2x 22-Core model: Intel Xeon E5-2699 v4 bits: 64 type: MT MCP SMP arch: Broadwell rev: 1
L2 cache: 110.0 MiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 387287
Speed: 1200 MHz min/max: 1200/3600 MHz Core speeds (MHz): 1: 1200 2: 1202 3: 1202 4: 1202 5: 1200
6: 1202 7: 1203 8: 1201 9: 1204 10: 1201 11: 1654 12: 2007 13: 2204 14: 2200 15: 1245 16: 1202
17: 1202 18: 1202 19: 1203 20: 1202 21: 1203 22: 1202 23: 1202 24: 1201 25: 1202 26: 1202 27: 1201
28: 1202 29: 1202 30: 1202 31: 2066 32: 1202 33: 1202 34: 1202 35: 1203 36: 1202 37: 1202 38: 1202
39: 1202 40: 1202 41: 1200 42: 1516 43: 1200 44: 1200 45: 1200 46: 1202 47: 1200 48: 1200 49: 1200
50: 1200 51: 1201 52: 1201 53: 1201 54: 1201 55: 1200 56: 1201 57: 1204 58: 1200 59: 1200 60: 1609
61: 1871 62: 2200 63: 1251 64: 1201 65: 1201 66: 1201 67: 1200 68: 1203 69: 1200 70: 1201 71: 1201
72: 1201 73: 1201 74: 1201 75: 1200 76: 1200 77: 1200 78: 1201 79: 1203 80: 1523 81: 1201 82: 1200
83: 1200 84: 1201 85: 1201 86: 1200 87: 1200 88: 1204
werner#X10DAi-00:~$ inxi -Mxxx
Machine: Type: Desktop System: Supermicro product: X10DAi v: 123456789 serial: <superuser/root required>
Mobo: Supermicro model: X10DAI v: 1.02 serial: <superuser/root required> UEFI: American Megatrends
v: 3.2 date: 12/16/2019
werner#X10DAi-00:~$ inxi -Sxxx
System: Host: X10DAi-00 Kernel: 5.8.0-43-generic x86_64 bits: 64 compiler: N/A Desktop: GNOME 3.36.9
tk: GTK 3.24.20 wm: gnome-shell dm: GDM3 3.36.3 Distro: Ubuntu 20.04.3 LTS (Focal Fossa)
I retest the test discussed here. See the following for the time baseline and the corresponding combination of options:
nranks=4 nthrds=2
real 0m13.666s
user 1m20.643s
sys 0m4.314s
nranks=8 nthrds=2
real 0m11.908s
user 2m9.973s
sys 0m7.549s
nranks=12 nthrds=2
real 0m11.043s
user 2m55.062s
sys 0m11.161s
nranks=16 nthrds=2
real 0m11.087s
user 3m45.074s
sys 0m15.343s
nranks=4 nthrds=2
real 0m13.511s
user 1m19.949s
sys 0m4.185s
nranks=6 nthrds=4
real 0m13.736s
user 3m38.704s
sys 0m12.471s
nranks=8 nthrds=5
real 0m12.378s
user 5m13.113s
sys 0m18.022s
It seems that the above results are consistent with the comments given by Homer512:
Typical setups to test are one process per core (1-2 threads) or one
per LLC with as many threads as appropriate.
Regards,
HZ

MAC M1 ARM Core - Ruby and Gem pg installation issues

Just wanted to post a question I am facing issues installing gem install pg -v '0.21.0' for 2 projects in my system which is an M1 Mac, has anyone faced issues like this
This is the error I am getting
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
> *** extconf.rb failed ***
Postgres is installed via Homebrew and libpq is also installed, I tried to point to the libpq when gem pg is being installed and try and fix the problem but that is not working too attaching the mkmf log for more details on the error and FYI Postgres is installed and I can also connect to it via terminal and other software. I tried a lot of answers from stack to no avail I am pretty new to Ruby and MAC any help will be great
More info but not sure if relevant had issues installing ruby versions 2.5.0 and 2.3.6 but that is now fixed (was showing as broken earlier so purged it and installed again after manually configuring openssl#1.0 to MAC) but when it was broken both pg and bundle install worked fine for one of my project but the Ruby 2.3.6 version failed to install
EDIT 1
ruby -v
ruby 2.3.6p384 (2017-12-14 revision 61254) [x86_64-darwin20]
which ruby
/Users/akshayvenugopal/.rvm/rubies/ruby-2.3.6/bin/ruby
rvm list
=* ruby-2.3.6 [ x86_64 ]
ruby-2.5.0 [ x86_64 ]
which openssl
/usr/local/opt/openssl#1.0/bin/openssl
postgres --version
postgres (PostgreSQL) 14.0
EDIT 2
have also had issues with nokogiri not sure if that's the issue
Let me know if you need anymore info any assistance will be greatly appreciated
MKMF Log
find_executable: checking for pg_config... -------------------- yes
--------------------
"gcc -o conftest -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/x86_64-darwin20 -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/ruby/backward -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0 -I. -I/opt/homebrew/opt/libpq/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wmisleading-indentation -Wextra-tokens -fno-common -pipe conftest.c -L. -L/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/lib -L/opt/homebrew/opt/libpq/lib -L. -fstack-protector -lruby.2.5.0 -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"gcc -o conftest -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/x86_64-darwin20 -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/ruby/backward -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0 -I. -I/opt/homebrew/opt/libpq/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wmisleading-indentation -Wextra-tokens -fno-common -pipe conftest.c -L. -L/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/lib -L/opt/homebrew/opt/libpq/lib -L. -fstack-protector -lruby.2.5.0 -Wl,-rpath,/opt/homebrew/opt/libpq/lib -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
find_header: checking for libpq-fe.h... -------------------- yes
"gcc -E -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/x86_64-darwin20 -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/ruby/backward -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0 -I. -I/opt/homebrew/opt/libpq/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wmisleading-indentation -Wextra-tokens -fno-common -pipe conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
/* end */
--------------------
find_header: checking for libpq/libpq-fs.h... -------------------- yes
"gcc -E -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/x86_64-darwin20 -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/ruby/backward -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0 -I. -I/opt/homebrew/opt/libpq/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wmisleading-indentation -Wextra-tokens -fno-common -pipe conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq/libpq-fs.h>
/* end */
--------------------
find_header: checking for pg_config_manual.h... -------------------- yes
"gcc -E -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/x86_64-darwin20 -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/ruby/backward -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0 -I. -I/opt/homebrew/opt/libpq/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wmisleading-indentation -Wextra-tokens -fno-common -pipe conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <pg_config_manual.h>
/* end */
--------------------
have_library: checking for PQconnectdb() in -lpq... -------------------- no
"gcc -o conftest -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/x86_64-darwin20 -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/ruby/backward -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0 -I. -I/opt/homebrew/opt/libpq/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wmisleading-indentation -Wextra-tokens -fno-common -pipe conftest.c -L. -L/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/lib -L/opt/homebrew/opt/libpq/lib -L. -fstack-protector -Wl,-rpath,/opt/homebrew/opt/libpq/lib -lruby.2.5.0 -lpq -lpthread -ldl -lobjc "
ld: warning: ignoring file /opt/homebrew/opt/libpq/lib/libpq.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
"_PQconnectdb", referenced from:
_t in conftest-f3b0c7.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
4:
5: /*top*/
6: extern int t(void);
7: int main(int argc, char **argv)
8: {
9: if (argc > 1000000) {
10: printf("%p", &t);
11: }
12:
13: return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return !p; }
/* end */
"gcc -o conftest -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/x86_64-darwin20 -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/ruby/backward -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0 -I. -I/opt/homebrew/opt/libpq/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wmisleading-indentation -Wextra-tokens -fno-common -pipe conftest.c -L. -L/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/lib -L/opt/homebrew/opt/libpq/lib -L. -fstack-protector -Wl,-rpath,/opt/homebrew/opt/libpq/lib -lruby.2.5.0 -lpq -lpthread -ldl -lobjc "
conftest.c:15:13: error: conflicting types for 'PQconnectdb'
extern void PQconnectdb();
^
/opt/homebrew/opt/libpq/include/libpq-fe.h:285:16: note: previous declaration is here
extern PGconn *PQconnectdb(const char *conninfo);
^
conftest.c:16:27: error: too few arguments to function call, single argument 'conninfo' was not specified
int t(void) { PQconnectdb(); return 0; }
~~~~~~~~~~~ ^
/opt/homebrew/opt/libpq/include/libpq-fe.h:285:16: note: 'PQconnectdb' declared here
extern PGconn *PQconnectdb(const char *conninfo);
^
2 errors generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
4:
5: /*top*/
6: extern int t(void);
7: int main(int argc, char **argv)
8: {
9: if (argc > 1000000) {
10: printf("%p", &t);
11: }
12:
13: return 0;
14: }
15: extern void PQconnectdb();
16: int t(void) { PQconnectdb(); return 0; }
/* end */
--------------------
have_library: checking for PQconnectdb() in -llibpq... -------------------- no
"gcc -o conftest -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/x86_64-darwin20 -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/ruby/backward -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0 -I. -I/opt/homebrew/opt/libpq/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wmisleading-indentation -Wextra-tokens -fno-common -pipe conftest.c -L. -L/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/lib -L/opt/homebrew/opt/libpq/lib -L. -fstack-protector -Wl,-rpath,/opt/homebrew/opt/libpq/lib -lruby.2.5.0 -llibpq -lpthread -ldl -lobjc "
ld: library not found for -llibpq
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
4:
5: /*top*/
6: extern int t(void);
7: int main(int argc, char **argv)
8: {
9: if (argc > 1000000) {
10: printf("%p", &t);
11: }
12:
13: return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return !p; }
/* end */
"gcc -o conftest -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/x86_64-darwin20 -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/ruby/backward -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0 -I. -I/opt/homebrew/opt/libpq/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wmisleading-indentation -Wextra-tokens -fno-common -pipe conftest.c -L. -L/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/lib -L/opt/homebrew/opt/libpq/lib -L. -fstack-protector -Wl,-rpath,/opt/homebrew/opt/libpq/lib -lruby.2.5.0 -llibpq -lpthread -ldl -lobjc "
conftest.c:15:13: error: conflicting types for 'PQconnectdb'
extern void PQconnectdb();
^
/opt/homebrew/opt/libpq/include/libpq-fe.h:285:16: note: previous declaration is here
extern PGconn *PQconnectdb(const char *conninfo);
^
conftest.c:16:27: error: too few arguments to function call, single argument 'conninfo' was not specified
int t(void) { PQconnectdb(); return 0; }
~~~~~~~~~~~ ^
/opt/homebrew/opt/libpq/include/libpq-fe.h:285:16: note: 'PQconnectdb' declared here
extern PGconn *PQconnectdb(const char *conninfo);
^
2 errors generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
4:
5: /*top*/
6: extern int t(void);
7: int main(int argc, char **argv)
8: {
9: if (argc > 1000000) {
10: printf("%p", &t);
11: }
12:
13: return 0;
14: }
15: extern void PQconnectdb();
16: int t(void) { PQconnectdb(); return 0; }
/* end */
--------------------
have_library: checking for PQconnectdb() in -lms/libpq... -------------------- no
"gcc -o conftest -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/x86_64-darwin20 -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/ruby/backward -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0 -I. -I/opt/homebrew/opt/libpq/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wmisleading-indentation -Wextra-tokens -fno-common -pipe conftest.c -L. -L/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/lib -L/opt/homebrew/opt/libpq/lib -L. -fstack-protector -Wl,-rpath,/opt/homebrew/opt/libpq/lib -lruby.2.5.0 -lms/libpq -lpthread -ldl -lobjc "
ld: library not found for -lms/libpq
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
4:
5: /*top*/
6: extern int t(void);
7: int main(int argc, char **argv)
8: {
9: if (argc > 1000000) {
10: printf("%p", &t);
11: }
12:
13: return 0;
14: }
15: int t(void) { void ((*volatile p)()); p = (void ((*)()))PQconnectdb; return !p; }
/* end */
"gcc -o conftest -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/x86_64-darwin20 -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0/ruby/backward -I/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/include/ruby-2.5.0 -I. -I/opt/homebrew/opt/libpq/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wmisleading-indentation -Wextra-tokens -fno-common -pipe conftest.c -L. -L/Users/akshayvenugopal/.rvm/rubies/ruby-2.5.0/lib -L/opt/homebrew/opt/libpq/lib -L. -fstack-protector -Wl,-rpath,/opt/homebrew/opt/libpq/lib -lruby.2.5.0 -lms/libpq -lpthread -ldl -lobjc "
conftest.c:15:13: error: conflicting types for 'PQconnectdb'
extern void PQconnectdb();
^
/opt/homebrew/opt/libpq/include/libpq-fe.h:285:16: note: previous declaration is here
extern PGconn *PQconnectdb(const char *conninfo);
^
conftest.c:16:27: error: too few arguments to function call, single argument 'conninfo' was not specified
int t(void) { PQconnectdb(); return 0; }
~~~~~~~~~~~ ^
/opt/homebrew/opt/libpq/include/libpq-fe.h:285:16: note: 'PQconnectdb' declared here
extern PGconn *PQconnectdb(const char *conninfo);
^
2 errors generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <libpq-fe.h>
4:
5: /*top*/
6: extern int t(void);
7: int main(int argc, char **argv)
8: {
9: if (argc > 1000000) {
10: printf("%p", &t);
11: }
12:
13: return 0;
14: }
15: extern void PQconnectdb();
16: int t(void) { PQconnectdb(); return 0; }
/* end */
--------------------

.dbug_loc is missing from binary

I was inspecting ELF binary for the code mentioned below.
I compiled it on gcc 7.4.0 on Ubuntu x86_64 system in Virtual Box as :
gcc -g scratch1.c -o scratch1.out
#include <stdio.h>
void do_stuff(int my_arg){
int my_local = my_arg + 2;
int i;
for (i = 0; i < my_local; ++i) printf("i = %d\n", i);
}
int main(){
do_stuff(2);
return 0;
}
However when I tried to refer to .debug_loc section, it was empty.
objdump --dwarf=loc scratch1.out
scratch1.out: file format elf64-x86-64
Although, I do see some other debug_ sections
[26] .debug_aranges PROGBITS 0000000000000000 0000103b
0000000000000030 0000000000000000 0 0 1
[27] .debug_info PROGBITS 0000000000000000 0000106b
000000000000035f 0000000000000000 0 0 1
[28] .debug_abbrev PROGBITS 0000000000000000 000013ca
0000000000000125 0000000000000000 0 0 1
[29] .debug_line PROGBITS 0000000000000000 000014ef
00000000000000e6 0000000000000000 0 0 1
[30] .debug_str PROGBITS 0000000000000000 000015d5
00000000000002b5 0000000000000001 MS 0 0 1
Need your help why this section is missing.
Need your help why this section is missing.
The .debug_loc section contains DW_AT_location lists, usually emitted only for optimized code.
Since you compiled without optimization, the compiler didn't emit this section. Try building with:
gcc -g -O3 scratch1.c -o scratch1.out
Here is what I see with gcc 8.3.0:
$ gcc -g scratch.c && readelf -WS a.out | grep debug_loc
# no output
$ gcc -g scratch.c -O3 && readelf -WS a.out | grep debug_loc
[32] .debug_loc PROGBITS 0000000000000000 0039db 000230 00 0 0 1

Installing Ruby 1.9.3 on OSX 10.7.3 with RVM (make error)

I am have been trying to install Ruby via rvm on my Mac (OSX 10.7.3, with XCode 4.3.1) for 2 days now... I am getting an "error running make" every time I am trying. I could see many people have encountered the same problem, but so far what has worked for them hasn't for me (installing GCC, updating Xcode, readline related fixes, etc.).
Here is the make.log:
[2012-03-10 00:48:25] make
CC = clang
LD = ld
LDSHARED = clang -dynamiclib
CFLAGS = -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration -fno-common -pipe
XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I. -I.ext/include/x86_64-darwin11.3.0 -I./include -I.
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -install_name /Users/bryandufour/.rvm/rubies/ruby-1.9.3-p125/lib/libruby.1.9.1.dylib -current_version 1.9.1 -compatibility_version 1.9.1 -Wl,-unexported_symbol,_Init_* -Wl,-unexported_symbol,*_threadptr_* -Wl,-u,_objc_msgSend
SOLIBS =
linking miniruby
<internal:prelude>:1: [BUG] Bus Error
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
-- Control frame information -----------------------------------------------
c:0003 p:0002 s:0006 b:0006 l:000005 d:000005 TOP <internal:prelude>:1
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000ce8 d:000ce8 TOP
-- Ruby level backtrace information ----------------------------------------
<internal:prelude>:1:in `<compiled>'
-- C level backtrace information -------------------------------------------
See Crash Report log file under ~/Library/Logs/CrashReporter or
/Library/Logs/CrashReporter, for the more detail of.
-- Other runtime information -----------------------------------------------
* Loaded script: ./miniruby
* Loaded features:
0 enumerator.so
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
make: *** [.rbconfig.time] Abort trap: 6
And the crash report:
Process: miniruby [2844]
Path: /Users/USER/*/miniruby
Identifier: miniruby
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: gnumake [2831]
Date/Time: 2012-03-10 00:48:25.719 +0100
OS Version: Mac OS X 10.7.3 (11D50b)
Report Version: 9
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000103ea2ab7
VM Regions Near 0x103ea2ab7:
--> __TEXT 0000000103e5e000-0000000104045000 [ 1948K] r-x/rwx SM=COW /Users/USER/*
__DATA 0000000104045000-0000000104061000 [ 112K] rw-/rwx SM=PRV /Users/USER/*
Application Specific Information:
objc[2844]: garbage collection is OFF
abort() called
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff9a333ce2 __pthread_kill + 10
1 libsystem_c.dylib 0x00007fff8f17f7d2 pthread_kill + 95
2 libsystem_c.dylib 0x00007fff8f170a7a abort + 143
3 miniruby 0x0000000103e8e759 rb_bug + 185
4 miniruby 0x0000000103f3dbe6 sigbus + 54
5 libsystem_c.dylib 0x00007fff8f1d1cfa _sigtramp + 26
6 miniruby 0x0000000103f9685e vm_exec_core + 2734 (vm.inc:494)
7 miniruby 0x0000000103fa1e9e vm_exec + 94 (vm.c:1221)
8 miniruby 0x0000000103fa1dd2 rb_iseq_eval + 402 (vm.c:1448)
9 miniruby 0x0000000103f39258 ruby_process_options + 1432 (ruby.c:1098)
10 miniruby 0x0000000103e929c0 ruby_options + 128 (eval.c:73)
11 miniruby 0x0000000103e5f0e7 main + 71 (main.c:38)
12 miniruby 0x0000000103e5f094 start + 52
Thread 1:
0 libsystem_kernel.dylib 0x00007fff9a333df2 __select + 10
1 miniruby 0x0000000103fb15e3 thread_timer + 371 (thread_pthread.c:1158)
2 libsystem_c.dylib 0x00007fff8f17d8bf _pthread_start + 335
3 libsystem_c.dylib 0x00007fff8f180b75 thread_start + 13
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000000 rbx: 0x0000000000000006 rcx: 0x0000000104193938 rdx: 0x0000000000000000
rdi: 0x0000000000000303 rsi: 0x0000000000000006 rbp: 0x0000000104193960 rsp: 0x0000000104193938
r8: 0x00007fff7de95fb8 r9: 0x00000001041934e8 r10: 0x00007fff9a333d0a r11: 0xffffff80002d8220
r12: 0x0000000104300028 r13: 0x0000000104295750 r14: 0x00007fff7de98960 r15: 0x00000001043fff50
rip: 0x00007fff9a333ce2 rfl: 0x0000000000000246 cr2: 0x0000000103fa8df0
Logical CPU: 0
Binary Images:
0x103e5e000 - 0x104044ff7 +miniruby (??? - ???) <B6C1C835-8EA0-3BE9-BF1D-8323E0E4A6A3> /Users/USER/*/miniruby
0x7fff63a5e000 - 0x7fff63a92baf dyld (195.6 - ???) <0CD1B35B-A28F-32DA-B72E-452EAD609613> /usr/lib/dyld
0x7fff8dda4000 - 0x7fff8ddaafff libmacho.dylib (800.0.0 - compatibility 1.0.0) <D86F63EC-D2BD-32E0-8955-08B5EAFAD2CC> /usr/lib/system/libmacho.dylib
0x7fff8ded2000 - 0x7fff8ded3ff7 libremovefile.dylib (21.1.0 - compatibility 1.0.0) <739E6C83-AA52-3C6C-A680-B37FE2888A04> /usr/lib/system/libremovefile.dylib
0x7fff8df7e000 - 0x7fff8dfccfff libauto.dylib (??? - ???) <D8AC8458-DDD0-3939-8B96-B6CED81613EF> /usr/lib/libauto.dylib
0x7fff8eb33000 - 0x7fff8eb34ff7 libsystem_sandbox.dylib (??? - ???) <5087ADAD-D34D-3844-9D04-AFF93CED3D92> /usr/lib/system/libsystem_sandbox.dylib
0x7fff8f127000 - 0x7fff8f12efff libcopyfile.dylib (85.1.0 - compatibility 1.0.0) <172B1985-F24A-34E9-8D8B-A2403C9A0399> /usr/lib/system/libcopyfile.dylib
0x7fff8f12f000 - 0x7fff8f20cfef libsystem_c.dylib (763.12.0 - compatibility 1.0.0) <FF69F06E-0904-3C08-A5EF-536FAFFFDC22> /usr/lib/system/libsystem_c.dylib
0x7fff8fb6a000 - 0x7fff8fb6fff7 libsystem_network.dylib (??? - ???) <5DE7024E-1D2D-34A2-80F4-08326331A75B> /usr/lib/system/libsystem_network.dylib
0x7fff90265000 - 0x7fff90269fff libdyld.dylib (195.5.0 - compatibility 1.0.0) <F1903B7A-D3FF-3390-909A-B24E09BAD1A5> /usr/lib/system/libdyld.dylib
0x7fff90275000 - 0x7fff902eaff7 libc++.1.dylib (19.0.0 - compatibility 1.0.0) <C0EFFF1B-0FEB-3F99-BE54-506B35B555A9> /usr/lib/libc++.1.dylib
0x7fff9061d000 - 0x7fff9061dfff libkeymgr.dylib (23.0.0 - compatibility 1.0.0) <61EFED6A-A407-301E-B454-CD18314F0075> /usr/lib/system/libkeymgr.dylib
0x7fff90d6c000 - 0x7fff90d99fe7 libSystem.B.dylib (159.1.0 - compatibility 1.0.0) <7BEBB139-50BB-3112-947A-F4AA168F991C> /usr/lib/libSystem.B.dylib
0x7fff90ff1000 - 0x7fff90ffaff7 libsystem_notify.dylib (80.1.0 - compatibility 1.0.0) <A4D651E3-D1C6-3934-AD49-7A104FD14596> /usr/lib/system/libsystem_notify.dylib
0x7fff9163e000 - 0x7fff9164cfff libdispatch.dylib (187.7.0 - compatibility 1.0.0) <712AAEAC-AD90-37F7-B71F-293FF8AE8723> /usr/lib/system/libdispatch.dylib
0x7fff917a7000 - 0x7fff917e2fff libsystem_info.dylib (??? - ???) <35F90252-2AE1-32C5-8D34-782C614D9639> /usr/lib/system/libsystem_info.dylib
0x7fff91af7000 - 0x7fff91af8fff libunc.dylib (24.0.0 - compatibility 1.0.0) <C67B3B14-866C-314F-87FF-8025BEC2CAAC> /usr/lib/system/libunc.dylib
0x7fff93096000 - 0x7fff93109fff libstdc++.6.dylib (52.0.0 - compatibility 7.0.0) <6BDD43E4-A4B1-379E-9ED5-8C713653DFF2> /usr/lib/libstdc++.6.dylib
0x7fff970c2000 - 0x7fff970cdff7 libc++abi.dylib (14.0.0 - compatibility 1.0.0) <8FF3D766-D678-36F6-84AC-423C878E6D14> /usr/lib/libc++abi.dylib
0x7fff970f8000 - 0x7fff970fafff libquarantine.dylib (36.2.0 - compatibility 1.0.0) <48656562-FF20-3B55-9F93-407ACA7341C0> /usr/lib/system/libquarantine.dylib
0x7fff97907000 - 0x7fff97908fff libdnsinfo.dylib (395.6.0 - compatibility 1.0.0) <718A135F-6349-354A-85D5-430B128EFD57> /usr/lib/system/libdnsinfo.dylib
0x7fff97922000 - 0x7fff97926fff libmathCommon.A.dylib (2026.0.0 - compatibility 1.0.0) <FF83AFF7-42B2-306E-90AF-D539C51A4542> /usr/lib/system/libmathCommon.A.dylib
0x7fff9793c000 - 0x7fff97941fff libcache.dylib (47.0.0 - compatibility 1.0.0) <B7757E2E-5A7D-362E-AB71-785FE79E1527> /usr/lib/system/libcache.dylib
0x7fff97a13000 - 0x7fff97af7e5f libobjc.A.dylib (228.0.0 - compatibility 1.0.0) <871E688B-CF57-3BC7-80D6-F6476DFF109B> /usr/lib/libobjc.A.dylib
0x7fff97c3b000 - 0x7fff97c40fff libcompiler_rt.dylib (6.0.0 - compatibility 1.0.0) <98ECD5F6-E85C-32A5-98CD-8911230CB66A> /usr/lib/system/libcompiler_rt.dylib
0x7fff98234000 - 0x7fff98235ff7 libsystem_blocks.dylib (53.0.0 - compatibility 1.0.0) <8BCA214A-8992-34B2-A8B9-B74DEACA1869> /usr/lib/system/libsystem_blocks.dylib
0x7fff98236000 - 0x7fff98253fff libxpc.dylib (77.18.0 - compatibility 1.0.0) <26C05F31-E809-3B47-AF42-1460971E3AC3> /usr/lib/system/libxpc.dylib
0x7fff984aa000 - 0x7fff984b2fff libsystem_dnssd.dylib (??? - ???) <7749128E-D0C5-3832-861C-BC9913F774FA> /usr/lib/system/libsystem_dnssd.dylib
0x7fff99513000 - 0x7fff99555ff7 libcommonCrypto.dylib (55010.0.0 - compatibility 1.0.0) <A5B9778E-11C3-3F61-B740-1F2114E967FB> /usr/lib/system/libcommonCrypto.dylib
0x7fff9a315000 - 0x7fff9a31bff7 libunwind.dylib (30.0.0 - compatibility 1.0.0) <1E9C6C8C-CBE8-3F4B-A5B5-E03E3AB53231> /usr/lib/system/libunwind.dylib
0x7fff9a31d000 - 0x7fff9a33dfff libsystem_kernel.dylib (1699.22.73 - compatibility 1.0.0) <69F2F501-72D8-3B3B-8357-F4418B3E1348> /usr/lib/system/libsystem_kernel.dylib
0x7fff9a51e000 - 0x7fff9a528ff7 liblaunch.dylib (392.18.0 - compatibility 1.0.0) <39EF04F2-7F0C-3435-B785-BF283727FFBD> /usr/lib/system/liblaunch.dylib
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 5338
thread_create: 1
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=54.6M resident=20.1M(37%) swapped_out_or_unallocated=34.4M(63%)
Writable regions: Total=75.0M written=676K(1%) resident=1396K(2%) swapped_out=0K(0%) unallocated=73.7M(98%)
REGION TYPE VIRTUAL
=========== =======
MALLOC 10.4M
MALLOC guard page 16K
MALLOC_LARGE (reserved) 256K reserved VM address space (unallocated)
STACK GUARD 4K
Stack 64.0M
__DATA 680K
__LINKEDIT 48.1M
__TEXT 6644K
shared memory 12K
=========== =======
TOTAL 129.9M
TOTAL, minus reserved VM space 129.7M
I am a beginner in programming, and am not super familiar with the terminal yet (have been a PC user for many years), so please be indulgent :).
I hope you guys can help.
Enjoy the week-end ;).
please check this answer https://stackoverflow.com/a/9651747/497756
I had no chance to prove if this patch helps for your issue - would be great.
As separate solution (to my previous answer), you might switch back to osx-gcc-installer which is known to compile all rubies.
There were reported comparability issues between osx-gcc-installer and Xcode 4.2.1, but none for Xcode 4.3 (but it's so known usage together).
Apple removed standard GCC from Xcode 4.2 - from this point you can not compile MRI Ruby on OSX easily, osx-gcc-installer is a private build of the required tools including GCC - which has proven to work to compile Ruby.
The most reliable solution is to remove Xcode totally from disk restart computer and install osx-gcc-installer.

Resources