Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Tango as static library

Moderators: larsivi kris

Posted: 02/25/07 21:43:06

Is there an easy way to compile tango into a statically linked library so that it could be less painfully used with dmd (in Code::Blocks)?

Author Message

Posted: 02/26/07 08:45:39

We are in the process of sorting out library building issues, but in theory it is no problem building a static library of Tango just like any other library. There is a dsss.conf in trunk that will build a library for each package with the command

dsss build

Posted: 02/26/07 09:25:45

This was not actually possible on Win32 until very recently. There's still some problems to be ironed out, as the recent NG activity related to linkers + libs will attest to :)

Posted: 02/26/07 11:54:55

I've managed to pack tango into a lib, thanks. So I can use it under CB now. Should take a closer look at dsss, though.

BTW, I tried to link with watcom 1.6 linker but I get plenty of unresolved symbols. Where are they defined? Which library I forget to link?

C:\WATCOM\binnt\wlink file test.obj format WINDOWS NT library phobos,tangolib,snn,user32,kernel32 libpath C:\dmd\lib;C:\dm\lib;C:\dmd\import\tango\lib

Open Watcom Linker Version 1.6
Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
loading object files
searching libraries
Error! E2028: ___build_wenviron is an undefined reference
Error! E2028: _setwildcard is an undefined reference
Error! E2028: _Add_Full_Path is an undefined reference
Error! E2028: _parse_program_name is an undefined reference
Error! E2028: __EnsureSemaphore is an undefined reference
Error! E2028: _get_another is an undefined reference
Error! E2028: _find_tail is an undefined reference
Error! E2028: __GETWDECPOINT is an undefined reference
Error! E2028: __DOEXPONENT is an undefined reference
Error! E2028: __TRIM0 is an undefined reference
Error! E2028: ___setmbctype is an undefined reference
Error! E2028: _fillrange is an undefined reference
Error! E2028: _checkcpinfo is an undefined reference
Error! E2028: ?terminate_default@@YAXXZ is an undefined reference
Error! E2028: ?unexpected_default@@YAXXZ is an undefined reference
Error! E2028: ?push_exception@@YAPAUEhstack@@PBDP6CHXZIUlargeprimtype@@@Z is an undefined reference
Error! E2028: ?pop_exception@@YAPAUEhstack@@PAUStaticvar@@PAU1@@Z is an undefined reference
Error! E2028: ?Match_Specification@@YAHPADPBDHPAPAD@Z is an undefined reference
Error! E2028: ?Skip_Handler@@YAPADPADF@Z is an undefined reference
Error! E2028: ?Handle_Foreign_Exception@@YAPAUEhstack@@H@Z is an undefined reference
Error! E2028: ?Find_CPP_Handler@@YAXPAU_CPP_Establisher_Frame@@PADPAUEhstack@@PAUfunc_data@@PAU_EXCEPTION_RECORD@@@Z is an undefined reference
Error! E2028: ?__get_name@@YAPADPBD@Z is an undefined reference
Error! E2028: ?__vc_match_name@@YAHPBD0@Z is an undefined reference
Error! E2028: _console_ctrl_handler@4 is an undefined reference
Error! E2028: _check_sig is an undefined reference
Error! E2028: __sprintf is an undefined reference
Error! E2028: ___snprintf is an undefined reference
Error! E2028: GETLONG is an undefined reference
Error! E2028: GETPOINTER is an undefined reference
Error! E2028: STRLEN2 is an undefined reference
Error! E2028: WCSLEN2 is an undefined reference
Error! E2028: ___swprintf is an undefined reference
Error! E2028: ___snwprintf is an undefined reference
Error! E2028: UL2A is an undefined reference
Error! E2028: STR_CAT is an undefined reference
Error! E2028: STR_CAT1 is an undefined reference
Error! E2028: STR_CAT2 is an undefined reference
Error! E2028: STR_CAT12 is an undefined reference
Error! E2028: STR_BRACKET is an undefined reference
Error! E2028: STR_CATC is an undefined reference
Error! E2028: STR_DUP is an undefined reference
Error! E2028: UM_NESTNAME is an undefined reference
Error! E2028: UM_ARGUMENT_TYPES is an undefined reference
Error! E2028: UM_ARGUMENT is an undefined reference
Error! E2028: UM_DATA_TYPE is an undefined reference
Error! E2028: UM_INDIRECT_TYPE is an undefined reference
Error! E2028: UM_TYPE_ENCODING is an undefined reference
Error! E2028: UM_FUNCTION_TYPE is an undefined reference
Error! E2028: UM_CALLING_CONVENTION is an undefined reference
Error! E2028: UM_ARRAY_TYPE is an undefined reference
Error! E2028: UM_INIT is an undefined reference
Error! E2028: UM_TERM is an undefined reference
Error! E2028: UM_ZNAME is an undefined reference
Error! E2028: UM_SCOPE is an undefined reference
Error! E2028: UM_ECSU_NAME is an undefined reference
Error! E2028: UM_DIMENSION is an undefined reference
Error! E2028: UM_STRING is an undefined reference
Error! E2028: ID_EXPAND is an undefined reference
Error! E2028: ?__match_name@@YAHPBD0@Z is an undefined reference
Error! E2028: ?set_nh@@YAP6AHI@ZP6AHI@ZH@Z is an undefined reference
creating a PE executable
file snn.lib(..\core\buildenv.c): undefined symbol ___build_wenviron
file snn.lib(..\win32\setargv.c): undefined symbol _parse_program_name
file snn.lib(..\win32\setargv.c): undefined symbol _Add_Full_Path
file snn.lib(..\win32\setargv.c): undefined symbol _setwildcard
file snn.lib(..\win32\semlock.c): undefined symbol __EnsureSemaphore
file snn.lib(..\win32\find.c): undefined symbol _get_another
file snn.lib(..\win32\find.c): undefined symbol _find_tail
file snn.lib(..\core\wfmt.c): undefined symbol __TRIM0
file snn.lib(..\core\wfmt.c): undefined symbol __DOEXPONENT
file snn.lib(..\core\wfmt.c): undefined symbol __GETWDECPOINT
file snn.lib(..\core\fmt.c): undefined symbol __TRIM0
file snn.lib(..\core\fmt.c): undefined symbol __DOEXPONENT
file snn.lib(..\core\setmbcp.c): undefined symbol ___setmbctype
file snn.lib(..\core\setmbcp.c): undefined symbol _fillrange
file snn.lib(..\core\setmbcp.c): undefined symbol _checkcpinfo
file snn.lib(..\core\except.cpp): undefined symbol ?terminate_default@@YAXXZ
file snn.lib(..\core\except.cpp): undefined symbol ?unexpected_default@@YAXXZ
file snn.lib(..\core\except.cpp): undefined symbol ?pop_exception@@YAPAUEhstack@@PAUStaticvar@@PAU1@@Z
file snn.lib(..\core\except.cpp): undefined symbol ?push_exception@@YAPAUEhstack@@PBDP6CHXZIUlargeprimtype@@@Z
file snn.lib(..\core\except.cpp): undefined symbol ?Find_CPP_Handler@@YAXPAU_CPP_Establisher_Frame@@PADPAUEhstack@@PAUfunc_data@@PAU_EXCEPTION_RECORD@@@Z
file snn.lib(..\core\except.cpp): undefined symbol ?Handle_Foreign_Exception@@YAPAUEhstack@@H@Z
file snn.lib(..\core\except.cpp): undefined symbol ?Skip_Handler@@YAPADPADF@Z
file snn.lib(..\core\except.cpp): undefined symbol ?Match_Specification@@YAHPADPBDHPAPAD@Z
file snn.lib(..\core\except.cpp): undefined symbol ?__get_name@@YAPADPBD@Z
file snn.lib(..\core\except.cpp): undefined symbol ?__vc_match_name@@YAHPBD0@Z
file snn.lib(..\core\signal.c): undefined symbol _console_ctrl_handler@4
file snn.lib(..\core\signal.c): undefined symbol _check_sig
file snn.lib(..\core\printf.c): undefined symbol __sprintf
file snn.lib(..\core\printf.c): undefined symbol ___snprintf
file snn.lib(..\core\printf.c): undefined symbol GETPOINTER
file snn.lib(..\core\printf.c): undefined symbol GETLONG
file snn.lib(..\core\printf.c): undefined symbol WCSLEN2
file snn.lib(..\core\printf.c): undefined symbol STRLEN2
file snn.lib(..\core\wprintf.c): undefined symbol ___swprintf
file snn.lib(..\core\wprintf.c): undefined symbol ___snwprintf
file snn.lib(..\core\wprintf.c): undefined symbol GETLONG
file snn.lib(..\core\wprintf.c): undefined symbol STRLEN2
file snn.lib(..\core\wprintf.c): undefined symbol GETPOINTER
file snn.lib(..\core\wprintf.c): undefined symbol WCSLEN2
file snn.lib(..\core\unmangle.c): undefined symbol STR_CAT
file snn.lib(..\core\unmangle.c): undefined symbol STR_CAT1
file snn.lib(..\core\unmangle.c): undefined symbol STR_CAT2
file snn.lib(..\core\unmangle.c): undefined symbol ID_EXPAND
file snn.lib(..\core\unmangle.c): undefined symbol UM_NESTNAME
file snn.lib(..\core\unmangle.c): undefined symbol UM_ZNAME
file snn.lib(..\core\unmangle.c): undefined symbol UM_TERM
file snn.lib(..\core\unmangle.c): undefined symbol UM_INIT
file snn.lib(..\core\unmangle.c): undefined symbol UM_TYPE_ENCODING
file snn.lib(..\core\unmangle.c): undefined symbol STR_CAT12
file snn.lib(..\core\unmangle.c): undefined symbol STR_DUP
file snn.lib(..\core\unmangle.c): undefined symbol UM_ARGUMENT
file snn.lib(..\core\unmangle.c): undefined symbol STR_BRACKET
file snn.lib(..\core\unmangle.c): undefined symbol UM_DATA_TYPE
file snn.lib(..\core\unmangle.c): undefined symbol UM_ECSU_NAME
file snn.lib(..\core\unmangle.c): undefined symbol UM_ARRAY_TYPE
file snn.lib(..\core\unmangle.c): undefined symbol UM_INDIRECT_TYPE
file snn.lib(..\core\unmangle.c): undefined symbol UM_SCOPE
file snn.lib(..\core\unmangle.c): undefined symbol UM_FUNCTION_TYPE
file snn.lib(..\core\unmangle.c): undefined symbol UM_CALLING_CONVENTION
file snn.lib(..\core\unmangle.c): undefined symbol UM_ARGUMENT_TYPES
file snn.lib(..\core\unmangle.c): undefined symbol UM_STRING
file snn.lib(..\core\unmangle.c): undefined symbol UM_DIMENSION
file snn.lib(..\core\unmangle.c): undefined symbol STR_CATC
file snn.lib(..\core\unmangle.c): undefined symbol UL2A
file snn.lib(..\core\rtti.cpp): undefined symbol ?__match_name@@YAHPBD0@Z
file snn.lib(..\core\rtti.cpp): undefined symbol ?__get_name@@YAPADPBD@Z
file snn.lib(..\core\_handler.cpp): undefined symbol ?set_nh@@YAP6AHI@ZP6AHI@ZH@Z

