Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows build using MSYS #8

Closed
legrandlegrand opened this issue Dec 14, 2017 · 4 comments
Closed

windows build using MSYS #8

legrandlegrand opened this issue Dec 14, 2017 · 4 comments

Comments

@legrandlegrand
Copy link

Hi,
I would like to use this extension on windows 7 64
I'm able to build postgres from tarball using doc :
https://wiki.postgresql.org/wiki/Building_With_MinGW#Build_from_a_tarball

But I get errrors when trying to build pg_hint_plan with

me@mycomputer MSYS ~/postgresql-11devel/contrib/pg_hint_plan
$ make
x86_64-w64-mingw32-gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -I. -I. -I../../src/include -I./src/include/port/win32 -DEXEC_BACKEND "-I../../src/include/port/win32" -c -o pg_hint_plan.o pg_hint_plan.c
windres -i win32ver.rc -o win32ver.o --include-dir=../../src/include --include-dir=.
x86_64-w64-mingw32-gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -shared -static-libgcc -o pg_hint_plan.dll pg_hint_plan.o win32ver.o -L../../src/port -L../../src/common -Wl,--allow-multiple-definition -Wl,--disable-auto-import -Wl,--as-needed -lm -L../../src/backend -lpostgres -lpgcommon -lpgport -lz -lws2_32 -lm -lws2_32 -Wl,--export-all-symbols -Wl,--out-implib=libpg_hint_plan.a
pg_hint_plan.o:pg_hint_plan.c:(.rdata$.refptr.geqo_threshold[.refptr.geqo_threshold]+0x0): undefined reference to geqo_threshold' pg_hint_plan.o:pg_hint_plan.c:(.rdata$.refptr.enable_geqo[.refptr.enable_geqo]+0x0): undefined reference to enable_geqo'
pg_hint_plan.o:pg_hint_plan.c:(.rdata$.refptr.max_parallel_workers_per_gather[.refptr.max_parallel_workers_per_gather]+0x0): undefined reference to max_parallel_workers_per_gather' pg_hint_plan.o:pg_hint_plan.c:(.rdata$.refptr.min_parallel_index_scan_size[.refptr.min_parallel_index_scan_size]+0x0): undefined reference to min_parallel_index_scan_size'
pg_hint_plan.o:pg_hint_plan.c:(.rdata$.refptr.min_parallel_table_scan_size[.refptr.min_parallel_table_scan_size]+0x0): undefined reference to min_parallel_table_scan_size' pg_hint_plan.o:pg_hint_plan.c:(.rdata$.refptr.enable_hashjoin[.refptr.enable_hashjoin]+0x0): undefined reference to enable_hashjoin'
pg_hint_plan.o:pg_hint_plan.c:(.rdata$.refptr.enable_mergejoin[.refptr.enable_mergejoin]+0x0): undefined reference to enable_mergejoin' pg_hint_plan.o:pg_hint_plan.c:(.rdata$.refptr.enable_nestloop[.refptr.enable_nestloop]+0x0): undefined reference to enable_nestloop'
pg_hint_plan.o:pg_hint_plan.c:(.rdata$.refptr.enable_indexonlyscan[.refptr.enable_indexonlyscan]+0x0): undefined reference to enable_indexonlyscan' pg_hint_plan.o:pg_hint_plan.c:(.rdata$.refptr.enable_tidscan[.refptr.enable_tidscan]+0x0): undefined reference to enable_tidscan'
pg_hint_plan.o:pg_hint_plan.c:(.rdata$.refptr.enable_bitmapscan[.refptr.enable_bitmapscan]+0x0): undefined reference to enable_bitmapscan' pg_hint_plan.o:pg_hint_plan.c:(.rdata$.refptr.enable_indexscan[.refptr.enable_indexscan]+0x0): undefined reference to enable_indexscan'
pg_hint_plan.o:pg_hint_plan.c:(.rdata$.refptr.enable_seqscan[.refptr.enable_seqscan]+0x0): undefined reference to enable_seqscan' pg_hint_plan.o:pg_hint_plan.c:(.rdata$.refptr.disable_cost[.refptr.disable_cost]+0x0): undefined reference to disable_cost'
pg_hint_plan.o:pg_hint_plan.c:(.rdata$.refptr.max_worker_processes[.refptr.max_worker_processes]+0x0): undefined reference to max_worker_processes' pg_hint_plan.o:pg_hint_plan.c:(.rdata$.refptr.application_name[.refptr.application_name]+0x0): undefined reference to application_name'
collect2.exe: error: ld returned 1 exit status
../../src/Makefile.shlib:372 : la recette pour la cible « pg_hint_plan.dll » a échouée
make: *** [pg_hint_plan.dll] Erreur 1

Any Idea ?
Thanks in advance
Regards
PAscal

@legrandlegrand
Copy link
Author

legrandlegrand commented Dec 16, 2017

it seems that postgres files have to be changed like in
https://github.com/bitnine-oss/agens-sql/blob/master/agens_windows/postgresql-9.4.4_win/src/include/optimizer/paths.h

where
extern bool enable_geqo;
extern int geqo_threshold;

has been modified into
extern PGDLLIMPORT bool enable_geqo;
extern PGDLLIMPORT int geqo_threshold;

to support windows builds

this has to be applyed to
src/include/optimizer/paths.h
geqo_threshold
enable_geqo
min_parallel_index_scan_size
min_parallel_table_scan_size

src/include/optimizer/cost.h
max_parallel_workers_per_gather
enable_hashjoin
enable_mergejoin
enable_nestloop
enable_indexonlyscan
enable_tidscan
enable_bitmapscan
enable_indexscan
enable_seqscan
disable_cost

src/include/utils/guc.h
application_name

src/include/miscadmin.h
max_worker_processes

would it be possible to create a patch for pg core
as done here
https://www.postgresql.org/message-id/CAJCy68fscdNhmzFPS4kyO00CADkvXvEa-28H-OtENk-pa2OTWw%40mail.gmail.com

Regards
PAscal

@legrandlegrand
Copy link
Author

this has been asked to pg commiters
http://www.postgresql-archive.org/Add-PGDLLIMPORT-to-enable-hashagg-td6004487.html

Regards
PAscal

@legrandlegrand
Copy link
Author

legrandlegrand commented Feb 11, 2018

@legrandlegrand
Copy link
Author

Fix also Backported to 10 ans 9.6 releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant