From: Fredrik Karlsson on
Dear group,

This might possibly be a C (+TEA) question rather than a pure Tcl
question, but since this is concerning an extension I am wrtiting, I
hope someone has seen this before and tell me what to do. My small
extension compiles fine, I think, but it does not link properly (on my
Mac Leopard, using the built-in tcl 8.4).
I get this:

--------------------------------------------------------------------------------------------------------------------------------------------
$ make
gcc -DPACKAGE_NAME=\"emucore\" -DPACKAGE_TARNAME=\"emucore\" -
DPACKAGE_VERSION=\"4.0\" -DPACKAGE_STRING=\"emucore\ 4.0\" -
DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -
DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -
DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -
DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DNO_VALUES_H=1 -DHAVE_LIMITS_H=1 -
DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -
D_THREAD_SAFE=1 -DTCL_THREADS=1 -DMODULE_SCOPE=extern\ __attribute__\(\
(__visibility__\(\"hidden\"\)\)\) -DTCL_WIDE_INT_TYPE=long\ long -
DHAVE_STRUCT_STAT64=1 -DUSE_TCL_STUBS=1 -I"/usr/include" -pipe -
Os -Wall -fno-common -c `echo ./generic/sqlite3.c` -o sqlite3.o
gcc -DPACKAGE_NAME=\"emucore\" -DPACKAGE_TARNAME=\"emucore\" -
DPACKAGE_VERSION=\"4.0\" -DPACKAGE_STRING=\"emucore\ 4.0\" -
DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -
DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -
DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -
DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DNO_VALUES_H=1 -DHAVE_LIMITS_H=1 -
DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -
D_THREAD_SAFE=1 -DTCL_THREADS=1 -DMODULE_SCOPE=extern\ __attribute__\(\
(__visibility__\(\"hidden\"\)\)\) -DTCL_WIDE_INT_TYPE=long\ long -
DHAVE_STRUCT_STAT64=1 -DUSE_TCL_STUBS=1 -I"/usr/include" -pipe -
Os -Wall -fno-common -c `echo ./generic/emutemplate.c` -o
emutemplate.o
gcc -DPACKAGE_NAME=\"emucore\" -DPACKAGE_TARNAME=\"emucore\" -
DPACKAGE_VERSION=\"4.0\" -DPACKAGE_STRING=\"emucore\ 4.0\" -
DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -
DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -
DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -
DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DNO_VALUES_H=1 -DHAVE_LIMITS_H=1 -
DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -
D_THREAD_SAFE=1 -DTCL_THREADS=1 -DMODULE_SCOPE=extern\ __attribute__\(\
(__visibility__\(\"hidden\"\)\)\) -DTCL_WIDE_INT_TYPE=long\ long -
DHAVE_STRUCT_STAT64=1 -DUSE_TCL_STUBS=1 -I"/usr/include" -pipe -
Os -Wall -fno-common -c `echo ./generic/emucore.c` -o emucore.o
gcc -DPACKAGE_NAME=\"emucore\" -DPACKAGE_TARNAME=\"emucore\" -
DPACKAGE_VERSION=\"4.0\" -DPACKAGE_STRING=\"emucore\ 4.0\" -
DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -
DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -
DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -
DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DNO_VALUES_H=1 -DHAVE_LIMITS_H=1 -
DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -
D_THREAD_SAFE=1 -DTCL_THREADS=1 -DMODULE_SCOPE=extern\ __attribute__\(\
(__visibility__\(\"hidden\"\)\)\) -DTCL_WIDE_INT_TYPE=long\ long -
DHAVE_STRUCT_STAT64=1 -DUSE_TCL_STUBS=1 -I"/usr/include" -pipe -
Os -Wall -fno-common -c `echo ./generic/tclemucore.c` -o
tclemucore.o
rm -f libemucore4.0.dylib
gcc -dynamiclib -pipe -Os -Wall -fno-common -prebind -
headerpad_max_install_names -Wl,-search_paths_first -Wl,-
single_module -current_version 4.0 -compatibility_version 4.0 -o
libemucore4.0.dylib sqlite3.o emutemplate.o emucore.o tclemucore.o
tcl -L/System/Library/Frameworks/Tcl.framework/Versions/8.4 -
ltclstub8.4
ld: in tcl, can't map file, errno=22
collect2: ld returned 1 exit status
make: *** [libemucore4.0.dylib] Error 1
--------------------------------------------------------------------------------------------------------------------------------------------

What could this be? I have tried to make sure that the header + lib
match in version by specifying the ful path to the header file. What
else could this be?

/Fredrik
From: Uwe Klein on
Fredrik Karlsson wrote:
> ld: in tcl, can't map file, errno=22
> collect2: ld returned 1 exit status
> make: *** [libemucore4.0.dylib] Error 1
> --------------------------------------------------------------------------------------------------------------------------------------------
>
> What could this be? I have tried to make sure that the header + lib
> match in version by specifying the ful path to the header file. What
> else could this be?
>
> /Fredrik
google shows different instances of your prob, would this match?:

"This is caused because the DED_LD_FLAG_RUNTIME_LIBRARY_PATH
variable is set to empty in darwin, and this causes:"
from:
http://old.nabble.com/problem-compiling-percept-in-mac-os-x-td14272715.html

else
http://www.google.com/search?q=%22ld%3A+in+%2A%2C+can%27t+map+file%2C+errno%3D22%22

uwe
From: Fredrik Karlsson on
Hi,

No, sorry, the problem was really silly: I had managed to include tcl
in the TEA_ADD_LIBS([]) declaration in configure.in.
Removing that explicit linking killed the issue (it now compiles and
links beautifully :-)).

Thank you very much for all your help!

/Fredrik