Posted: 02/26/07 12:35:24

As far as I know, the errors from the Watcom linker is unrelated to Tango, but results from something that is probably a mismatch between the OMF format that dmd outputs and that the OW linker expects. Similar issues were mentioned in the newsgroup. Unless you are prepared to wrestle with it, I think you need to use the linker that comes with dmd. Note that snn.lib is a library from DigitalMars? with C runtime code or something, and is implicitly linked when you compile programs with DMD.

Posted: 02/26/07 13:01:15

You are right. I'm giving up.

Posted: 05/01/07 18:54:37

Wow, I'm finding Tango pretty hard to work with. I have a Tango based library and test app and was hoping to do some debugging with Code::Blocks, but I guess not. Any idea when this might be available?

Is there any reason why Tango isn't structured more like a standard 3d party library? wxMSW/GTK/MAC for example ships as a complete project that can be built with various compilers into either a static lib, a dll/so, or both. You then have the include files in the source distro and can link against either type of lib.

Is this some issue with Tango/Phobos compatibility?

Are the scripts to switch between Tango and Phobos installed in a GDC distro? I finally got Tango built on a MAC, but it's having compile problems that look like Tango/Phobos problems (Can't find Error object), and I may need to switch back to Phobos for a while.

Brian

Posted: 05/02/07 08:07:50

