I am trying to build 'lcms2' static library which is dependent on libtiff. libtiff has again dependency on libjbig. I have successfully configured libtest with the following parameters:
CFLAGS="-fPIC" CXXFLAGS="-fPIC" LIBS="-ljbig" ./configure --prefix=/usr/local --enable-static=yes --enable-shared=no --with-zlib=yes --with-jpeg=yes --with-tiff=yes --with-pic=PIC
The configure reports no error:
checking for TIFF support ...
checking tiff.h usability... yes
checking tiff.h presence... yes
checking for tiff.h... yes
checking tiffio.h usability... yes
checking tiffio.h presence... yes
checking for tiffio.h... yes
checking for TIFFOpen in -ltiff... yes
checking for TIFFClientOpen in -ltiff... yes
checking for TIFFIsByteSwapped in -ltiff... yes
checking if TIFF package is complete... yes
checking tiffconf.h usability... yes
checking tiffconf.h presence... yes
checking for tiffconf.h... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating lcms2.pc
config.status: creating include/Makefile
config.status: creating src/Makefile
config.status: creating utils/tificc/Makefile
config.status: creating utils/transicc/Makefile
config.status: creating utils/linkicc/Makefile
config.status: creating utils/jpgicc/Makefile
config.status: creating utils/psicc/Makefile
config.status: creating testbed/Makefile
config.status: executing depfiles commands
config.status: executing libtool commands
The when I make the library it throws the following error:
/bin/sh ../../libtool --tag=CC --mode=link gcc -std=gnu99 -fPIC -o tificc tificc.o xgetopt.o vprf.o ../../src/liblcms2.la -ltiff -ljpeg -lz -lm
libtool: link: gcc -std=gnu99 -fPIC -o tificc tificc.o xgetopt.o vprf.o ../../src/.libs/liblcms2.a -ltiff -ljpeg -lz -lm
/usr/local/lib/libtiff.a(tif_jbig.o): In function `JBIGDecode':
tif_jbig.c:(.text+0xc4): undefined reference to `jbg_dec_init'
tif_jbig.c:(.text+0xe4): undefined reference to `jbg_newlen'
tif_jbig.c:(.text+0x116): undefined reference to `jbg_dec_in'
tif_jbig.c:(.text+0x12a): undefined reference to `jbg_strerror'
tif_jbig.c:(.text+0x177): undefined reference to `jbg_dec_getimage'
tif_jbig.c:(.text+0x188): undefined reference to `jbg_dec_getsize'
tif_jbig.c:(.text+0x1ac): undefined reference to `jbg_dec_free'
/usr/local/lib/libtiff.a(tif_jbig.o): In function `JBIGEncode':
tif_jbig.c:(.text+0x402): undefined reference to `jbg_enc_init'
tif_jbig.c:(.text+0x40d): undefined reference to `jbg_enc_out'
tif_jbig.c:(.text+0x418): undefined reference to `jbg_enc_free'
collect2: ld returned 1 exit status
make[1]: *** [tificc] Error 1
libtool: link: gcc -std=gnu99 -fPIC -o tificc tificc.o xgetopt.o vprf.o ../../src/.libs/liblcms2.a -ltiff -ljpeg -lz -lm
There is no reference to JBIG library in the linking command (I don't remember if it should go before or after - some libraries require both - the reference to libtiff, -ltiff), so jbg_* references can't be resolved. Having LCMS linked does not help you, since JBIG is not linked in, but only referred to, by JBIG.
Add -ljbig to the link command.
Or, manually edit the Makefile and add -ljbig to LIBS (eg. LIBS = -ljbig).
Related
I want to compile the units package in Renjin, which currently does not work in the online repository, see http://packages.renjin.org/package/org.renjin.cran/units/0.6-3/build/5
I created a pom.xml for the current release of udunits, see https://github.com/nuest/renjin-docker/blob/master/geospatial-packages/units/pom.xml
I built a Dockerfile for compiling packages and having the required compilers, see https://github.com/nuest/renjin-docker/blob/master/0.9.2726/Dockerfile.builder
Within a container created from an image built from that Dockerfile, I can run library('org.renjin.cran:Rcpp') in an R session, but when I run mvn clean install on units I get the following error:
[...]
Downloaded: https://nexus.bedatadriven.com/content/groups/public/org/sonatype/aether/aether-impl/1.13.1/aether-impl-1.13.1.jar (128 KB at 7.4 KB/sec)
EXECUTING: -print-file-name=plugin
EXECUTING: -shared -xc++ -I/usr/lib/gcc/x86_64-linux-gnu/4.7/plugin/include -fPIC -fno-rtti -O2 plugin.c -lstdc++ -shared-libgcc -o /packages/units/units/target/bridge.so
configure: units: 0.6-4
Warning: unsupported configuration variable CFLAGS
Warning: unsupported configuration variable CPPFLAGS
Warning: unsupported configuration variable LDFLAGS
Warning: unsupported configuration variable CXXFLAGS
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++-4.7 accepts -g... yes
checking how to run the C++ preprocessor... g++-4.7 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... no
checking for error_at_line... yes
checking for gcc... gcc-4.7
checking whether we are using the GNU C compiler... yes
checking whether gcc-4.7 accepts -g... yes
checking for gcc-4.7 option to accept ISO C89... none needed
checking for XML_ParserCreate in -lexpat... no
checking udunits2.h usability... yes
checking udunits2.h presence... yes
checking for udunits2.h... yes
checking for ut_read_xml in -ludunits2... yes
configure: creating ./config.status
config.status: creating src/Makevars
Checking wether in Makevars CXX_STD is set to CXX11... no
g++-4.7 -I/packages/units/units/target/gnur/include -DNDEBUG -DUDUNITS2_DIR=0 -I"/packages/units/units/target/include" -fpic -m32 -fplugin=/packages/units/units/target/bridge.so -DRENJIN -fno-inline-functions -fdisable-tree-einline -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c udunits.cpp -o udunits.o
cc1plus: note: disable pass tree-einline for functions in the range of [0, 4294967295]
udunits.cpp:11:18: fatal error: Rcpp.h: No such file or directory
compilation terminated.
/packages/units/units/target/gnur/etc/Makeconf:202: recipe for target 'udunits.o' failed
make: *** [udunits.o] Error 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:20 min
[INFO] Finished at: 2019-11-15T15:27:52+00:00
[INFO] Final Memory: 17M/445M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.renjin:renjin-maven-plugin:0.9.2726:gnur-compile (gnur-compile) on project units: Compilation of GNU R sources failed: Failed to execute Makefile -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
root#987c61d45fbf:/packages/units/units# exit
Anyone an idea how to tell Renjin where to find Rcpp.h ?
More details on the resources I consulted are in this GitHub issue: https://github.com/nuest/renjin-docker/issues/4
If you're using Maven to build the package, you also need to add Rcpp headers as a dependency:
<dependency>
<groupId>org.renjin.cran</groupId>
<artifactId>Rcpp</artifactId>
<version>0.12.13-renjin-15</version>
<classifier>headers</classifier>
<scope>provided</scope>
</dependency>
You can use the pom file for plyr as an example.
Note that if you just want to build a package for use with Renjin, the command line tool is far simpler:
renjin build units
This will take care of downloading the required dependencies and producing a jar file.
Do note that Renjin does not support packages which depend on external native libraries. You can see from the automated build logs that the units package will fail because of a dependency on udunits2.
That is the reason that the units packages is labeled as incompatible in our package site.
This question already has answers here:
Cannot compile R packages with c++ code after updating to macOS Catalina
(2 answers)
Closed 3 years ago.
I followed the steps in R Compiler Tools for Rcpp on macOS (for R 3.6.x), but an error occurs when I try to install RcppArmadillo. I don't have Xcode.app install, and prefer to use the command line tools instead.
The answers posted here didn't help :(
* installing *source* package ‘RcppArmadillo’ ...
** package ‘RcppArmadillo’ successfully unpacked and MD5 sums checked
** using staged installation
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether clang++ -std=gnu++11 accepts -g... yes
checking how to run the C++ preprocessor... clang++ -std=gnu++11 -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether clang++ -std=gnu++11 accepts -g... (cached) yes
checking whether g++ version is sufficient... almost
configure: WARNING: Compiler self-identifies as being compliant with GNUC extensions but is not g++.
checking for macOS... found
checking for macOS Apple compiler... not found
checking for clang compiler... found
checking for OpenMP compatible version of clang... found and suitable
checking LAPACK_LIBS... system LAPACK found
checking for OpenMP... missing
configure: creating ./config.status
config.status: creating inst/include/RcppArmadilloConfigGenerated.h
config.status: creating src/Makevars
** libs
clang++ -std=gnu++11 -I"/usr/local/Cellar/r/3.6.1_1/lib/R/include" -DNDEBUG -I"/usr/local/lib/R/3.6/site-library/Rcpp/include" -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -I../inst/include -fPIC -g -O2 -c RcppArmadillo.cpp -o RcppArmadillo.o
In file included from RcppArmadillo.cpp:22:
In file included from ../inst/include/RcppArmadillo.h:31:
In file included from ../inst/include/RcppArmadilloForward.h:26:
In file included from /usr/local/lib/R/3.6/site-library/Rcpp/include/RcppCommon.h:29:
In file included from /usr/local/lib/R/3.6/site-library/Rcpp/include/Rcpp/r/headers.h:59:
In file included from /usr/local/lib/R/3.6/site-library/Rcpp/include/Rcpp/platform/compiler.h:100:
In file included from /usr/local/clang7/include/c++/v1/cmath:305:
/usr/local/clang7/include/c++/v1/math.h:301:15: fatal error: 'math.h' file not found
#include_next <math.h>
^~~~~~~~
1 error generated.
make: *** [RcppArmadillo.o] Error 1
ERROR: compilation failed for package ‘RcppArmadillo’
* removing ‘/usr/local/lib/R/3.6/site-library/RcppArmadillo’
* restoring previous ‘/usr/local/lib/R/3.6/site-library/RcppArmadillo’
The downloaded source packages are in
‘/private/var/folders/ny/f06ns0d568bgf6s559z8j_9m0000gn/T/Rtmp0t1pHj/downloaded_packages’
Warning message:
In install.packages("RcppArmadillo") :
installation of package ‘RcppArmadillo’ had non-zero exit status
A side note mentioned in this answer saved me. The trick is to add the following line to $(R RHOME)/etc/Makeconf
CPPFLAGS = -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include
I am trying to install RQuantLib on a Mac OSX 10.13. I have the latest version of R: Version 3.4.3.
I have done the following pre requisites using homebrew
brew install boost
brew install quantlib
However, when I try
install.packages("RQuantLib", configure.args="--with-boost include=/usr/local/include/ --with-boost-lib=/usr/local/lib/")
R returns
* installing *source* package ‘RQuantLib’ ...
** package ‘RQuantLib’ successfully unpacked and MD5 sums checked
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking for R... yes
checking for quantlib-config... yes
checking for Boost development files... yes
checking for minimal Boost version... yes
configure: creating ./config.status
config.status: creating src/Makevars
Completed configuration and ready to build.
** libs
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I"/Users/rorymcstay/Library/R/3.4/library/Rcpp/include" -
I/usr/local/include -Wall -g -O2 -
I/usr/local/Cellar/quantlib/1.12/include -I/usr/local/include/ -
I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fPIC -
Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
clang: error: unsupported option '-fopenmp'
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘RQuantLib’
* removing ‘/Users/rorymcstay/Library/R/3.4/library/RQuantLib’
Warning in install.packages :
installation of package ‘RQuantLib’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/mf/7p4rjjq53zg5_3bdqznb9p2h0000gn/T/RtmpsowkET/do wnloaded_packages’
Can anyone see what is going wrong?
Thanks
Rory
I have been trying to build the api in (windows 7 64bit) with msys2 using x86_64-w64-mingw32 but i keep geting errors
note that this errors wont happen when i use 32bit nmake but i need to build it in 64bit using msys2 and x86_64-w64-mingw32
Please help me fix my errors.
This log is from the build:
$ ./configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32
checking for x86_64-w64-mingw32-gcc... x86_64-w64-mingw32-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-w64-mingw32-gcc accepts -g... yes
checking for x86_64-w64-mingw32-gcc option to accept ISO C89... none needed
checking whether x86_64-w64-mingw32-gcc understands -c and -o together... yes
checking how to run the C preprocessor... x86_64-w64-mingw32-gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
/bin/sh: /home/Me/missing: No such file or directory
configure: WARNING: 'missing' script is too old or missing
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for style of include used by make... GNU
checking whether make supports nested variables... yes
checking dependency style of x86_64-w64-mingw32-gcc... gcc3
checking for x86_64-w64-mingw32-gcc... (cached) x86_64-w64-mingw32-gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether x86_64-w64-mingw32-gcc accepts -g... (cached) yes
checking for x86_64-w64-mingw32-gcc option to accept ISO C89... (cached) none needed
checking whether x86_64-w64-mingw32-gcc understands -c and -o together... (cached) yes
checking build system type... x86_64-w64-mingw32
checking host system type... x86_64-w64-mingw32
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by x86_64-w64-mingw32-gcc... c:/msys64/opt/windows_64/x86_64-w64-mingw32/bin/ld.exe
checking if the linker (c:/msys64/opt/windows_64/x86_64-w64-mingw32/bin/ld.exe) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /opt/windows_64/bin/nm -B
checking the name lister (/opt/windows_64/bin/nm -B) interface... BSD nm
checking whether ln -s works... no, using cp -pR
checking the maximum length of command line arguments... 8192
checking how to convert x86_64-w64-mingw32 file names to x86_64-w64-mingw32 format... func_convert_file_msys_to_w32
checking how to convert x86_64-w64-mingw32 file names to toolchain format... func_convert_file_msys_to_w32
checking for c:/msys64/opt/windows_64/x86_64-w64-mingw32/bin/ld.exe option to reload object files... -r
checking for x86_64-w64-mingw32-objdump... no
checking for objdump... objdump
checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL
checking for x86_64-w64-mingw32-dlltool... no
checking for dlltool... dlltool
checking how to associate runtime and link libraries... func_cygming_dll_for_implib
checking for x86_64-w64-mingw32-ar... no
checking for ar... ar
checking for archiver #FILE support... #
checking for x86_64-w64-mingw32-strip... no
checking for strip... strip
checking for x86_64-w64-mingw32-ranlib... no
checking for ranlib... ranlib
checking command to parse /opt/windows_64/bin/nm -B output from x86_64-w64-mingw32-gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for x86_64-w64-mingw32-mt... no
checking for mt... no
checking if : is a manifest tool... no
checking for dlfcn.h... no
checking for objdir... .libs
checking if x86_64-w64-mingw32-gcc supports -fno-rtti -fno-exceptions... no
checking for x86_64-w64-mingw32-gcc option to produce PIC... -DDLL_EXPORT -DPIC
checking if x86_64-w64-mingw32-gcc PIC flag -DDLL_EXPORT -DPIC works... yes
checking if x86_64-w64-mingw32-gcc static flag -static works... yes
checking if x86_64-w64-mingw32-gcc supports -c -o file.o... yes
checking if x86_64-w64-mingw32-gcc supports -c -o file.o... (cached) yes
checking whether the x86_64-w64-mingw32-gcc linker (c:/msys64/opt/windows_64/x86_64-w64-mingw32/bin/ld.exe) supports shared libraries... yes
checking whether -lc should be explicitly linked in... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for byte... no
checking for ushort... no
checking for ulong... no
checking for u16... no
checking for u32... no
checking for off_t... yes
checking for size_t... yes
checking for ssize_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking whether byte ordering is bigendian... no
checking for getopt... yes
checking for gettimeofday... yes
checking for pread... no
checking for vasprintf... yes
checking for vsnprintf... yes
checking for vsprintf... yes
checking for gethostbyname... no
checking for gethostbyname in -lnsl... no
checking for gethostbyname_r... no
checking for memset... yes
checking for memchr... yes
checking for munmap... no
checking for strrchr... yes
checking for socket... no
checking for strchr... yes
checking for strdup... yes
checking for strstr... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible realloc... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... yes
checking for getpagesize... yes
checking for working mmap... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating GeoIP.spec
config.status: creating geoip.pc
config.status: creating libGeoIP/Makefile
config.status: creating apps/Makefile
config.status: creating man/Makefile
config.status: creating test/Makefile
config.status: executing depfiles commands
config.status: executing libtool commands
$ make -i
Making all in libGeoIP
make[1]: Entering directory '/home/Me/src/geoip-api-c-1.6.3/libGeoIP'
/bin/sh ../libtool --tag=CC --mode=link x86_64-w64-mingw32-gcc -g -O2 -no-undefined -version-info 7:3:6 -o libGeoIP.la -rpath /usr/local/lib GeoIP.lo GeoIP_deprecated.lo GeoIPCity.lo regionName.lo timeZone.lo
libtool: link: rm -fr .libs/libGeoIP.dll.a
libtool: link: x86_64-w64-mingw32-gcc -shared .libs/GeoIP.o .libs/GeoIP_deprecated.o .libs/GeoIPCity.o .libs/regionName.o .libs/timeZone.o -g -O2 -o .libs/libGeoIP-1.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libGeoIP.dll.a
.libs/GeoIP.o: In function `_check_mtime':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:1134: undefined reference to `pread'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:1172: undefined reference to `pread'
.libs/GeoIP.o: In function `_GeoIP_inet_ntop':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:590: undefined reference to `__imp_getnameinfo'
.libs/GeoIP.o: In function `_GeoIP_seek_record_v6_gl':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:1209: undefined reference to `pread'
.libs/GeoIP.o: In function `get_db_description':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:564: undefined reference to `__imp_GeoIPDBDescription'
.libs/GeoIP.o: In function `_get_name_v6_gl':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:2357: undefined reference to `pread'
.libs/GeoIP.o: In function `_GeoIP_inet_pton':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:606: undefined reference to `__imp_getaddrinfo'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:617: undefined reference to `__imp_freeaddrinfo'
.libs/GeoIP.o: In function `_GeoIP_seek_record_gl':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:1299: undefined reference to `pread'
.libs/GeoIP.o: In function `get_db_description':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:564: undefined reference to `__imp_GeoIPDBDescription'
.libs/GeoIP.o: In function `_get_name_gl':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:2298: undefined reference to `pread'
.libs/GeoIP.o: In function `GeoIP_open':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:1494: undefined reference to `pread'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:1547: undefined reference to `pread'
.libs/GeoIP.o: In function `_GeoIP_lookupaddress':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:1644: undefined reference to `__imp_inet_addr'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:1692: undefined reference to `__imp_ntohl'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:1677: undefined reference to `__imp_gethostbyname'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:1692: undefined reference to `__imp_ntohl'
.libs/GeoIP.o: In function `_GeoIP_lookupaddress_v6':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:1707: undefined reference to `__imp_getaddrinfo'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:1714: undefined reference to `__imp_freeaddrinfo'
.libs/GeoIP.o: In function `get_db_description':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:564: undefined reference to `__imp_GeoIPDBDescription'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:564: undefined reference to `__imp_GeoIPDBDescription'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:564: undefined reference to `__imp_GeoIPDBDescription'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:564: undefined reference to `__imp_GeoIPDBDescription'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:564: undefined reference to `__imp_GeoIPDBDescription'
.libs/GeoIP.o:C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:564: more undefined references to `__imp_GeoIPDBDescription' follow
.libs/GeoIP.o: In function `GeoIP_assign_region_by_inetaddr_gl':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:2030: undefined reference to `__imp_ntohl'
.libs/GeoIP.o: In function `_get_region_gl':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:2132: undefined reference to `__imp_htonl'
.libs/GeoIP.o: In function `get_db_description':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:564: undefined reference to `__imp_GeoIPDBDescription'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:564: undefined reference to `__imp_GeoIPDBDescription'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:564: undefined reference to `__imp_GeoIPDBDescription'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:564: undefined reference to `__imp_GeoIPDBDescription'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:564: undefined reference to `__imp_GeoIPDBDescription'
.libs/GeoIP.o:C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIP.c:564: more undefined references to `__imp_GeoIPDBDescription' follow
.libs/GeoIPCity.o: In function `_extract_record':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIPCity.c:97: undefined reference to `__imp_GeoIP_country_continent'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIPCity.c:98: undefined reference to `__imp_GeoIP_country_code'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIPCity.c:99: undefined reference to `__imp_GeoIP_country_code3'
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIPCity.c:83: undefined reference to `pread'
.libs/GeoIPCity.o: In function `_get_record_gl':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIPCity.c:187: undefined reference to `__imp_GeoIPDBDescription'
.libs/GeoIPCity.o: In function `_get_record_v6_gl':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIPCity.c:217: undefined reference to `__imp_GeoIPDBDescription'
.libs/GeoIPCity.o: In function `GeoIP_record_id_by_addr':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIPCity.c:302: undefined reference to `__imp_GeoIPDBDescription'
.libs/GeoIPCity.o: In function `GeoIP_record_id_by_addr_v6':
C:\msys64\home\Me\src\geoip-api-c-1.6.3\libGeoIP/GeoIPCity.c:320: undefined reference to `__imp_GeoIPDBDescription'
collect2.exe: error: ld returned 1 exit status
Makefile:387: recipe for target 'libGeoIP.la' failed
make[1]: [libGeoIP.la] Error 1 (ignored)
make[1]: Leaving directory '/home/Me/src/geoip-api-c-1.6.3/libGeoIP'
Making all in apps
make[1]: Entering directory '/home/Me/src/geoip-api-c-1.6.3/apps'
x86_64-w64-mingw32-gcc -DPACKAGE_NAME=\"GeoIP\" -DPACKAGE_TARNAME=\"GeoIP\" -DPACKAGE_VERSION=\"1.6.3\" -DPACKAGE_STRING=\"GeoIP\ 1.6.3\" -DPACKAGE_BUGREPORT=\"support#maxmind.com\" -DPACKAGE_URL=\"\" -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 -D__EXTENSIONS__=1 -D_ALL_SOURCE=1 -D_GNU_SOURCE=1 -D_POSIX_PTHREAD_SEMANTICS=1 -D_TANDEM_SOURCE=1 -DPACKAGE=\"GeoIP\" -DVERSION=\"1.6.3\" -DLT_OBJDIR=\".libs/\" -DLITTLE_ENDIAN_HOST=1 -DHAVE_GETOPT=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_VASPRINTF=1 -DHAVE_VSNPRINTF=1 -DHAVE_VSPRINTF=1 -DHAVE_MEMSET=1 -DHAVE_MEMCHR=1 -DHAVE_STRRCHR=1 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_STRSTR=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_STDLIB_H=1 -DHAVE_REALLOC=1 -DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_SYS_PARAM_H=1 -DHAVE_GETPAGESIZE=1 -I. -I../libGeoIP -DSYSCONFDIR=\"/usr/local/etc\" -Wall -g -O2 -MT geoiplookup.o -MD -MP -MF .deps/geoiplookup.Tpo -c -o geoiplookup.o geoiplookup.c
mv -f .deps/geoiplookup.Tpo .deps/geoiplookup.Po
make[1]: *** No rule to make target '../libGeoIP/libGeoIP.la', needed by 'geoiplookup.exe'. Stop.
make[1]: Leaving directory '/home/Me/src/geoip-api-c-1.6.3/apps'
Makefile:429: recipe for target 'all-recursive' failed
make: [all-recursive] Error 1 (ignored)
And this log is from patching:
$ patch -F0 -i ~/src/geoip-api-c-1.6.3/GeoIPWinDLL.patch -p0
patching file GeoIP.c
Hunk #1 FAILED at 23.
Hunk #2 FAILED at 57.
Hunk #3 FAILED at 67.
Hunk #4 FAILED at 96.
4 out of 4 hunks FAILED -- saving rejects to file GeoIP.c.rej
patching file GeoIP.h
patch: **** malformed patch at line 183:
With the help of few ppl (adrien, alexey, LRN) in irc://irc.oftc.net/#mingw-w64 i managed to fix the problems
And also i noticed that the patching wasn't needed
So here i am going say what you got to do so you can build it in msys2 using x86_64-w64-mingw32
Edit geoip-api-c-1.6.3/Makefile.am and add ACLOCAL_AMFLAGS = -I m4
Edit geoip-api-c-1.6.3/configure.ac and add AC_CONFIG_MACRO_DIRS([m4])
Edit geoip-api-c-1.6.3/libGeoIP/Makefile.am and add pread.c to libGeoIP_la_SOURCES
Once you added pread.c there you remove it from EXTRA_DIST
Run autoreconf -fiv or ./bootstrap
export "CFLAGS=-O2" export "CPPFLAGS=-DGEOIP_EXPORTS" export "LIBS=-lwsock32 -lws2_32"
or you can try export "CFLAGS=-DGEOIP_EXPORTS -O3 -I/usr/local/include" export "LDFLAGS=-L/usr/local/lib -lwsock32 -lws2_32"
./configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 && make
With that i managed to build it just fine :)
I'm trying to install RMySQL in Ubuntu 13.04 when using MySQL v5.6.14. Ubuntu does not have apt-get support for MySQL 5.6.14, so I had to install it manually. Now when I try to install RMySQL I get the following:
(It looks like the package files are not created? But I'm not sure why or how to debug it.)
elad#elad-ThinkPad-T430s:~/tmp$ sudo R CMD INSTALL --configure-args='--with-mysql-inc=/opt/mysql/server-5.6/include --with-mysql-lib=/opt/mysql/server-5.6/lib' RMySQL_0.9-3.tar.gz
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘RMySQL’ ...
** package ‘RMySQL’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for compress in -lz... yes
checking for getopt_long in -lc... yes
checking for mysql_init in -lmysqlclient... no
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking mysql.h usability... no
checking mysql.h presence... no
checking for mysql.h... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/opt/mysql/server-5.6/include -fpic -O2 -pipe -g -c RS-DBI.c -o RS-DBI.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/opt/mysql/server-5.6/include -fpic -O2 -pipe -g -c RS-MySQL.c -o RS-MySQL.o
gcc -std=gnu99 -shared -o RMySQL.so RS-DBI.o RS-MySQL.o -L/opt/mysql/server-5.6/lib -lmysqlclient -lz -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/RMySQL/libs
** R
** inst
** preparing package for lazy loading
Creating a generic function for ‘format’ from package ‘base’ in package ‘RMySQL’
Creating a generic function for ‘print’ from package ‘base’ in package ‘RMySQL’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error : .onLoad failed in loadNamespace() for 'RMySQL', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/usr/local/lib/R/site-library/RMySQL/libs/RMySQL.so':
libmysqlclient.so.18: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/site-library/RMySQL’
* restoring previous ‘/usr/local/lib/R/site-library/RMySQL’
Update:
This ended up being a LD_LIBRARY_PATH issue. Adding the following to /usr/bin/R solved it:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH/opt/mysql/server-5.6/lib
export LD_LIBRARY_PATH
Did you run ldconfig after installing the library locally?
Does ldconfig -p return something regarding mysql?
On my box, with default MySQL libraries from Ubuntu [lines wrapped by hand]
edd#max:~$ ldconfig -p | grep mysql
libmysqlclient.so.18 (libc6,x86-64) => \
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
libmysqlclient.so (libc6,x86-64) => \
/usr/lib/x86_64-linux-gnu/libmysqlclient.so
edd#max:~$