"Kirill Bychkov" <ki...@linklevel.net> writes:

> [...]
>> - graphics/mapnik
>>      breaks because of python2.  Easy to fix, but then fails at
>>      linking:
>>
>> ----------------8<----------------
>> ld: error: relocation R_X86_64_PC32 cannot be used against symbol typeinfo 
>> for
>> boost::wrapexcept<boost::bad_function_call>; recompile with -fPIC
>>>>> defined in src/expression_grammar.os
>>>>> referenced by expression_grammar.cpp
>>>>>               src/expression_grammar.os:(void
>>>>> boost::throw_exception<boost::bad_function_call>(boost::bad_function_call
>>>>> const&))
>>
>> ld: error: relocation R_X86_64_PC32 cannot be used against symbol vtable for
>> boost::exception_detail::clone_base; recompile with -fPIC
>>>>> defined in src/expression_grammar.os
>>>>> referenced by expression_grammar.cpp
>>>>>               
>>>>> src/expression_grammar.os:(boost::wrapexcept<boost::bad_function_call>::wrapexcept(boost::bad_function_call
>>>>> const&))
>>
>> ...
>> ---------------->8----------------
>>
>>      it shouldn't be hard to fix, I haven't really investigated it
>>      because I was working on the other ports
>>
>>      Attaching wip diff
>
> Hi,
> Adding -fPIC fixes linking:
> -WARNING_CXXFLAGS="-I${X11BASE}/include/freetype2" \
> +WARNING_CXXFLAGS="-I${X11BASE}/include/freetype2 -fPIC" \

Yes, thanks for spotting it!  I went for a slightly different tweak
(adding CUSTOM_CXXFLAGS) instead, but that' the trick :)

Index: Makefile
===================================================================
RCS file: /home/cvs/ports/graphics/mapnik/Makefile,v
retrieving revision 1.38
diff -u -p -r1.38 Makefile
--- Makefile	23 May 2021 17:47:00 -0000	1.38
+++ Makefile	8 Sep 2021 21:02:40 -0000
@@ -52,6 +52,7 @@ MODSCONS_FLAGS =	PREFIX="${TRUEPREFIX}" 
 			HB_INCLUDES=${LOCALBASE}/include \
 			HB_LIBS=${LOCALBASE}/lib \
 			WARNING_CXXFLAGS="-I${X11BASE}/include/freetype2" \
+			CUSTOM_CXXFLAGS="-fPIC" \
 			SYSTEM_FONTS=${X11BASE}/lib/X11/fonts/TTF/ \
 			CUSTOM_LDFLAGS="-L${LOCALBASE}/lib -L${X11BASE}/lib" \
 			FAST=yes \
Index: patches/patch-SConstruct
===================================================================
RCS file: /home/cvs/ports/graphics/mapnik/patches/patch-SConstruct,v
retrieving revision 1.8
diff -u -p -r1.8 patch-SConstruct
--- patches/patch-SConstruct	23 May 2021 17:47:01 -0000	1.8
+++ patches/patch-SConstruct	28 Aug 2021 08:39:09 -0000
@@ -1,9 +1,29 @@
 $OpenBSD: patch-SConstruct,v 1.8 2021/05/23 17:47:01 kirby Exp $
-2nd chunk is needed for proper boost_thread detection
+
+1st and 2snd chuck are for scons 4
+4th chunk is needed for proper boost_thread detection
+
 Index: SConstruct
 --- SConstruct.orig
 +++ SConstruct
-@@ -297,7 +297,7 @@ opts.AddVariables(
+@@ -16,8 +16,6 @@
+ # License along with this library; if not, write to the Free Software
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ 
+-from __future__ import print_function # support python2
+-
+ import os
+ import sys
+ import re
+@@ -126,7 +124,6 @@ PLUGINS = { # plugins with external dependencies
+ 
+ def init_environment(env):
+     env.Decider('MD5-timestamp')
+-    env.SourceCode(".", None)
+     if os.environ.get('RANLIB'):
+         env['RANLIB'] = os.environ['RANLIB']
+     if os.environ.get('AR'):
+@@ -297,7 +294,7 @@ opts.AddVariables(
      ('CUSTOM_LDFLAGS', 'Custom linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir>', ''),
      EnumVariable('LINKING', "Set library format for libmapnik",'shared', ['shared','static']),
      EnumVariable('RUNTIME_LINK', "Set preference for linking dependencies",'shared', ['shared','static']),
@@ -12,7 +32,7 @@ Index: SConstruct
      # Note: setting DEBUG=True will override any custom OPTIMIZATION level
      BoolVariable('DEBUG', 'Compile a debug version of Mapnik', 'False'),
      BoolVariable('COVERAGE', 'Compile a libmapnik and plugins with --coverage', 'False'),
-@@ -1364,6 +1364,9 @@ if not preconfigured:
+@@ -1364,6 +1361,9 @@ if not preconfigured:
  
      thread_suffix = 'mt'
      if env['PLATFORM'] == 'FreeBSD':

Reply via email to