From 77fccb27825a751ac49f54fe6ac6cd31cbc95a71 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 26 Mar 2009 10:38:00 -0500 Subject: [PATCH 1/4] build with -fPIC on linux64 --- vm/Config.linux.x86.64 | 1 + 1 file changed, 1 insertion(+) diff --git a/vm/Config.linux.x86.64 b/vm/Config.linux.x86.64 index bfd1222496..7771ebdbbd 100644 --- a/vm/Config.linux.x86.64 +++ b/vm/Config.linux.x86.64 @@ -1,3 +1,4 @@ include vm/Config.linux include vm/Config.x86.64 LIBPATH = -L/usr/X11R6/lib64 -L/usr/X11R6/lib +CFLAGS = -fPIC From 4e33df153df2c64927dd2404fe2c1812502b8df9 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 26 Mar 2009 10:43:54 -0500 Subject: [PATCH 2/4] add using --- basis/pango/cairo/cairo.factor | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/basis/pango/cairo/cairo.factor b/basis/pango/cairo/cairo.factor index 7683b78890..45b7a9cb31 100644 --- a/basis/pango/cairo/cairo.factor +++ b/basis/pango/cairo/cairo.factor @@ -3,7 +3,8 @@ ! See http://factorcode.org/license.txt for BSD license. ! ! pangocairo bindings, from pango/pangocairo.h -USING: alien alien.syntax combinators system cairo.ffi ; +USING: alien alien.syntax combinators system cairo.ffi +alien.libraries ; IN: pango.cairo << { @@ -85,4 +86,4 @@ FUNCTION: void pango_cairo_layout_path ( cairo_t* cr, PangoLayout* layout ) ; FUNCTION: void -pango_cairo_error_underline_path ( cairo_t* cr, double x, double y, double width, double height ) ; \ No newline at end of file +pango_cairo_error_underline_path ( cairo_t* cr, double x, double y, double width, double height ) ; From b771758ff7d32676c18c6b7e2e041fb24f4526a4 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 26 Mar 2009 10:45:52 -0500 Subject: [PATCH 3/4] fix load errors, help lint --- basis/alien/fortran/fortran.factor | 2 +- basis/compiler/tests/alien.factor | 2 +- basis/math/blas/ffi/ffi.factor | 3 ++- core/alien/alien-docs.factor | 1 - 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/basis/alien/fortran/fortran.factor b/basis/alien/fortran/fortran.factor index 83d56bf9e2..71efa1aa24 100644 --- a/basis/alien/fortran/fortran.factor +++ b/basis/alien/fortran/fortran.factor @@ -5,7 +5,7 @@ byte-arrays combinators combinators.short-circuit fry generalizations kernel lexer macros math math.parser namespaces parser sequences splitting stack-checker vectors vocabs.parser words locals io.encodings.ascii io.encodings.string shuffle effects math.ranges -math.order sorting strings system ; +math.order sorting strings system alien.libraries ; IN: alien.fortran SINGLETONS: f2c-abi gfortran-abi intel-unix-abi intel-windows-abi ; diff --git a/basis/compiler/tests/alien.factor b/basis/compiler/tests/alien.factor index 2aed251676..aa9346f788 100644 --- a/basis/compiler/tests/alien.factor +++ b/basis/compiler/tests/alien.factor @@ -4,7 +4,7 @@ namespaces namespaces tools.test sequences stack-checker stack-checker.errors words arrays parser quotations continuations effects namespaces.private io io.streams.string memory system threads tools.test math accessors combinators -specialized-arrays.float ; +specialized-arrays.float alien.libraries ; << : libfactor-ffi-tests-path ( -- string ) diff --git a/basis/math/blas/ffi/ffi.factor b/basis/math/blas/ffi/ffi.factor index 1749103ce4..5466ad2161 100644 --- a/basis/math/blas/ffi/ffi.factor +++ b/basis/math/blas/ffi/ffi.factor @@ -1,4 +1,5 @@ -USING: alien alien.fortran kernel system combinators ; +USING: alien alien.fortran kernel system combinators +alien.libraries ; IN: math.blas.ffi << diff --git a/core/alien/alien-docs.factor b/core/alien/alien-docs.factor index 398d04e4dd..6bd1d2f53a 100644 --- a/core/alien/alien-docs.factor +++ b/core/alien/alien-docs.factor @@ -266,7 +266,6 @@ $nl { $warning "C does not perform runtime type checking, automatic memory management or array bounds checks. Incorrect usage of C library functions can lead to crashes, data corruption, and security exploits." } { $subsection "loading-libs" } { $subsection "aliens" } -{ $subsection "alien.libraries" } { $subsection "alien-invoke" } { $subsection "alien-callback" } { $subsection "c-data" } From 785e3bcfd01db9e2bdf3e48a4cdfffc41bd0fbea Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 26 Mar 2009 10:47:25 -0500 Subject: [PATCH 4/4] only use -fPIC on the ffi library --- Makefile | 2 +- vm/Config.linux.x86.64 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0c426ca5bc..bfaaa3eee4 100644 --- a/Makefile +++ b/Makefile @@ -160,7 +160,7 @@ factor-console: $(DLL_OBJS) $(EXE_OBJS) $(CFLAGS) $(CFLAGS_CONSOLE) -o factor$(EXE_SUFFIX)$(CONSOLE_EXTENSION) $(EXE_OBJS) factor-ffi-test: $(TEST_OBJS) - $(CC) $(LIBPATH) $(CFLAGS) $(SHARED_FLAG) -o libfactor-ffi-test$(DLL_EXTENSION) $(TEST_OBJS) + $(CC) $(LIBPATH) $(CFLAGS) $(FFI_TEST_CFLAGS) $(SHARED_FLAG) -o libfactor-ffi-test$(DLL_EXTENSION) $(TEST_OBJS) clean: rm -f vm/*.o diff --git a/vm/Config.linux.x86.64 b/vm/Config.linux.x86.64 index 7771ebdbbd..a02fcb4d6d 100644 --- a/vm/Config.linux.x86.64 +++ b/vm/Config.linux.x86.64 @@ -1,4 +1,4 @@ include vm/Config.linux include vm/Config.x86.64 LIBPATH = -L/usr/X11R6/lib64 -L/usr/X11R6/lib -CFLAGS = -fPIC +FFI_TEST_CFLAGS = -fPIC