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: **https://www.zlib.net/**. Extract the downloaded
28 zlib source files to the working directory.
30 Open *VS2015 x86 Native Tools Command Prompt* and navigate to the working directory.
32 C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC>cd %homepath%\Desktop\temp
33 C:\Users\user\Desktop\temp>dir /b
38 ####Set an environment variable for the base path.
40 >set base="C:\Program Files (x86)\Galil\gclib"
42 ####Set an environment variable for the zlib base path.
44 >set zlib="%CD%\zlib-1.2.11"
46 ####Copy the gclibo source files.
48 >copy %base%\source\gclibo\*.c .
49 C:\Program Files (x86)\Galil\gclib\source\gclibo\arrays.c
50 C:\Program Files (x86)\Galil\gclib\source\gclibo\gclibo.c
55 Make any necessary changes. For this example, the GInfo() function was changed from
58 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
60 return GUtility(g, G_UTIL_INFO, info, &info_len);
67 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
69 strncpy(info, "My controller", info_len);
71 //return GUtility(g, G_UTIL_INFO, info, &info_len);
77 ####Compile the source code.
79 >cl -c *.c %zlib%\*.c -I %base%\include -I %zlib% -DBUILDING_GCLIB
81 ####Link the binaries.
83 >link /DLL *.obj %base%\lib\dynamic\x86\gclib.lib /OUT:gclibo.dll
86 Copy back to the installation location from the file explorer. This will require administrator privileges.
88 * Copy gclibo.lib to "C:\Program Files (x86)\Galil\gclib\lib\dynamic\x86"
89 * Copy gclibo.dll to "C:\Program Files (x86)\Galil\gclib\dll\x86"
93 ####Copy simple example
95 >copy %base%\examples\cpp\x_simple.c .
97 ####Edit GOpen() call as necessary.
100 >cl x_simple.c %base%\lib\dynamic\x86\*.lib -I %base%\include
104 >set PATH=%base%\dll\x86\;%PATH%
115 response: 355000958.0000
121 <!--- ********************************************************************* -->
125 <!--- ********************************************************************* -->
127 Recompiling gclibo requires the source code for the open source compression library **zlib**.
128 This can be dowloaded from the zlib website: **https://www.zlib.net/**.
129 Extract the downloaded zlib source files to a known folder, e.g. `~/Downloads/zlib-1.2.11`.
135 $ tar -xvf /usr/share/doc/gclib/src/gclibo_src.tar.gz
140 $ cp /usr/include/gclib*.h .
142 arrays.c gclib.h gclibo.h makefile_gclibo
143 gclib_errors.h gclibo.c gclib_record.h
144 $ cp ~/Downloads/zlib-1.2.11/*.h .
145 $ cp ~/Downloads/zlib-1.2.11/*.c .
149 Make any necessary changes. For this example, the GInfo() function was changed from
152 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
154 return GUtility(g, G_UTIL_INFO, info, &info_len);
161 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
163 strncpy(info, "My controller", info_len);
165 //return GUtility(g, G_UTIL_INFO, info, &info_len);
171 $ make -f makefile_gclibo
172 Open source component, libgclibo.so.0.0
173 Compiling open source component.
174 gcc -c -Wall -Werror -fPIC -fvisibility=hidden -DBUILDING_GCLIB -DHAVE_VISIBILITY *.c
175 Linking open source component into shared library.
176 gcc -shared -o libgclibo.so.0.0 *.o -Wl,-soname=libgclibo.so.0
177 strip --strip-unneeded libgclibo.so.0.0
179 $ sudo make install -f makefile_gclibo
180 Installing libgclibo.so.0.0
181 install -m 755 libgclibo.so.0.0 /usr/lib
183 $ make clean -f makefile_gclibo
189 ####Extract simple example
191 $ tar -xzf /usr/share/doc/gclib/src/gclib_examples.tar.gz x_simple.c
193 #### Edit GOpen() call as necessary.
196 $ gcc x_simple.c -Wall -Werror -lgclib -lgclibo -o simple
207 response: 182879322.0000
211 <!--- ********************************************************************* -->
215 <!--- ********************************************************************* -->
222 $ tar -xvf /Applications/gclib/source/gclibo_src.tar.gz x gclibo.h
226 $ cp /Applications/gclib/include/* .
227 $ cp /Applications/gclib/dylib/gclib.0.dylib .
229 arrays.c gclib.h gclib_record.h gclibo.h
230 gclib.0.dylib gclib_errors.h gclibo.c makefile_gclibo
234 Make any necessary changes. For this example, the GInfo() function was changed from
237 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
239 return GUtility(g, G_UTIL_INFO, info, &info_len);
246 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
248 strncpy(info, "My controller", info_len);
250 //return GUtility(g, G_UTIL_INFO, info, &info_len);
256 $ make -f makefile_gclibo
257 Open source component, gclibo.0.dylib
258 Compiling open source component.
259 gcc -c -Wall -Werror -fPIC -fvisibility=hidden -DBUILDING_GCLIB -DHAVE_VISIBILITY *.c
260 Linking open source component into shared library.
261 gcc -dynamiclib -o gclibo.0.dylib *.o gclib.0.dylib
262 strip -u -r gclibo.0.dylib
264 $ make install -f makefile_gclibo
265 Installing gclibo.0.dylib
266 cp gclibo.0.dylib /Applications/gclib/dylib
267 $ make clean -f makefile_gclibo
273 ####Extract simple example
275 $ tar -xzf /Applications/gclib/examples/gclib_examples.tar.gz x_simple.c
277 #### Edit GOpen() call as necessary.
280 $ gcc x_simple.c -Wall -Werror gclib.0.dylib gclibo.0.dylib -o simple
291 response: 182879322.0000