Brian wrote:

Wow, I'm finding Tango pretty hard to work with. I have a Tango based library and test app and was hoping to do some debugging with Code::Blocks, but I guess not. Any idea when this might be available?

Is there any reason why Tango isn't structured more like a standard 3d party library? wxMSW/GTK/MAC for example ships as a complete project that can be built with various compilers into either a static lib, a dll/so, or both. You then have the include files in the source distro and can link against either type of lib.

Is this some issue with Tango/Phobos compatibility?

I don't exactly get what you want. I'm sure Tango installation could be further improved, but I'm not sure exactly what your problem is? I don't know what is needed to use Code::Blocks either with Tango, if anything special is needed.

As for the standard 3rd party library point, Tango is quite correctly not a standard 3rd party library, especially because of the need to replace Phobos in the setup to work correctly. The exact problem is that the compiler requires a library called libphobos (or libgphobos in the case of GDC) to be linked in. If Tango don't replace this with it's own version, Phobos will be linked in. Note lib/install-gdc.sh and lib/install-gdc.sh --uninstall should work fine if you already have Phobos installed.

Are the scripts to switch between Tango and Phobos installed in a GDC distro? I finally got Tango built on a MAC, but it's having compile problems that look like Tango/Phobos problems (Can't find Error object), and I may need to switch back to Phobos for a while.

