Re: [v8-users] Re: Error when linking libv8_base.a into a shared object on x64 linux
Pete, I doubt you have the same problem. On Linux, the linkage will fail without -fPIC compiler option (and it could be passed with build command or from GYP-file). You are saying that you're getting segfault, that implies that the linkage was successful. -- Marat On Thu, Jun 25, 2015 at 9:25 AM, Pete wrote: > Anyone know what the solution to this is? I am experiencing the same > issues statically linking v8 into a shared object and then consuming it. > I'm getting a segmentation fault. > > On Monday, 2 July 2012 02:33:02 UTC+2, Charles Lowell wrote: >> >> Hi, >> >> I'm trying to build a shared object and link in the static v8 library. >> This works fine for me on OSX, but on Linux I get the following error: >> >> /usr/bin/ld: >> /tmp/build_321giz8disep/vendor/v8/out/x64.release/obj.target/v8_base/src/api.o: >> relocation R_X86_64_32S against `vtable for v8::ScriptData' can not be used >> when making a shared object; recompile with -fPIC >> >> >> /tmp/build_321giz8disep/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a: >> could not read symbols: Bad value >>collect2: ld returned 1 exit status >> >> Is there a way to tell GYP to build a static v8 library with -fPIC? Is >> there a way to do this without patching one of the gypfiles? >> >> cheers, >> Charles >> > -- > -- > v8-users mailing list > v8-users@googlegroups.com > http://groups.google.com/group/v8-users > --- > You received this message because you are subscribed to a topic in the > Google Groups "v8-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/v8-users/1vva9qjvstE/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > v8-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [v8-users] Re: Error when linking libv8_base.a into a shared object on x64 linux
And, by the way, here is my patch: https://codereview.chromium.org/240473003/patch/1/10001 It is rather simple and works the same way `v8_no_strict_aliasing` works. In conclusion, I don't build V8 from V8 folder, GYP builds it as my library's dependency, and in this case there is no way to pass cflags for V8 saying CFLAGS="" before make command. -- Marat On Thursday, April 17, 2014 5:36:09 PM UTC+4, Marat Abdullin wrote: > > No, because of two things: > > 1. This is an additional requirement to run make with (nobody wants to > know these requirements when they build your library). > 2. It doesn't work either. > > I have my library's gyp-file. It depends on V8's gyp-file. I generate my > library's Makefiles with GYP (I use configure script similar to Node.JS). > And when I type `CFLAGS="-fPIC" CXXFLAGS="-fPIC" make` in my library to > build everything, these cflags are not being passed to V8 compile commands. > > -- > Marat > > On Thursday, April 17, 2014 5:06:27 PM UTC+4, Jakob Kummerow wrote: >> >> On Thu, Apr 17, 2014 at 2:57 PM, Peter Olsson wrote: >> >>> You can also specify flags when building, I'm doing it like this in one >>> project. It works as expected. >>> >>> CFLAGS="-fPIC" CXXFLAGS="-fPIC" make native >>> >>> I think this is easy enough that we don't need to add a GYP option. >> >> Den onsdagen den 16:e april 2014 kl. 23:56:38 UTC+2 skrev Marat Abdullin: >>> >>> No positive result. I've found a dirty hack to enable PIC. And I've submitted a patch that allows to force PIC to V8. I really hope it will be accepted. -- Marat On Wednesday, April 16, 2014 9:35:13 PM UTC+4, Jakob Kummerow wrote: > > Try depending on 'v8_base.<(v8_target_arch)' and 'v8_snapshot' > instead. The 'v8' target is just a meta target, you can probably fold > everything it does into your own custom shared library (those > dependencies > being the most important bits). > > > On Wed, Apr 16, 2014 at 12:29 PM, Marat Abdullin > wrote: > >> I use GYP for my entire project and it doesn't work. >> >> I add V8 using: >> "dependencies": [ >> "deps/v8/tools/gyp/v8.gyp:v8", >> ] >> >> with `component` set to `static_library` (and my library's target >> type is `shared_library`). >> >> Here is an example of compiler call (I use `make V=1` to get this) >> when it builds V8: >> >> g++ '-DV8_TARGET_ARCH_X64' '-DENABLE_DEBUGGER_SUPPORT' >> '-DV8_USE_DEFAULT_PLATFORM' '-DENABLE_HANDLE_ZAPPING' -Ideps/v8/src >> -fno-strict-aliasing -m64 -fdata-sections -ffunction-sections -O3 -MMD >> -MF >> out/Release/.deps/out/Release/obj.host/v8_base.x64/deps/v8/src/accessors.o.d.raw >> >> -c -o out/Release/obj.host/v8_base.x64/deps/v8/src/accessors.o >> deps/v8/src/accessors.cc >> No -fPIC (and quick V8's gyp-files examination shows that -fPIC is >> being added only in case `component` is set to `shared_library`). >> >> -- >> Marat >> >> >> On Wednesday, April 16, 2014 12:23:29 PM UTC+4, Jakob Kummerow wrote: >> >>> If you use GYP for your entire project, things should "just work". >>> Otherwise you'll probably have to modify V8's .gyp files. I'm not sure >>> how, >>> you'll have to find that out for yourself. Try adding -fPIC to the >>> 'cflags' >>> lists in build/toolchain.gypi. >>> >>> >>> On Wed, Apr 16, 2014 at 1:45 AM, Marat Abdullin < >>> dak...@brokenpipe.ru> wrote: >>> This thing is pretty old but I still have the same problem. Is there any fix? I'm building a dynamic library and I'm statically linking V8 (version 3.24.40) in it. On OSX everything is linking just fine, but on Linux I get: /usr/bin/ld: out/Release/obj.target/deps/v8 /tools/gyp/../../../../v8_base.x64/deps/v8/src/accessors.o: relocation R_X86_64_32S against `vtable for v8::internal::StackFrame' can not be used when making a shared object; recompile with -fPIC out/Release/obj.target/deps/v8/tools/gyp/../../../../v8_base .x64/deps/v8/src/accessors.o: could not read symbols: Bad value collect2: ld returned 1 exit status So, I need a way to tell V8 to build static library with -fPIC. Or is there any other fix for this? -- Marat On Monday, July 2, 2012 4:33:02 AM UTC+4, Charles Lowell wrote: > > Hi, > > I'm trying to build a shared object and link in the static v8 > library. This works fine for me on OSX, but on Linux I get the > following > error: > > /usr/bin/ld: /tmp/build_321giz8disep/vendor > /v8/out/x64.release/obj.target/v8_base/src/api.o: relocation >>>
Re: [v8-users] Re: Error when linking libv8_base.a into a shared object on x64 linux
No, because of two things: 1. This is an additional requirement to run make with (nobody wants to know these requirements when they build your library). 2. It doesn't work either. I have my library's gyp-file. It depends on V8's gyp-file. I generate my library's Makefiles with GYP (I use configure script similar to Node.JS). And when I type `CFLAGS="-fPIC" CXXFLAGS="-fPIC" make` in my library to build everything, these cflags are not being passed to V8 compile commands. -- Marat On Thursday, April 17, 2014 5:06:27 PM UTC+4, Jakob Kummerow wrote: > > On Thu, Apr 17, 2014 at 2:57 PM, Peter Olsson > > > wrote: > >> You can also specify flags when building, I'm doing it like this in one >> project. It works as expected. >> >> CFLAGS="-fPIC" CXXFLAGS="-fPIC" make native >> >> I think this is easy enough that we don't need to add a GYP option. > > Den onsdagen den 16:e april 2014 kl. 23:56:38 UTC+2 skrev Marat Abdullin: >> >> No positive result. >>> >>> I've found a dirty hack to enable PIC. >>> And I've submitted a patch that allows to force PIC to V8. I really hope >>> it will be accepted. >>> >>> -- >>> Marat >>> >>> On Wednesday, April 16, 2014 9:35:13 PM UTC+4, Jakob Kummerow wrote: Try depending on 'v8_base.<(v8_target_arch)' and 'v8_snapshot' instead. The 'v8' target is just a meta target, you can probably fold everything it does into your own custom shared library (those dependencies being the most important bits). On Wed, Apr 16, 2014 at 12:29 PM, Marat Abdullin wrote: > I use GYP for my entire project and it doesn't work. > > I add V8 using: > "dependencies": [ > "deps/v8/tools/gyp/v8.gyp:v8", > ] > > with `component` set to `static_library` (and my library's target type > is `shared_library`). > > Here is an example of compiler call (I use `make V=1` to get this) > when it builds V8: > > g++ '-DV8_TARGET_ARCH_X64' '-DENABLE_DEBUGGER_SUPPORT' > '-DV8_USE_DEFAULT_PLATFORM' '-DENABLE_HANDLE_ZAPPING' -Ideps/v8/src > -fno-strict-aliasing -m64 -fdata-sections -ffunction-sections -O3 -MMD > -MF > out/Release/.deps/out/Release/obj.host/v8_base.x64/deps/v8/src/accessors.o.d.raw > > -c -o out/Release/obj.host/v8_base.x64/deps/v8/src/accessors.o > deps/v8/src/accessors.cc > No -fPIC (and quick V8's gyp-files examination shows that -fPIC is > being added only in case `component` is set to `shared_library`). > > -- > Marat > > > On Wednesday, April 16, 2014 12:23:29 PM UTC+4, Jakob Kummerow wrote: > >> If you use GYP for your entire project, things should "just work". >> Otherwise you'll probably have to modify V8's .gyp files. I'm not sure >> how, >> you'll have to find that out for yourself. Try adding -fPIC to the >> 'cflags' >> lists in build/toolchain.gypi. >> >> >> On Wed, Apr 16, 2014 at 1:45 AM, Marat Abdullin > > wrote: >> >>> This thing is pretty old but I still have the same problem. >>> Is there any fix? >>> >>> I'm building a dynamic library and I'm statically linking V8 >>> (version 3.24.40) in it. On OSX everything is linking just fine, but on >>> Linux I get: >>> >>> /usr/bin/ld: out/Release/obj.target/deps/v8 >>> /tools/gyp/../../../../v8_base.x64/deps/v8/src/accessors.o: >>> relocation R_X86_64_32S against `vtable for v8::internal::StackFrame' >>> can >>> not be used when making a shared object; recompile with -fPIC >>> >>> out/Release/obj.target/deps/v8/tools/gyp/../../../../v8_base >>> .x64/deps/v8/src/accessors.o: could not read symbols: Bad value >>> >>> collect2: ld returned 1 exit status >>> >>> So, I need a way to tell V8 to build static library with -fPIC. Or >>> is there any other fix for this? >>> >>> -- >>> Marat >>> >>> On Monday, July 2, 2012 4:33:02 AM UTC+4, Charles Lowell wrote: Hi, I'm trying to build a shared object and link in the static v8 library. This works fine for me on OSX, but on Linux I get the following error: /usr/bin/ld: /tmp/build_321giz8disep/vendor /v8/out/x64.release/obj.target/v8_base/src/api.o: relocation R_X86_64_32S against `vtable for v8::ScriptData' can not be used when making a shared object; recompile with -fPIC /tmp/build_321giz8disep/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a: could not read symbols: Bad value collect2: ld returned 1 exit status Is there a way to tell GYP to build a static v8 library with -fPIC? Is there a way to do this without patching one of the gypfiles? cheers, Charles >>> -- >>> -- >>
Re: [v8-users] Re: Error when linking libv8_base.a into a shared object on x64 linux
On Thu, Apr 17, 2014 at 2:57 PM, Peter Olsson wrote: > > You can also specify flags when building, I'm doing it like this in one > project. It works as expected. > > CFLAGS="-fPIC" CXXFLAGS="-fPIC" make native > > I think this is easy enough that we don't need to add a GYP option. Den onsdagen den 16:e april 2014 kl. 23:56:38 UTC+2 skrev Marat Abdullin: > > No positive result. >> >> I've found a dirty hack to enable PIC. >> And I've submitted a patch that allows to force PIC to V8. I really hope >> it will be accepted. >> >> -- >> Marat >> >> On Wednesday, April 16, 2014 9:35:13 PM UTC+4, Jakob Kummerow wrote: >>> >>> Try depending on 'v8_base.<(v8_target_arch)' and 'v8_snapshot' instead. >>> The 'v8' target is just a meta target, you can probably fold everything it >>> does into your own custom shared library (those dependencies being the most >>> important bits). >>> >>> >>> On Wed, Apr 16, 2014 at 12:29 PM, Marat Abdullin >>> wrote: >>> I use GYP for my entire project and it doesn't work. I add V8 using: "dependencies": [ "deps/v8/tools/gyp/v8.gyp:v8", ] with `component` set to `static_library` (and my library's target type is `shared_library`). Here is an example of compiler call (I use `make V=1` to get this) when it builds V8: g++ '-DV8_TARGET_ARCH_X64' '-DENABLE_DEBUGGER_SUPPORT' '-DV8_USE_DEFAULT_PLATFORM' '-DENABLE_HANDLE_ZAPPING' -Ideps/v8/src -fno-strict-aliasing -m64 -fdata-sections -ffunction-sections -O3 -MMD -MF out/Release/.deps/out/Release/obj.host/v8_base.x64/deps/v8/src/accessors.o.d.raw -c -o out/Release/obj.host/v8_base.x64/deps/v8/src/accessors.o deps/v8/src/accessors.cc No -fPIC (and quick V8's gyp-files examination shows that -fPIC is being added only in case `component` is set to `shared_library`). -- Marat On Wednesday, April 16, 2014 12:23:29 PM UTC+4, Jakob Kummerow wrote: > If you use GYP for your entire project, things should "just work". > Otherwise you'll probably have to modify V8's .gyp files. I'm not sure > how, > you'll have to find that out for yourself. Try adding -fPIC to the > 'cflags' > lists in build/toolchain.gypi. > > > On Wed, Apr 16, 2014 at 1:45 AM, Marat Abdullin > wrote: > >> This thing is pretty old but I still have the same problem. >> Is there any fix? >> >> I'm building a dynamic library and I'm statically linking V8 (version >> 3.24.40) in it. On OSX everything is linking just fine, but on Linux I >> get: >> >> /usr/bin/ld: out/Release/obj.target/deps/v8/tools/gyp/../../../../v8_ >> base.x64/deps/v8/src/accessors.o: relocation R_X86_64_32S against >> `vtable for v8::internal::StackFrame' can not be used when making a >> shared >> object; recompile with -fPIC >> >> out/Release/obj.target/deps/v8/tools/gyp/../../../../v8_base >> .x64/deps/v8/src/accessors.o: could not read symbols: Bad value >> >> collect2: ld returned 1 exit status >> >> So, I need a way to tell V8 to build static library with -fPIC. Or is >> there any other fix for this? >> >> -- >> Marat >> >> On Monday, July 2, 2012 4:33:02 AM UTC+4, Charles Lowell wrote: >>> >>> Hi, >>> >>> I'm trying to build a shared object and link in the static v8 >>> library. This works fine for me on OSX, but on Linux I get the following >>> error: >>> >>> /usr/bin/ld: /tmp/build_321giz8disep/vendor >>> /v8/out/x64.release/obj.target/v8_base/src/api.o: relocation >>> R_X86_64_32S against `vtable for v8::ScriptData' can not be used when >>> making a shared object; recompile with -fPIC >>> >>> /tmp/build_321giz8disep/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a: >>> could not read symbols: Bad value >>>collect2: ld returned 1 exit status >>> >>> Is there a way to tell GYP to build a static v8 library with -fPIC? >>> Is there a way to do this without patching one of the gypfiles? >>> >>> cheers, >>> Charles >>> >> -- >> -- >> v8-users mailing list >> v8-u...@googlegroups.com >> >> http://groups.google.com/group/v8-users >> --- >> You received this message because you are subscribed to the Google >> Groups "v8-users" group. >> To unsubscribe from this group and stop receiving emails from it, >> send an email to v8-users+u...@googlegroups.com. >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- -- v8-users mailing list v8-u...@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email t
Re: [v8-users] Re: Error when linking libv8_base.a into a shared object on x64 linux
You can also specify flags when building, I'm doing it like this in one project. It works as expected. CFLAGS="-fPIC" CXXFLAGS="-fPIC" make native Den onsdagen den 16:e april 2014 kl. 23:56:38 UTC+2 skrev Marat Abdullin: > > No positive result. > > I've found a dirty hack to enable PIC. > And I've submitted a patch that allows to force PIC to V8. I really hope > it will be accepted. > > -- > Marat > > On Wednesday, April 16, 2014 9:35:13 PM UTC+4, Jakob Kummerow wrote: >> >> Try depending on 'v8_base.<(v8_target_arch)' and 'v8_snapshot' instead. >> The 'v8' target is just a meta target, you can probably fold everything it >> does into your own custom shared library (those dependencies being the most >> important bits). >> >> >> On Wed, Apr 16, 2014 at 12:29 PM, Marat Abdullin wrote: >> >>> I use GYP for my entire project and it doesn't work. >>> >>> I add V8 using: >>> "dependencies": [ >>> "deps/v8/tools/gyp/v8.gyp:v8", >>> ] >>> >>> with `component` set to `static_library` (and my library's target type >>> is `shared_library`). >>> >>> Here is an example of compiler call (I use `make V=1` to get this) when >>> it builds V8: >>> >>> g++ '-DV8_TARGET_ARCH_X64' '-DENABLE_DEBUGGER_SUPPORT' >>> '-DV8_USE_DEFAULT_PLATFORM' '-DENABLE_HANDLE_ZAPPING' -Ideps/v8/src >>> -fno-strict-aliasing -m64 -fdata-sections -ffunction-sections -O3 -MMD -MF >>> out/Release/.deps/out/Release/obj.host/v8_base.x64/deps/v8/src/accessors.o.d.raw >>> >>> -c -o out/Release/obj.host/v8_base.x64/deps/v8/src/accessors.o >>> deps/v8/src/accessors.cc >>> No -fPIC (and quick V8's gyp-files examination shows that -fPIC is being >>> added only in case `component` is set to `shared_library`). >>> >>> -- >>> Marat >>> >>> >>> On Wednesday, April 16, 2014 12:23:29 PM UTC+4, Jakob Kummerow wrote: >>> If you use GYP for your entire project, things should "just work". Otherwise you'll probably have to modify V8's .gyp files. I'm not sure how, you'll have to find that out for yourself. Try adding -fPIC to the 'cflags' lists in build/toolchain.gypi. On Wed, Apr 16, 2014 at 1:45 AM, Marat Abdullin wrote: > This thing is pretty old but I still have the same problem. > Is there any fix? > > I'm building a dynamic library and I'm statically linking V8 (version > 3.24.40) in it. On OSX everything is linking just fine, but on Linux I > get: > > /usr/bin/ld: out/Release/obj.target/deps/v8/tools/gyp/../../../../v8_ > base.x64/deps/v8/src/accessors.o: relocation R_X86_64_32S against > `vtable for v8::internal::StackFrame' can not be used when making a > shared > object; recompile with -fPIC > > out/Release/obj.target/deps/v8/tools/gyp/../../../../v8_ > base.x64/deps/v8/src/accessors.o: could not read symbols: Bad value > > collect2: ld returned 1 exit status > > So, I need a way to tell V8 to build static library with -fPIC. Or is > there any other fix for this? > > -- > Marat > > On Monday, July 2, 2012 4:33:02 AM UTC+4, Charles Lowell wrote: >> >> Hi, >> >> I'm trying to build a shared object and link in the static v8 >> library. This works fine for me on OSX, but on Linux I get the following >> error: >> >> /usr/bin/ld: /tmp/build_321giz8disep/vendor >> /v8/out/x64.release/obj.target/v8_base/src/api.o: relocation >> R_X86_64_32S against `vtable for v8::ScriptData' can not be used when >> making a shared object; recompile with -fPIC >> >> /tmp/build_321giz8disep/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a: >> >> could not read symbols: Bad value >>collect2: ld returned 1 exit status >> >> Is there a way to tell GYP to build a static v8 library with -fPIC? >> Is there a way to do this without patching one of the gypfiles? >> >> cheers, >> Charles >> > -- > -- > v8-users mailing list > v8-u...@googlegroups.com > > http://groups.google.com/group/v8-users > --- > You received this message because you are subscribed to the Google > Groups "v8-users" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to v8-users+u...@googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. > -- >>> -- >>> v8-users mailing list >>> v8-u...@googlegroups.com >>> http://groups.google.com/group/v8-users >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "v8-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to v8-users+u...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- Yo
Re: [v8-users] Re: Error when linking libv8_base.a into a shared object on x64 linux
No positive result. I've found a dirty hack to enable PIC. And I've submitted a patch that allows to force PIC to V8. I really hope it will be accepted. -- Marat On Wednesday, April 16, 2014 9:35:13 PM UTC+4, Jakob Kummerow wrote: > > Try depending on 'v8_base.<(v8_target_arch)' and 'v8_snapshot' instead. > The 'v8' target is just a meta target, you can probably fold everything it > does into your own custom shared library (those dependencies being the most > important bits). > > > On Wed, Apr 16, 2014 at 12:29 PM, Marat Abdullin > > > wrote: > >> I use GYP for my entire project and it doesn't work. >> >> I add V8 using: >> "dependencies": [ >> "deps/v8/tools/gyp/v8.gyp:v8", >> ] >> >> with `component` set to `static_library` (and my library's target type is >> `shared_library`). >> >> Here is an example of compiler call (I use `make V=1` to get this) when >> it builds V8: >> >> g++ '-DV8_TARGET_ARCH_X64' '-DENABLE_DEBUGGER_SUPPORT' >> '-DV8_USE_DEFAULT_PLATFORM' '-DENABLE_HANDLE_ZAPPING' -Ideps/v8/src >> -fno-strict-aliasing -m64 -fdata-sections -ffunction-sections -O3 -MMD -MF >> out/Release/.deps/out/Release/obj.host/v8_base.x64/deps/v8/src/accessors.o.d.raw >> >> -c -o out/Release/obj.host/v8_base.x64/deps/v8/src/accessors.o >> deps/v8/src/accessors.cc >> No -fPIC (and quick V8's gyp-files examination shows that -fPIC is being >> added only in case `component` is set to `shared_library`). >> >> -- >> Marat >> >> >> On Wednesday, April 16, 2014 12:23:29 PM UTC+4, Jakob Kummerow wrote: >> >>> If you use GYP for your entire project, things should "just work". >>> Otherwise you'll probably have to modify V8's .gyp files. I'm not sure how, >>> you'll have to find that out for yourself. Try adding -fPIC to the 'cflags' >>> lists in build/toolchain.gypi. >>> >>> >>> On Wed, Apr 16, 2014 at 1:45 AM, Marat Abdullin wrote: >>> This thing is pretty old but I still have the same problem. Is there any fix? I'm building a dynamic library and I'm statically linking V8 (version 3.24.40) in it. On OSX everything is linking just fine, but on Linux I get: /usr/bin/ld: out/Release/obj.target/deps/v8/tools/gyp/../../../../v8_ base.x64/deps/v8/src/accessors.o: relocation R_X86_64_32S against `vtable for v8::internal::StackFrame' can not be used when making a shared object; recompile with -fPIC out/Release/obj.target/deps/v8/tools/gyp/../../../../v8_ base.x64/deps/v8/src/accessors.o: could not read symbols: Bad value collect2: ld returned 1 exit status So, I need a way to tell V8 to build static library with -fPIC. Or is there any other fix for this? -- Marat On Monday, July 2, 2012 4:33:02 AM UTC+4, Charles Lowell wrote: > > Hi, > > I'm trying to build a shared object and link in the static v8 library. > This works fine for me on OSX, but on Linux I get the following error: > > /usr/bin/ld: /tmp/build_321giz8disep/vendor > /v8/out/x64.release/obj.target/v8_base/src/api.o: relocation > R_X86_64_32S against `vtable for v8::ScriptData' can not be used when > making a shared object; recompile with -fPIC > > /tmp/build_321giz8disep/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a: > > could not read symbols: Bad value >collect2: ld returned 1 exit status > > Is there a way to tell GYP to build a static v8 library with -fPIC? Is > there a way to do this without patching one of the gypfiles? > > cheers, > Charles > -- -- v8-users mailing list v8-u...@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. >>> >>> -- >> -- >> v8-users mailing list >> v8-u...@googlegroups.com >> http://groups.google.com/group/v8-users >> --- >> You received this message because you are subscribed to the Google Groups >> "v8-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to v8-users+u...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [v8-users] Re: Error when linking libv8_base.a into a shared object on x64 linux
Try depending on 'v8_base.<(v8_target_arch)' and 'v8_snapshot' instead. The 'v8' target is just a meta target, you can probably fold everything it does into your own custom shared library (those dependencies being the most important bits). On Wed, Apr 16, 2014 at 12:29 PM, Marat Abdullin wrote: > I use GYP for my entire project and it doesn't work. > > I add V8 using: > "dependencies": [ > "deps/v8/tools/gyp/v8.gyp:v8", > ] > > with `component` set to `static_library` (and my library's target type is > `shared_library`). > > Here is an example of compiler call (I use `make V=1` to get this) when it > builds V8: > > g++ '-DV8_TARGET_ARCH_X64' '-DENABLE_DEBUGGER_SUPPORT' > '-DV8_USE_DEFAULT_PLATFORM' '-DENABLE_HANDLE_ZAPPING' -Ideps/v8/src > -fno-strict-aliasing -m64 -fdata-sections -ffunction-sections -O3 -MMD -MF > out/Release/.deps/out/Release/obj.host/v8_base.x64/deps/v8/src/accessors.o.d.raw > -c -o out/Release/obj.host/v8_base.x64/deps/v8/src/accessors.o > deps/v8/src/accessors.cc > No -fPIC (and quick V8's gyp-files examination shows that -fPIC is being > added only in case `component` is set to `shared_library`). > > -- > Marat > > > On Wednesday, April 16, 2014 12:23:29 PM UTC+4, Jakob Kummerow wrote: > >> If you use GYP for your entire project, things should "just work". >> Otherwise you'll probably have to modify V8's .gyp files. I'm not sure how, >> you'll have to find that out for yourself. Try adding -fPIC to the 'cflags' >> lists in build/toolchain.gypi. >> >> >> On Wed, Apr 16, 2014 at 1:45 AM, Marat Abdullin wrote: >> >>> This thing is pretty old but I still have the same problem. >>> Is there any fix? >>> >>> I'm building a dynamic library and I'm statically linking V8 (version >>> 3.24.40) in it. On OSX everything is linking just fine, but on Linux I get: >>> >>> /usr/bin/ld: out/Release/obj.target/deps/v8/tools/gyp/../../../../v8_ >>> base.x64/deps/v8/src/accessors.o: relocation R_X86_64_32S against >>> `vtable for v8::internal::StackFrame' can not be used when making a shared >>> object; recompile with -fPIC >>> >>> out/Release/obj.target/deps/v8/tools/gyp/../../../../v8_ >>> base.x64/deps/v8/src/accessors.o: could not read symbols: Bad value >>> >>> collect2: ld returned 1 exit status >>> >>> So, I need a way to tell V8 to build static library with -fPIC. Or is >>> there any other fix for this? >>> >>> -- >>> Marat >>> >>> On Monday, July 2, 2012 4:33:02 AM UTC+4, Charles Lowell wrote: Hi, I'm trying to build a shared object and link in the static v8 library. This works fine for me on OSX, but on Linux I get the following error: /usr/bin/ld: /tmp/build_321giz8disep/vendor/v8/out/x64.release/obj. target/v8_base/src/api.o: relocation R_X86_64_32S against `vtable for v8::ScriptData' can not be used when making a shared object; recompile with -fPIC /tmp/build_321giz8disep/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a: could not read symbols: Bad value collect2: ld returned 1 exit status Is there a way to tell GYP to build a static v8 library with -fPIC? Is there a way to do this without patching one of the gypfiles? cheers, Charles >>> -- >>> -- >>> v8-users mailing list >>> v8-u...@googlegroups.com >>> >>> http://groups.google.com/group/v8-users >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "v8-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to v8-users+u...@googlegroups.com. >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > -- > v8-users mailing list > v8-users@googlegroups.com > http://groups.google.com/group/v8-users > --- > You received this message because you are subscribed to the Google Groups > "v8-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to v8-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [v8-users] Re: Error when linking libv8_base.a into a shared object on x64 linux
I use GYP for my entire project and it doesn't work. I add V8 using: "dependencies": [ "deps/v8/tools/gyp/v8.gyp:v8", ] with `component` set to `static_library` (and my library's target type is `shared_library`). Here is an example of compiler call (I use `make V=1` to get this) when it builds V8: g++ '-DV8_TARGET_ARCH_X64' '-DENABLE_DEBUGGER_SUPPORT' '-DV8_USE_DEFAULT_PLATFORM' '-DENABLE_HANDLE_ZAPPING' -Ideps/v8/src -fno-strict-aliasing -m64 -fdata-sections -ffunction-sections -O3 -MMD -MF out/Release/.deps/out/Release/obj.host/v8_base.x64/deps/v8/src/accessors.o.d.raw -c -o out/Release/obj.host/v8_base.x64/deps/v8/src/accessors.o deps/v8/src/accessors.cc No -fPIC (and quick V8's gyp-files examination shows that -fPIC is being added only in case `component` is set to `shared_library`). -- Marat On Wednesday, April 16, 2014 12:23:29 PM UTC+4, Jakob Kummerow wrote: > > If you use GYP for your entire project, things should "just work". > Otherwise you'll probably have to modify V8's .gyp files. I'm not sure how, > you'll have to find that out for yourself. Try adding -fPIC to the 'cflags' > lists in build/toolchain.gypi. > > > On Wed, Apr 16, 2014 at 1:45 AM, Marat Abdullin > > > wrote: > >> This thing is pretty old but I still have the same problem. >> Is there any fix? >> >> I'm building a dynamic library and I'm statically linking V8 (version >> 3.24.40) in it. On OSX everything is linking just fine, but on Linux I get: >> >> /usr/bin/ld: >> out/Release/obj.target/deps/v8/tools/gyp/../../../../v8_base.x64/deps/v8/src/accessors.o: >> >> relocation R_X86_64_32S against `vtable for v8::internal::StackFrame' can >> not be used when making a shared object; recompile with -fPIC >> >> out/Release/obj.target/deps/v8/tools/gyp/../../../../v8_base.x64/deps/v8/src/accessors.o: >> >> could not read symbols: Bad value >> >> collect2: ld returned 1 exit status >> >> So, I need a way to tell V8 to build static library with -fPIC. Or is >> there any other fix for this? >> >> -- >> Marat >> >> On Monday, July 2, 2012 4:33:02 AM UTC+4, Charles Lowell wrote: >>> >>> Hi, >>> >>> I'm trying to build a shared object and link in the static v8 library. >>> This works fine for me on OSX, but on Linux I get the following error: >>> >>> /usr/bin/ld: >>> /tmp/build_321giz8disep/vendor/v8/out/x64.release/obj.target/v8_base/src/api.o: >>> >>> relocation R_X86_64_32S against `vtable for v8::ScriptData' can not be used >>> when making a shared object; recompile with -fPIC >>> >>> /tmp/build_321giz8disep/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a: >>> >>> could not read symbols: Bad value >>>collect2: ld returned 1 exit status >>> >>> Is there a way to tell GYP to build a static v8 library with -fPIC? Is >>> there a way to do this without patching one of the gypfiles? >>> >>> cheers, >>> Charles >>> >> -- >> -- >> v8-users mailing list >> v8-u...@googlegroups.com >> http://groups.google.com/group/v8-users >> --- >> You received this message because you are subscribed to the Google Groups >> "v8-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to v8-users+u...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [v8-users] Re: Error when linking libv8_base.a into a shared object on x64 linux
If you use GYP for your entire project, things should "just work". Otherwise you'll probably have to modify V8's .gyp files. I'm not sure how, you'll have to find that out for yourself. Try adding -fPIC to the 'cflags' lists in build/toolchain.gypi. On Wed, Apr 16, 2014 at 1:45 AM, Marat Abdullin wrote: > This thing is pretty old but I still have the same problem. > Is there any fix? > > I'm building a dynamic library and I'm statically linking V8 (version > 3.24.40) in it. On OSX everything is linking just fine, but on Linux I get: > > /usr/bin/ld: > out/Release/obj.target/deps/v8/tools/gyp/../../../../v8_base.x64/deps/v8/src/accessors.o: > relocation R_X86_64_32S against `vtable for v8::internal::StackFrame' can > not be used when making a shared object; recompile with -fPIC > > out/Release/obj.target/deps/v8/tools/gyp/../../../../v8_base.x64/deps/v8/src/accessors.o: > could not read symbols: Bad value > > collect2: ld returned 1 exit status > > So, I need a way to tell V8 to build static library with -fPIC. Or is > there any other fix for this? > > -- > Marat > > On Monday, July 2, 2012 4:33:02 AM UTC+4, Charles Lowell wrote: >> >> Hi, >> >> I'm trying to build a shared object and link in the static v8 library. >> This works fine for me on OSX, but on Linux I get the following error: >> >> /usr/bin/ld: >> /tmp/build_321giz8disep/vendor/v8/out/x64.release/obj.target/v8_base/src/api.o: >> relocation R_X86_64_32S against `vtable for v8::ScriptData' can not be used >> when making a shared object; recompile with -fPIC >> >> /tmp/build_321giz8disep/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a: >> could not read symbols: Bad value >>collect2: ld returned 1 exit status >> >> Is there a way to tell GYP to build a static v8 library with -fPIC? Is >> there a way to do this without patching one of the gypfiles? >> >> cheers, >> Charles >> > -- > -- > v8-users mailing list > v8-users@googlegroups.com > http://groups.google.com/group/v8-users > --- > You received this message because you are subscribed to the Google Groups > "v8-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to v8-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.