Demo 'sac_from_c' does not compile
|
|
Bugzilla Link |
1143 |
Created on |
Nov 20, 2014 16:53 |
Version |
unspecified |
OS |
Linux |
Architecture |
PC |
Extended Description
## System Details ##
uname -a - Linux 2.6.32-431.20.3.el6.x86_64
#1 SMP Thu Jun 19 14:01:59 CDT 2014 x86_64 GNU/Linux
distro - Scientific (RedHat) Linux 6.5
## SAC Details ##
revision - 18508 devel
stdlib - compiled as 'MODE=lean make mt'
## Problem ##
Tried to compile the 'sac_from_c' demo application (sac/demos/basics/sac_from_c).
Both the sac2c and sac4c processes completed without error. An error was given
when compiling the C program which links to the SAC C-lib.
## Additional ##
I had to edit the Makefile somewhat due to errors regarding the private heap
manager. The relevant line that I changed is 11; it now reads as:
$(CC) -o $* $*.c `sac4c -nophm Sum -ccflags` `sac4c -nophm Sum -ldflags` -pthread
## Error Message ##
gcc -o summarizer summarizer.c `sac4c -nophm Sum -ccflags` `sac4c -nophm Sum -ldflags` -pthread
./libcwrapper.so: undefined reference to `SACARGcopyDataInternal'
./libcwrapper.so: undefined reference to `SACARGfreeDataInternal'
collect2: error: ld returned 1 exit status
## Steps to Reproduce ##
1. cd sac/demos/basics/sac_from_c/
2. make
## Workaround (why?) ##
I wrapped the Structures::sum function in another function, 'mysum':
module Sum;
import Structures : {sum};
export {mysum};
int[] mysum(int[*] vector)
{
a = sum(vector);
return(a);
}
and changed the relevant line in summarizer.c. Doing this there are no errors
reported and the resulting binary runs.
## Extra ##
The output of 'nm -a libcwrapper.so':
0000000000202398 b .bss
0000000000000000 n .comment
00000000002020c0 d .ctors
0000000000202390 d .data
00000000002020d0 d .dtors
00000000002020e8 d .dynamic
00000000000006e0 r .dynstr
00000000000002a8 r .dynsym
0000000000001fe0 r .eh_frame
0000000000001fa0 r .eh_frame_hdr
0000000000001e58 t .fini
0000000000000a64 r .gnu.version
0000000000000ac0 r .gnu.version_r
0000000000202268 d .got
0000000000202298 d .got.plt
0000000000000158 r .hash
0000000000000e28 t .init
00000000002020e0 d .jcr
0000000000000e40 t .plt
0000000000000ae0 r .rela.dyn
0000000000000b88 r .rela.plt
0000000000001e70 r .rodata
0000000000001010 t .text
U SACARGcopyDataInternal
0000000000001d44 T SACARGcopyDataUdt
U SACARGfreeDataInternal
0000000000001dbc T SACARGfreeDataUdt
U SACARGisDouble
U SACARGisFloat
U SACARGisInt
U SACARGisUdt
U SACARGunwrapDouble
U SACARGunwrapFloat
U SACARGunwrapInt
U SACARGunwrapUdtDouble
U SACARGwrapDouble
U SACARGwrapFloat
U SACARGwrapInt
U SACARGwrapUdtDouble
U SAC_HM_MallocAnyChunk_at
U SAC_HM_MallocAnyChunk_mt
U SAC_HM_MallocAnyChunk_st
0000000000001f20 r SAC_HM_thread_status.2426
U SAC_MT_globally_single
U SAC_RuntimeError
U SAC_RuntimeError_Mult
00000000002023a8 B SAC___CWRAPPER__another_dummy_value_which_is_completely_useless
00000000002023ac B SAC___CWRAPPER__dummy_value_which_is_completely_useless
0000000000001158 T SACcw_Sum__sum1
U SACf_ArrayTransform__sum__d_S
U SACf_ArrayTransform__sum__f_S
U SACf_ArrayTransform__sum__i_S
U SACf_ComplexArrayTransform__sum__SACt_ComplexArrayTransform__complex_S
0000000000001cfd T Sum__sum1
00000000002020e8 a _DYNAMIC
0000000000202298 a _GLOBAL_OFFSET_TABLE_
w _ITM_deregisterTMCloneTable
w _ITM_registerTMCloneTable
w _Jv_RegisterClasses
00000000002020c8 d __CTOR_END__
00000000002020c0 d __CTOR_LIST__
00000000002020d8 d __DTOR_END__
00000000002020d0 d __DTOR_LIST__
00000000000020b8 r __FRAME_END__
00000000002020e0 d __JCR_END__
00000000002020e0 d __JCR_LIST__
0000000000001f10 r __PRETTY_FUNCTION__.2498
0000000000001f3a r __PRETTY_FUNCTION__.2631
0000000000202398 d __TMC_END__
U __assert_fail@@GLIBC_2.2.5
0000000000202398 A __bss_start
w __cxa_finalize@@GLIBC_2.2.5
0000000000001e20 t __do_global_ctors_aux
00000000000010a0 t __do_global_dtors_aux
0000000000202390 d __dso_handle
w __gmon_start__
0000000000202398 A _edata
00000000002023b0 A _end
0000000000001e58 T _fini
0000000000000e28 T _init
0000000000001010 t call_gmon_start
0000000000202398 b completed.6301
0000000000000000 a crtstuff.c
0000000000000000 a crtstuff.c
0000000000001030 t deregister_tm_clones
00000000002023a0 b dtor_idx.6303
0000000000001120 t frame_dummy
U free@@GLIBC_2.2.5
0000000000001c8f t freeScalarDesc
0000000000000000 a fun1.c
0000000000000000 a fundummy.c
0000000000000000 a globals.c
0000000000000000 a interface.c
0000000000001c18 t makeScalarDesc
U malloc@@GLIBC_2.2.5
0000000000001060 t register_tm_clones
0000000000000000 a sacargcopy.c
0000000000000000 a sacargfree.c
The output of 'nm -a libsac.seq.so | fgrep SACARGfree':
000000000000d59f T SACARGfree
000000000000d57e t SACARGfreeDataInternal
000000000000d2ea t SACARGfreeDataT_bool
000000000000d11c t SACARGfreeDataT_byte
000000000000d32c t SACARGfreeDataT_char
000000000000d36e t SACARGfreeDataT_classtype
000000000000d3b0 t SACARGfreeDataT_dots
000000000000d2a8 t SACARGfreeDataT_double
000000000000d434 t SACARGfreeDataT_double_dev
000000000000d4fa t SACARGfreeDataT_double_dist
000000000000d497 t SACARGfreeDataT_double_shmem
000000000000d266 t SACARGfreeDataT_float
000000000000d3f2 t SACARGfreeDataT_float_dev
000000000000d4b8 t SACARGfreeDataT_float_dist
000000000000d455 t SACARGfreeDataT_float_shmem
000000000000d287 t SACARGfreeDataT_floatvec
000000000000d34d t SACARGfreeDataT_hidden
000000000000d15e t SACARGfreeDataT_int
000000000000d413 t SACARGfreeDataT_int_dev
000000000000d4d9 t SACARGfreeDataT_int_dist
000000000000d476 t SACARGfreeDataT_int_shmem
000000000000d17f t SACARGfreeDataT_long
000000000000d2c9 t SACARGfreeDataT_longdbl
000000000000d1a0 t SACARGfreeDataT_longlong
000000000000d55d t SACARGfreeDataT_nothing
000000000000d53c t SACARGfreeDataT_rc
000000000000d13d t SACARGfreeDataT_short
000000000000d30b t SACARGfreeDataT_str
000000000000d51b t SACARGfreeDataT_sync
000000000000d1c1 t SACARGfreeDataT_ubyte
000000000000d203 t SACARGfreeDataT_uint
000000000000d224 t SACARGfreeDataT_ulong
000000000000d245 t SACARGfreeDataT_ulonglong
000000000000d0fb t SACARGfreeDataT_unknown
000000000000d3d1 t SACARGfreeDataT_user
000000000000d1e2 t SACARGfreeDataT_ushort
000000000000d38f t SACARGfreeDataT_void
Output of 'nm -a libsac.seq.so | fgrep SACARGcopy':
000000000000e0bc T SACARGcopy
U SACARGcopyDataUdt