Skip to content

Instantly share code, notes, and snippets.

@NickClark
Created April 22, 2012 01:36
Show Gist options
  • Save NickClark/2440705 to your computer and use it in GitHub Desktop.
Save NickClark/2440705 to your computer and use it in GitHub Desktop.
Windows Compilation

I have a lib I am trying to link against at:

hitt\ext\hittsdk\H-ITTSDK_2.0.4\lib\windows\h-ittsdk.dll

It can find the header file at:

hitt\ext\hittsdk\H-ITTSDK_2.0.4\include\H-ITTSDK.h

I have this working on my Mac, but I need to now get it working on windows.

require 'mkmf'
source_dir = File.expand_path RbConfig::CONFIG['srcdir']
if RUBY_PLATFORM =~ /win32|mingw/i
hitt_folder = "windows"
else
hitt_folder = "macosx"
end
dir_config('hitt_sdk', source_dir + "/H-ITTSDK_2.0.4/include", source_dir + "/H-ITTSDK_2.0.4/lib/#{hitt_folder}")
unless find_header("H-ITTSDK.h")
abort "H-ITTSDK is missing!!!"
end
unless find_library("h-ittsdk", "hitt_sdk_version")
abort "libH-ITTSDK is missing!!!"
end
create_makefile("hittsdk/hittsdk")
find_header: checking for H-ITTSDK.h... -------------------- yes
"gcc -o conftest -Ic:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1/i386-mingw32 -Ic:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1/ruby/backward -Ic:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1 -I../../../../ext/hittsdk -Ic:/Sites/hitt/ext/hittsdk/H-ITTSDK_2.0.4/include -O3 -fno-omit-frame-pointer -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -L. -Lc:/RailsInstaller/Ruby1.9.3/lib -Lc:/Sites/hitt/ext/hittsdk/H-ITTSDK_2.0.4/lib/windows -L. -lmsvcrt-ruby191 -lshell32 -lws2_32 -limagehlp "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: int main() {return 0;}
/* end */
"gcc -E -Ic:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1/i386-mingw32 -Ic:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1/ruby/backward -Ic:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1 -I../../../../ext/hittsdk -Ic:/Sites/hitt/ext/hittsdk/H-ITTSDK_2.0.4/include -O3 -fno-omit-frame-pointer -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <H-ITTSDK.h>
/* end */
--------------------
find_library: checking for hitt_sdk_version() in -lh-ittsdk... -------------------- no
"gcc -o conftest -Ic:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1/i386-mingw32 -Ic:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1/ruby/backward -Ic:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1 -I../../../../ext/hittsdk -Ic:/Sites/hitt/ext/hittsdk/H-ITTSDK_2.0.4/include -O3 -fno-omit-frame-pointer -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -L. -Lc:/RailsInstaller/Ruby1.9.3/lib -Lc:/Sites/hitt/ext/hittsdk/H-ITTSDK_2.0.4/lib/windows -L. -lmsvcrt-ruby191 -lh-ittsdk -lshell32 -lws2_32 -limagehlp "
conftest.c: In function 't':
conftest.c:8:53: error: 'hitt_sdk_version' undeclared (first use in this function)
conftest.c:8:53: note: each undeclared identifier is reported only once for each function it appears in
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5:
6: /*top*/
7: int main() {return 0;}
8: int t() { void ((*volatile p)()); p = (void ((*)()))hitt_sdk_version; return 0; }
/* end */
"gcc -o conftest -Ic:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1/i386-mingw32 -Ic:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1/ruby/backward -Ic:/RailsInstaller/Ruby1.9.3/include/ruby-1.9.1 -I../../../../ext/hittsdk -Ic:/Sites/hitt/ext/hittsdk/H-ITTSDK_2.0.4/include -O3 -fno-omit-frame-pointer -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c -L. -Lc:/RailsInstaller/Ruby1.9.3/lib -Lc:/Sites/hitt/ext/hittsdk/H-ITTSDK_2.0.4/lib/windows -L. -lmsvcrt-ruby191 -lh-ittsdk -lshell32 -lws2_32 -limagehlp "
conftest.c: In function 't':
conftest.c:8:1: warning: implicit declaration of function 'hitt_sdk_version'
C:\Users\Loaner\AppData\Local\Temp\ccD1SjC2.o: In function `t':
c:\Sites\hitt\tmp\i386-mingw32\hittsdk\1.9.3/conftest.c:8: undefined reference to `hitt_sdk_version'
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <winsock2.h>
4: #include <windows.h>
5:
6: /*top*/
7: int main() {return 0;}
8: int t() { hitt_sdk_version(); return 0; }
/* end */
--------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment