Ironholds / poster

Address parsing and normalisation through libpostal
MIT License
59 stars 9 forks source link

Windows build #12

Open AeroXuk opened 6 years ago

AeroXuk commented 6 years ago

I have successfully compiled this on windows using MSys2/MingW64 using the following commands:

git clone https://github.com/Ironholds/poster.git
cd poster

Manually edit DESCRIPTION to remove the OS_type: unix line. And extract the prebuilt libpostal for windows zip, moving libpostal.h into a libpostal folder.

cd src
g++ -m64 -I/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/include/ -DNDEBUG -I/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/library/Rcpp/include/ -I. -I.. -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o
gcc -m64 -I/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/include/ -DNDEBUG -I/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/library/Rcpp/include/ -I. -I.. -O2 -Wall -std=gnu99 -mtune=core2 -c init.c -o init.o
g++ -m64 -I/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/include/ -DNDEBUG -I/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/library/Rcpp/include/ -I. -I.. -O2 -Wall -mtune=core2 -c postal.cpp -o postal.o
g++ -m64 -I/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/include/ -DNDEBUG -I/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/library/Rcpp/include/ -I. -I.. -O2 -Wall -mtune=core2 -c poster.cpp -o poster.o
g++ -m64 -shared -s -o poster.dll RcppExports.o init.o postal.o poster.o -Wl,-Bstatic  -static-libgcc -static-libstdc++ -lstdc++ -lpthread -Wl,-Bdynamic -LC:/PROGRA~1/MICROS~2/ROPEN~1/R-34~1.2/bin/x64/ -lR -lpostal
cd ..
/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/bin/R.exe CMD INSTALL --build . --config-vars='INCLUDE_DIR=. LIB_DIR=.'

I'm not sure how to update the configure scripts for R to make this a Pull request so I'll just leave the issue here for someone else to have a go at implementing.

Prebuild libpostal for windows downloads (From openvenues/libpostal AppVeyor CI):

Here is the built package: poster_0.3.0.zip

crazybilly commented 6 years ago

Does libpostal.h need to go in a folder inside the postal project folder or so where in R's directory tree?

AeroXuk commented 6 years ago

Within the postal project folder from memory

dgenio commented 5 years ago

I have successfully compiled this on windows using MSys2/MingW64 using the following commands:

git clone https://github.com/Ironholds/poster.git
cd poster

Manually edit DESCRIPTION to remove the OS_type: unix line. And extract the prebuilt libpostal for windows zip, moving libpostal.h into a libpostal folder.

cd src
g++ -m64 -I/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/include/ -DNDEBUG -I/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/library/Rcpp/include/ -I. -I.. -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o
gcc -m64 -I/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/include/ -DNDEBUG -I/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/library/Rcpp/include/ -I. -I.. -O2 -Wall -std=gnu99 -mtune=core2 -c init.c -o init.o
g++ -m64 -I/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/include/ -DNDEBUG -I/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/library/Rcpp/include/ -I. -I.. -O2 -Wall -mtune=core2 -c postal.cpp -o postal.o
g++ -m64 -I/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/include/ -DNDEBUG -I/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/library/Rcpp/include/ -I. -I.. -O2 -Wall -mtune=core2 -c poster.cpp -o poster.o
g++ -m64 -shared -s -o poster.dll RcppExports.o init.o postal.o poster.o -Wl,-Bstatic  -static-libgcc -static-libstdc++ -lstdc++ -lpthread -Wl,-Bdynamic -LC:/PROGRA~1/MICROS~2/ROPEN~1/R-34~1.2/bin/x64/ -lR -lpostal
cd ..
/c/Program\ Files/Microsoft/R\ Open/R-3.4.2/bin/R.exe CMD INSTALL --build . --config-vars='INCLUDE_DIR=. LIB_DIR=.'

I'm not sure how to update the configure scripts for R to make this a Pull request so I'll just leave the issue here for someone else to have a go at implementing.

Prebuild libpostal for windows downloads (From openvenues/libpostal AppVeyor CI):

* [x86 / 32-bit version](https://goo.gl/Bf3EzE)

* [x64 / 64-bit version](https://goo.gl/o8DAi8)

Here is the built package: poster_0.3.0.zip

How can I do this?

mkuehn10 commented 5 years ago

Not sure what I'm doing wrong, but I have installed libpostal in c/libpostal, but when I try to build the poster package from source I keep getting this error:

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: init.o:init.c:(.rdata+0x88): undefined reference to `_poster_end()'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: init.o:init.c:(.rdata+0xa0): undefined reference to `_poster_get_elements_(SEXPREC*, SEXPREC*)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: init.o:init.c:(.rdata+0xb8): undefined reference to `_poster_normalise_addr(SEXPREC*)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: init.o:init.c:(.rdata+0xd0): undefined reference to `_poster_parse_addr(SEXPREC*)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: init.o:init.c:(.rdata+0xe8): undefined reference to `_poster_set_elements_(SEXPREC*, SEXPREC*, SEXPREC*)'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: init.o:init.c:(.rdata+0x100): undefined reference to `_poster_setup()'
collect2.exe: error: ld returned 1 exit status