This one may depend on what you're trying to build. Tango don't have an Error object, only Exception derived exceptions.

Posted: 05/02/07 23:46:47

The problem is that after installing Tango, my installation was not able to find Tango with anything but bud/build. I just found the -test option in bud and was able to trace back to the root of the problem. I was using an older install that didn't have Tango built into a static library. I remember there was a thread about this in another forum which led me to upgrade my OS/X installation.

I uninstalled Tango and installed the new version from the interactive installer. After making some tweaks to Code::Blocks configurations, I got it working. The debugger is still not working but that's not Tango's fault.

Having Tango in a static lib is what I meant in the previous post by a "Standard" 3d party library. In the other version, Tango came as a collection of .obj files, and Code::Blocks couldn't deal with it easily. Neither could dmd for that matter. You had to supply the path to every single one of Tango's object files somehow. That's why bud/build worked so well: it did that for you.

Well, thanx anyway. Tango IS a great product; it just had some limitations with that older release I guess.

Brian

Posted: 05/12/07 17:34:58

Brian; in the latest svn version, you will now find a build-tango.sh script in lib/ which should build libgtango.a for you (if you have gdmd installed). It is not tested on OSX yet, so I would really like to hear your experiences. And I would also very much like to hear what uname outputs there - I'm currently just assuming that it's Mac/Darwin/OSX as long as it is not Linux.