I want to install TclCurl on my MacBook Pro running Snow Leopard, but the only installation option that I can find was to build it via MacPorts. However, I don’t want MacPorts since it will be pulling in too many components. All I want is to build TclCurl and install it. I did download the source code and attempted to build it, but ran into compiler’s error. This post will details the steps I made in order to overcome this problem.
To successfully build and install TclCurl, follow these steps:
- Download the source and unpack
- Configure and build
- Modify the source
- Build again and install
Download the Source and Unpack
After searching for the keyword “TclCurl”, I arrived at the TclCurl download page. Here, I downloaded the only version available at the time, version 7.19.6 under the “Unix and Linux” heading.
Next, I opened a terminal, navigate to the directory containing the source and issue the following command:
tar xf TclCurl-7.19.6.tar.gz cd TclCurl-7.19.6
If you downloaded a different version, replace the version numbers in those commands accordingly.
Configure and build
Now that I was in the TclCurl source directory, I could build and install it:./configure make
However, make did not completed successfully due to a compiler error:gcc -DPACKAGE_NAME=\"TclCurl\" -DPACKAGE_TARNAME=\"tclcurl\" -DPACKAGE_VERSION=\"7.19.6\" -DPACKAGE_STRING=\"TclCurl\ 7.19.6\" -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_IS_LONG=1 -DUSE_TCL_STUBS=1 -I/usr/include -I"/System/Library/Frameworks/Tcl.framework/Headers" -pipe -Os -Wall -fno-common -c `echo ./generic/tclcurl.c` -o tclcurl.o ./generic/tclcurl.c: In function ‘curlSetOpts’: ./generic/tclcurl.c:455: error: ‘ulong’ undeclared (first use in this function) ./generic/tclcurl.c:455: error: (Each undeclared identifier is reported only once ./generic/tclcurl.c:455: error: for each function it appears in.) ./generic/tclcurl.c:455: error: expected ‘;’ before ‘protocolMask’ ./generic/tclcurl.c:1780: error: ‘protocolMask’ undeclared (first use in this function) ...
Did you notice the line that said 'ulong' undeclared? This is where we need to fix for the Mac OS X platform.
Modify the Source
After reviewing the code, I fired up my favorite text editor and added the following block near the beginning of the file generic/tclcurl.h and saved:#ifdef __APPLE__ #define ulong unsigned long #endif
Build again and Install
After making the necessary modification. I am ready to build again and install:make sudo make install
Finally, I can test to see if the TclCurl package has been installed correctly. I ran tclsh and issued the following command:package require TclCurl
Voila! no error. That means the package is installed and ready for use. Now I can resume my work, which needs TclCurl.