C 在Windows上编译Rglpk时出错

C 在Windows上编译Rglpk时出错,c,r,gcc,glpk,C,R,Gcc,Glpk,我需要在项目中使用R包Rglpk,并且需要修改包-特别是,我需要向接口添加一个时间限制控制参数选项。它是GLPK v4.5.2本身的一个选项,但Rglpk 0.5-2不支持此参数。这将允许R调用GLPK并将搜索时间限制为用户指定的时间,即搜索时间看起来有两件事情出错了: 对象文件正在进行预编译,但尚未清除 因为这些对象文件是预编译的,而且看起来它们是针对64位体系结构编译的,所以当您尝试在32位构建中使用这些文件时,安装过程会出错 这里的修复方法是删除所有需要作为R CMD构建步骤的一部分编译的

我需要在项目中使用R包Rglpk,并且需要修改包-特别是,我需要向接口添加一个时间限制控制参数选项。它是GLPK v4.5.2本身的一个选项,但Rglpk 0.5-2不支持此参数。这将允许R调用GLPK并将搜索时间限制为用户指定的时间,即搜索时间看起来有两件事情出错了:

对象文件正在进行预编译,但尚未清除

因为这些对象文件是预编译的,而且看起来它们是针对64位体系结构编译的,所以当您尝试在32位构建中使用这些文件时,安装过程会出错

这里的修复方法是删除所有需要作为R CMD构建步骤的一部分编译的*.o文件,我想,然后可以检查生成的tarball


你应该考虑安装一个更新的RStudio和DeVoice版本,并确保你使用DeVoots来处理构建过程——它可能能够帮助你。我发现Rtool包和R的版本不匹配。。。。。这怎么可能成功呢?我还发现可能存在64位/32位不匹配的迹象。我不会成为最终答案的来源,因为我是Mac用户。Rtools v3.1支持Rv3.0.x到v3.1.x,请参阅。我也看到了64位/32位的不匹配。我发现奇怪的是Win Builder服务也返回同样的错误——我很想知道包的维护人员是如何为Windows编译二进制文件的。我已经给他们发了电子邮件,但还没有回复。

** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (Rglpk)
* using R version 3.0.2 (2013-09-25)
* using platform: x86_64-w64-mingw32 (64-bit)
* using session charset: ISO8859-1
* checking for file 'Rglpk/DESCRIPTION' ... OK
* this is package 'Rglpk' version '0.5-2'
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... NOTE
Found the following apparent object files/libraries:
  src/GLPK/alloc.o src/GLPK/amd/amd_1.o src/GLPK/amd/amd_2.o
  src/GLPK/amd/amd_aat.o src/GLPK/amd/amd_control.o
  src/GLPK/amd/amd_defaults.o src/GLPK/amd/amd_dump.o
  src/GLPK/amd/amd_info.o src/GLPK/amd/amd_order.o
  src/GLPK/amd/amd_post_tree.o src/GLPK/amd/amd_postorder.o
  src/GLPK/amd/amd_preprocess.o src/GLPK/amd/amd_valid.o
  src/GLPK/bignum.o src/GLPK/cfg.o src/GLPK/cfg1.o
  src/GLPK/colamd/colamd.o src/GLPK/dmp.o src/GLPK/env.o
  src/GLPK/error.o src/GLPK/ffalg.o src/GLPK/fhv.o src/GLPK/fhvint.o
  src/GLPK/glpapi01.o src/GLPK/glpapi02.o src/GLPK/glpapi03.o
  src/GLPK/glpapi04.o src/GLPK/glpapi05.o src/GLPK/glpapi06.o
  src/GLPK/glpapi07.o src/GLPK/glpapi08.o src/GLPK/glpapi09.o
  src/GLPK/glpapi10.o src/GLPK/glpapi11.o src/GLPK/glpapi12.o
  ..... (more lines are here, I have removed them for brevity)
  src/GLPK/triang.o src/GLPK/wclique.o src/GLPK/wclique1.o
  src/GLPK/zlib/adler32.o src/GLPK/zlib/compress.o
  src/GLPK/zlib/crc32.o src/GLPK/zlib/deflate.o src/GLPK/zlib/gzclose.o
  src/GLPK/zlib/gzlib.o src/GLPK/zlib/gzread.o src/GLPK/zlib/gzwrite.o
  src/GLPK/zlib/inffast.o src/GLPK/zlib/inflate.o
  src/GLPK/zlib/inftrees.o src/GLPK/zlib/trees.o
  src/GLPK/zlib/uncompr.o src/GLPK/zlib/zio.o src/GLPK/zlib/zutil.o
Object files/libraries should not be included in a source package.
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking whether package 'Rglpk' can be installed ... ERROR
Installation failed.

The contents of the 00install.out file are:

* installing *source* package 'Rglpk' ...
** libs

*** arch - i386
gcc -m32 -I"C:/PROGRA~1/R/R-30~1.2/include" -DNDEBUG -IGLPK -IGLPK/amd -IGLPK/colamd -IGLPK/minisat -IGLPK/proxy -IGLPK/zlib    -I"d:/RCompile/CRANpkg/extralibs64/local/include"     -O3 -Wall  -std=gnu99 -mtune=core2 -c Rglpk_initialize.c -o Rglpk_initialize.o
gcc -m32 -I"C:/PROGRA~1/R/R-30~1.2/include" -DNDEBUG -IGLPK -IGLPK/amd -IGLPK/colamd -IGLPK/minisat -IGLPK/proxy -IGLPK/zlib    -I"d:/RCompile/CRANpkg/extralibs64/local/include"     -O3 -Wall  -std=gnu99 -mtune=core2 -c Rglpk_read_file.c -o Rglpk_read_file.o
Rglpk_read_file.c: In function 'Rglpk_read_file':
Rglpk_read_file.c:84:6: warning: 'status' may be used uninitialized in this function [-Wuninitialized]
Rglpk_read_file.c: In function 'Rglpk_retrieve_MP_from_file':
Rglpk_read_file.c:192:6: warning: 'status' may be used uninitialized in this function [-Wuninitialized]
gcc -m32 -I"C:/PROGRA~1/R/R-30~1.2/include" -DNDEBUG -IGLPK -IGLPK/amd -IGLPK/colamd -IGLPK/minisat -IGLPK/proxy -IGLPK/zlib    -I"d:/RCompile/CRANpkg/extralibs64/local/include"     -O3 -Wall  -std=gnu99 -mtune=core2 -c Rglpk_solve.c -o Rglpk_solve.o
Rglpk_solve.c: In function 'R_glp_solve':
Rglpk_solve.c:25:10: warning: variable 'kl' set but not used [-Wunused-but-set-variable]
gcc -m32 -shared -s -static-libgcc -o Rglpk.dll tmp.def Rglpk_initialize.o Rglpk_read_file.o Rglpk_solve.o GLPK/libglpk.a -Ld:/RCompile/CRANpkg/extralibs64/local/lib/i386 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/PROGRA~1/R/R-30~1.2/bin/i386 -lR
c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/bin/ld.exe: i386:x86-64 architecture of input file `GLPK/libglpk.a(glpmpl04.o)' is incompatible with i386 output
c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/bin/ld.exe: i386:x86-64 architecture of input file `GLPK/libglpk.a(error.o)' is incompatible with i386 output
c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/bin/ld.exe: i386:x86-64 architecture of input file `GLPK/libglpk.a(glpmpl03.o)' is incompatible with i386 output
c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/bin/ld.exe: i386:x86-64 architecture of input file `GLPK/libglpk.a(alloc.o)' is incompatible with i386 output
c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/bin/ld.exe: i386:x86-64 architecture of input file `GLPK/libglpk.a(glpenv07.o)' is incompatible with i386 output
c:/rtools/gcc-4.6.3/bin/../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/bin/ld.exe: 
.....
Error: 64-bit reloc in dll
Error: 64-bit reloc in dll
Error: 64-bit reloc in dll
.....
Rglpk_initialize.o:Rglpk_initialize.c:(.text+0x33): undefined reference to `glp_term_hook'
Rglpk_initialize.o:Rglpk_initialize.c:(.text+0x44): undefined reference to `glp_version'
Rglpk_read_file.o:Rglpk_read_file.c:(.text+0x10): undefined reference to `glp_delete_prob'
Rglpk_read_file.o:Rglpk_read_file.c:(.text+0x4f): undefined reference to `glp_term_out'
Rglpk_read_file.o:Rglpk_read_file.c:(.text+0x60): undefined reference to `glp_delete_prob'
Rglpk_read_file.o:Rglpk_read_file.c:(.text+0x65): undefined reference to `glp_create_prob'
.....
GLPK/libglpk.a(glpmpl03.o):glpmpl03.c:(.text+0x4326): undefined reference to `strcpy'
GLPK/libglpk.a(glpmpl03.o):glpmpl03.c:(.text+0x4d39): undefined reference to `strcpy'
GLPK/libglpk.a(glpmpl03.o):glpmpl03.c:(.text+0x4dc5): undefined reference to `strcpy'
GLPK/libglpk.a(glpmpl03.o):glpmpl03.c:(.text+0x4e05): undefined reference to `floor'
GLPK/libglpk.a(glpmpl03.o):glpmpl03.c:(.text+0x4e16): undefined reference to `floor'
GLPK/libglpk.a(glpmpl03.o):glpmpl03.c:(.text+0x502e): undefined reference to `floor'
GLPK/libglpk.a(glpmpl03.o):glpmpl03.c:(.text+0x50e2): undefined reference to `sprintf'
GLPK/libglpk.a(glpmpl03.o):glpmpl03.c:(.text+0x5111): undefined reference to `sprintf'
.....
GLPK/libglpk.a(glpmpl03.o):glpmpl03.c:(.text+0x990): undefined reference to `exp'
GLPK/libglpk.a(glpmpl03.o):glpmpl03.c:(.text+0x9e0): undefined reference to `log'
GLPK/libglpk.a(glpmpl03.o):glpmpl03.c:(.text+0xa30): undefined reference to `log10'
GLPK/libglpk.a(glpmpl03.o):glpmpl03.c:(.text+0xaee): undefined reference to `sin'
GLPK/libglpk.a(glpmpl03.o):glpmpl03.c:(.text+0xb4e): undefined reference to `cos'
GLPK/libglpk.a(glpmpl03.o):glpmpl03.c:(.text+0xb65): undefined reference to `atan'
GLPK/libglpk.a(glpmpl03.o):glpmpl03.c:(.text+0xb79): undefined reference to `atan2'
.....
GLPK/libglpk.a(deflate.o):deflate.c:(.text+0x2ec0): undefined reference to `memcpy'
GLPK/libglpk.a(deflate.o):deflate.c:(.text+0x2ed5): undefined reference to `memcpy'
GLPK/libglpk.a(deflate.o):deflate.c:(.text+0x2ee7): undefined reference to `memcpy'
GLPK/libglpk.a(zutil.o):zutil.c:(.text+0x47): undefined reference to `malloc'
GLPK/libglpk.a(zutil.o):zutil.c:(.text+0x54): undefined reference to `free'
collect2: ld returned 1 exit status
ERROR: compilation failed for package 'Rglpk'