I'm having a "Unresolved symbol" linker problem when trying to build a
simple program using the curses library with insure++ from Parasoft:
============================================
#include <curses.h>
main()
{
initscr();
addstr("Hello World!\n");
refresh();
endwin();
return 0;
}
============================================
Location of curses library:
prompt> ls -al /usr/lib/libcurses.a
/usr/lib/libxcurses.a -> /usr/ccs/lib/libxcurses.a
prompt> ls -al /usr/lib/libxcurses.a
/usr/lib/libxcurses.a -> /usr/ccs/lib/libxcurses.a
============================================
prompt> insure xlc -bloadmap:ttt -o test test.c -lcurses
** Insure messages will be written to insra **
ld: 0711-317 ERROR: Undefined symbol: term_errno
ld: 0711-317 ERROR: Undefined symbol: term_parm_err
ld: 0711-317 ERROR: Undefined symbol: term_err_strings
ld: 0711-317 ERROR: Undefined symbol: curs_errno
ld: 0711-317 ERROR: Undefined symbol: Mouse_status
ld: 0711-317 ERROR: Undefined symbol: curs_parm_err
ld: 0711-317 ERROR: Undefined symbol: curs_err_strings
ld: 0711-344 See the loadmap file ttt for more information.
ld: 0711-317 ERROR: Undefined symbol: term_errno
ld: 0711-317 ERROR: Undefined symbol: term_parm_err
ld: 0711-317 ERROR: Undefined symbol: term_err_strings
ld: 0711-317 ERROR: Undefined symbol: curs_errno
ld: 0711-317 ERROR: Undefined symbol: Mouse_status
ld: 0711-317 ERROR: Undefined symbol: curs_parm_err
ld: 0711-317 ERROR: Undefined symbol: curs_err_strings
ld: 0711-344 See the loadmap file ttt for more information.
Driver: error executing "Run "-Zoicompiler /usr/vacpp/bin/xlc"
-bloadmap:ttt -o test test.c
-lcurses"
prompt> insure xlC -bloadmap:ttt -o test test.C -lcurses (test.C is
identical to test.c)
(Gives me the same error)
============================================
============================================
*** But if I compile without insure++ it works: xlc -o test test.c
-lcurses,
xlC -o test test.C -lcurses (both work fine, is it a problem with
insure++?)
============================================
============================================
The funny thing is term_errno, term_parm_err... and the rest
are defined and contained in libxcurses.a:
prompt> nm -A -g /usr/ccs/lib/libxcurses.a | grep term_errno
/usr/ccs/lib/libxcurses.a[shr42.o]: term_errno D 512 2
/usr/ccs/lib/libxcurses.a[shr4.o]: term_errno D 12 2
prompt> nm -A -g /usr/ccs/lib/libxcurses.a | grep term_parm_err
/usr/ccs/lib/libxcurses.a[shr42.o]: term_parm_err B 74960 1024
/usr/ccs/lib/libxcurses.a[shr4.o]: term_parm_err B 31592 1024
============================================
I'm working in an AIX environment:
prompt> oslevel
5.2.0.0
prompt> lslpp -l | grep vac.C
vac.C 6.0.0.7 COMMITTED C for AIX Compiler
vac.C.readme.ibm 6.0.0.1 COMMITTED C for AIX iFOR/LS Information
vac.C 6.0.0.7 COMMITTED C for AIX Compiler
prompt> lslpp -l | grep vacpp
vacpp.cmp.aix50.lib 6.0.0.7 COMMITTED VisualAge C++ Libraries for
vacpp.cmp.aix50.tools 6.0.0.1 COMMITTED VisualAge C++ Tools for AIX
vacpp.cmp.core 6.0.0.8 COMMITTED VisualAge C++ Compiler
vacpp.cmp.include 6.0.0.7 COMMITTED VisualAge C++ Compiler Include
vacpp.cmp.lib 6.0.0.0 COMMITTED VisualAge C++ Libraries
vacpp.cmp.rte 6.0.0.0 COMMITTED VisualAge C++ Compiler
vacpp.cmp.tools 6.0.0.7 COMMITTED VisualAge C++ Tools
vacpp.html.DBCS 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.EN_US 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.JA_JP 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.Ja_JP 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.SBCS 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.ZH_CN 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.common 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.en_US 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.help 6.0.0.0 COMMITTED VisualAge C++ HTML Help Engine
vacpp.html.ja_JP 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.zh_CN 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.loc.en_US.cmp.core 6.0.0.0 COMMITTED VisualAge Compiler C++
Locale
vacpp.memdbg.aix50.lib 6.0.0.4 COMMITTED VA C++ User Heap/Memory Debug
vacpp.memdbg.aix50.rte 6.0.0.7 COMMITTED VA C++ User Heap/Memory Debug
vacpp.memdbg.lib 6.0.0.0 COMMITTED VisualAge C++ User Heap and
vacpp.memdbg.rte 6.0.0.0 COMMITTED VisualAge C++ User Heap and
vacpp.msg.en_US.cmp.core 6.0.0.6 COMMITTED VisualAge Compiler C++
vacpp.msg.en_US.cmp.tools 6.0.0.0 COMMITTED VisualAge C++ Tools
vacpp.msg.en_US.html.help 6.0.0.0 COMMITTED VisualAge C++ Help Engine
vacpp.ndi 6.0.0.6 COM MITTED VisualAge C++ Non-Default
vacpp.pdf.Ja_JP 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.pdf.common 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.pdf.en_US 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.pdf.zh_CN 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.samples.ansicl 6.0.0.5 COMMITTED ANSI CLass Library Samples
vacpp.tnb 6.0.0.0 COMMITTED VisualAge C++ Try and Buy
vacpp.cmp.core 6.0.0.6 COMMITTED VisualAge C++ Compiler
vacpp.html.DBCS 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.EN_US 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.JA_JP 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.Ja_JP 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.SBCS 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.ZH_CN 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.common 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.en_US 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.help 6.0.0.0 COMMITTED VisualAge C++ HTML Help Engine
vacpp.html.ja_JP 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.html.zh_CN 6.0.0.0 COMMITTED VisualAge C++ Documentation
vacpp.loc.en_US.cmp.core 6.0.0.0 COMMITTED VisualAge Compiler C++
Locale
vacpp.tnb 6.0.0.0 COMMITTED VisualAge C++ Try and Buy
============================================
It seems that <curses.h> include <term.h> which has these as "extern"
variables:
extern short term_errno;
extern char term_parm_err[], *term_err_strings[], *Def_term;
============================================
prompt> psrcdump -a -v
# Skipping /opt/parasoft/lib.aix5/cc/.insight - no such file, or unable
to open
# /opt/parasoft/lib.aix5/cc/.psrc
Insure++.Compile.avoidexterndecls __pmap_stack
Insure++.Compile.avoidexterndecls kernel_lock crid_lock ptrace_lock
Insure++.Compile.avoidexterndecls core_lock time_lock uidinfo_lock
Insure++.Compile.avoidexterndecls uex_lock suspending_q_lock
Insure++.Compile.avoidexterndecls xmem_global
Insure++.Compile.avoidexterndecls audit_flag iftovt_tab vttoif_tab
Insure++.Compile.avoidexterndecls ps_not_defined nhino hinode cinode
g_adspaceval
Insure++.Compile.avoidexterndecls gfs_lock vfs_list_lock
Insure++.Compile.avoidexterndecls _NLesctab_932 _NLunesctab_932
_NLesctsize_932 _NLunesctsize_932
Insure++.Compile.avoidexterndecls signgam
Insure++.Compiler cc
Insure++.CompilerSkipFlags -E -P -M -S
Insure++.CompilerOptions sizet lu
Insure++.CompilerOptions ansi
Insure++.CompilerOptions bfunc div_t __div
Insure++.CompilerOptions bvar string_literal __FUNCTION__
Insure++.CompilerOptions xfunctype __offsetof
Insure++.PreprocessorFlag -C
Insure++.PreprocessorFlag -Qoption 2
Insure++.PreprocessorFlag -Qpath 1
Insure++.PreprocessorFlag -Qproduce 1
Insure++.PreprocessorFlag -target 1
Insure++.PreprocessorFlag -temp*
Insure++.PreprocessorFlag -time
Insure++.PreprocessorFlag -U*
Insure++.PreprocessorFlag -w
Insure++.SuppressByType va_list
Insure++.CompilerOptions bfunc __abs
Insure++.CompilerOptions bfunc double __acos
Insure++.CompilerOptions bfunc char * __alloca
Insure++.CompilerOptions bfunc double __asin
Insure++.CompilerOptions bfunc double __atan
Insure++.CompilerOptions bfunc double __atan2
Insure++.CompilerOptions bfunc double __cos
Insure++.CompilerOptions bfunc double __exp
Insure++.CompilerOptions bfunc double __fabs
Insure++.CompilerOptions bfunc long __labs
Insure++.CompilerOptions bfunc double __log
Insure++.CompilerOptions bfunc double __log10
Insure++.CompilerOptions bfunc char * __memchr
Insure++.CompilerOptions bfunc __memcmp
Insure++.CompilerOptions bfunc char * __memcpy
Insure++.CompilerOptions bfunc char * __memmove
Insure++.CompilerOptions bfunc char * __memset
Insure++.CompilerOptions bfunc double __sin
Insure++.CompilerOptions bfunc double __sqrt
Insure++.CompilerOptions bfunc char * __strcat
Insure++.CompilerOptions bfunc char * __strchr
Insure++.CompilerOptions bfunc __strcmp
Insure++.CompilerOptions bfunc char * __strcpy
Insure++.CompilerOptions bfunc __strlen
Insure++.CompilerOptions bfunc char * __strncat
Insure++.CompilerOptions bfunc __strncmp
Insure++.CompilerOptions bfunc char * __strncpy
Insure++.CompilerOptions bfunc char * __strrchr
Insure++.CompilerOptions bfunc double __tan
Insure++.CompilerOptions bfunc _setjmp
Insure++.CompilerOptions bfunc _longjmp
Insure++.compilerdeficient hasalignment
Insure++.compileroptions wchart unsigned short
Insure++.compileroptions sizet lu
Insure++.InterfaceLibrary $PARASOFT/lib.%a/cc/libbsd.tql
$PARASOFT/lib.%a/libtql_bsd_cc.a
Insure++.InterfaceLibrary $PARASOFT/lib.%a/cc/libbuiltin.tql
Insure++.InterfaceLibrary $PARASOFT/lib.%a/cc/libc.tql
$PARASOFT/lib.%a/libtql_c_cc.a
Insure++.InterfaceLibrary $PARASOFT/lib.%a/cc/libcurses.tql
$PARASOFT/lib.%a/libtql_curses_cc.a
Insure++.InterfaceLibrary $PARASOFT/lib.%a/cc/libdbm.tql
$PARASOFT/lib.%a/libtql_dbm_cc.a
Insure++.InterfaceLibrary $PARASOFT/lib.%a/cc/libm.tql
$PARASOFT/lib.%a/libtql_m_cc.a
Insure++.InterfaceLibrary $PARASOFT/lib.%a/cc/libpthreads.tql
$PARASOFT/lib.%a/libtql_pthreads_cc.a
Insure++.InterfaceLibrary $PARASOFT/lib.%a/cc/librpcsvc.tql
$PARASOFT/lib.%a/libtql_rpcsvc_cc.a
Insure++.CompilerInstallDir /usr/vac/bin
Insure++.CompilerOptions Esc_X -1
Insure++.CompilerOptions nobtype _wchar_t
Insure++.CompilerOptions nobtype bool
Insure++.CompilerOptions nobtype wchar_t
Insure++.CompilerDeficient InitializerLiterals
# Skipping /opt/parasoft/.insight - no such file, or unable to open
# /opt/parasoft/.psrc
Registertool LicenseServer 1.0
Registertool Insure++ 7.0
Registertool Inuse 7.0
Registertool TCA 7.0
Registertool Insra 7.0
Registertool Insure++64 7.0
Registertool Threads++ 7.0
Insure++.ReportFile insra
Insure++.Summarize bugs leaks outstanding
Insure++.suppress USER_ERROR { malloc frame_init find_fde * }
Insure++.LeakSummaryFilter -i! * Insure::Time::nativeGetLocalTime *
Insure++.LeakSummaryFilter -i! *
Insure::PosixThread::processWillBecomeMultithreaded *
Insure++.LeakSummaryFilter -i! * Insure::Thread::thisThread *
Insure++.LeakSummaryFilter -! malloc
Insure++.LeakSummaryFilter -! * __C_runtime_startup __start
Insure++.LeakSummaryFilter -!i * pthread_atfork * LibGlue * _init
Insure++.LeakSummaryFilter -! * pthread_once
Insure++.LeakSummaryFilter -! * pthread_atfork
============================================
What I'm I doing wrong? Any help would be appreciated, thank you. :)
> I'm having a "Unresolved symbol" linker problem when trying to build a
> simple program using the curses library with insure++ from Parasoft:
This is the wrong forum for that question ...
You'll be better off asking Parasoft tech support.
However, I've been able to reproduce the problem.
Solution: add the line below to /opt/parasoft/lib.aix5/.psrc:
Insure++.compile.avoidexterndecls *
> What I'm I doing wrong? Any help would be appreciated, thank you. :)
Nothing. It's really a mis-feature of the system headers. Explanation here:
http://forums.parasoft.com/index.php?act=ST&f=56&t=385&s=2805ce2e94c30b20163612fd3c816937
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.