1 # Rebuilding gclibo {#gclibo}
3 gclib ships with a compiled version of the open source portion, *gclibo*.
4 However, if a source modification is desired, the following instructions will
5 help with recompiling this portion of the library.
7 <!--- ********************************************************************* -->
11 <!--- ********************************************************************* -->
13 For brevity, these instructions assume the default installation location of **C:\\Program Files (x86)\\Galil\\gclib** and a build type of **x86 (win32)**.
14 The following instructions were performed on *Visual Studio Professional 2015* and can be extended to other Visual Studio versions.
18 Create a working directory. A convenient, empty, writable location, e.g.
20 C:>mkdir %homepath%\Desktop\temp
24 In this documentation, a single *greater-than* character (>) will indicate a command prompt at this working directory.
26 Recompiling gclibo requires the source code for the open source compression library **zlib**.
27 This can be downloaded from the zlib website: **http://zlib.net/zlib1211.zip**.
29 Extract the downloaded zlib source files to the working directory.
31 Open *VS2015 x86 Native Tools Command Prompt* and navigate to the working directory.
33 C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC>cd %homepath%\Desktop\temp
34 C:\Users\user\Desktop\temp>dir /b
39 ####Set an environment variable for the base path.
41 >set base="C:\Program Files (x86)\Galil\gclib"
43 ####Set an environment variable for the zlib base path.
45 >set zlib="%CD%\zlib-1.2.11"
47 ####Copy the gclibo source files.
49 >copy %base%\source\gclibo\*.c .
50 C:\Program Files (x86)\Galil\gclib\source\gclibo\arrays.c
51 C:\Program Files (x86)\Galil\gclib\source\gclibo\gclibo.c
56 Make any necessary changes. For this example, the GInfo() function was changed from
59 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
61 return GUtility(g, G_UTIL_INFO, info, &info_len);
68 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
70 strncpy(info, "My controller", info_len);
72 //return GUtility(g, G_UTIL_INFO, info, &info_len);
78 ####Compile the source code.
80 >cl -c *.c %zlib%\*.c -I %base%\include -I %zlib% -DBUILDING_GCLIB
82 ####Link the binaries.
84 >link /DLL *.obj %base%\lib\dynamic\x86\gclib.lib /OUT:gclibo.dll
87 Copy back to the installation location from the file explorer. This will require administrator privileges.
89 * Copy gclibo.lib to "C:\Program Files (x86)\Galil\gclib\lib\dynamic\x86"
90 * Copy gclibo.dll to "C:\Program Files (x86)\Galil\gclib\dll\x86"
94 ####Copy simple example
96 >copy %base%\examples\cpp\x_simple.c .
98 ####Edit GOpen() call as necessary.
101 >cl x_simple.c %base%\lib\dynamic\x86\*.lib -I %base%\include
105 >set PATH=%base%\dll\x86\;%PATH%
116 response: 355000958.0000
122 <!--- ********************************************************************* -->
126 <!--- ********************************************************************* -->
128 Recompiling gclibo requires the source code for the open source compression library **zlib**.
129 Make will automatically download the needed project from the zlib website: **https://www.zlib.net/**.
135 $ tar -xzf /usr/share/doc/gclib/src/gclibo_src.tar.gz
136 $ cp /usr/include/gclib*.h .
139 Make any necessary changes. For this example, the GInfo() function was changed from
142 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
144 return GUtility(g, G_UTIL_INFO, info, &info_len);
151 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
153 strncpy(info, "My controller", info_len);
155 //return GUtility(g, G_UTIL_INFO, info, &info_len);
161 # make install -f makefile_gclibo
163 wget -q http://zlib.net/zlib-1.2.11.tar.gz
164 shasum -a 256 -c zlib.sha256
165 zlib-1.2.11.tar.gz: OK
166 tar -xzf zlib-1.2.11.tar.gz
168 gcc -c -Wall -w -fPIC -fvisibility=hidden -DBUILDING_GCLIB -DHAVE_VISIBILITY zlib-1.2.11/*.c
169 Compiling open source component, libgclibo.so.0.0
170 gcc -Izlib-1.2.11 -c -Wall -Werror -fPIC -fvisibility=hidden -DBUILDING_GCLIB -DHAVE_VISIBILITY gclibo.c arrays.c
171 Linking open source component into shared library.
172 gcc -shared -o libgclibo.so.0.0 *.o -lgclib -L. -Wl,-rpath=/usr/lib -Wl,-soname=libgclibo.so.0
173 strip --strip-unneeded libgclibo.so.0.0
174 Installing libgclibo.so.0.0
175 install -m 755 libgclibo.so.0.0 /usr/lib
177 # make clean -f makefile_gclibo
183 ####Extract simple example
185 $ tar -xzf /usr/share/doc/gclib/src/gclib_examples.tar.gz x_simple.c
187 #### Edit GOpen() call as necessary.
190 $ gcc x_simple.c -Wall -Werror -lgclib -lgclibo -o simple
201 response: 182879322.0000
205 <!--- ********************************************************************* -->
209 <!--- ********************************************************************* -->
216 $ tar -xvf /Applications/gclib/source/gclibo_src.tar.gz x gclibo.h
220 $ cp /Applications/gclib/include/* .
221 $ cp /Applications/gclib/dylib/gclib.0.dylib .
223 arrays.c gclib.h gclib_record.h gclibo.h
224 gclib.0.dylib gclib_errors.h gclibo.c makefile_gclibo
228 Make any necessary changes. For this example, the GInfo() function was changed from
231 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
233 return GUtility(g, G_UTIL_INFO, info, &info_len);
240 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
242 strncpy(info, "My controller", info_len);
244 //return GUtility(g, G_UTIL_INFO, info, &info_len);
250 $ make -f makefile_gclibo
251 Open source component, gclibo.0.dylib
252 Compiling open source component.
253 gcc -c -Wall -Werror -fPIC -fvisibility=hidden -DBUILDING_GCLIB -DHAVE_VISIBILITY *.c
254 Linking open source component into shared library.
255 gcc -dynamiclib -o gclibo.0.dylib *.o gclib.0.dylib
256 strip -u -r gclibo.0.dylib
258 $ make install -f makefile_gclibo
259 Installing gclibo.0.dylib
260 cp gclibo.0.dylib /Applications/gclib/dylib
261 $ make clean -f makefile_gclibo
267 ####Extract simple example
269 $ tar -xzf /Applications/gclib/examples/gclib_examples.tar.gz x_simple.c
271 #### Edit GOpen() call as necessary.
274 $ gcc x_simple.c -Wall -Werror gclib.0.dylib gclibo.0.dylib -o simple
285 response: 182879322.0000