Re: Linking 2 c++ libraries with D
On Friday, 28 June 2013 at 02:34:01 UTC, Juan Manuel Cabo wrote: On 06/27/2013 10:12 PM, Milvakili wrote: I have successfully link c++ with D. Have ever when I create a dependency: cpp2->cpp1->d when compile with dmd dmd cpp1.a cpp2.a file.d -L-lstdc++ I tried it and it works _perfectly_ for me, but instead of .a I compiled the C++ files to .o g++ -c cpp1.cpp g++ -c cpp2.cpp dmd cpp1.o cpp2.o file.d -L-lstdc++ (I had to comment the printf in cpp1.cpp) Running the program prints this output: Testing callinf C++ main from D cbin2 c++ library called from:cbin.cpp I'm on Kubuntu 12.04 64bits, using DMD v2.063.2 I have the following libstdc++ packages installed As shown by dpkg -l libstd*|grep ^ii libstdc++6 4.6.3-1ubuntu5 libstdc++6-4.4-dev 4.4.7-1ubuntu2 libstdc++6-4.6-dev 4.6.3-1ubuntu5 G++ version is: g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 ldd on the executable shows that it's using these libraries: linux-vdso.so.1 => (0x7fff989ff000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x7f9c0cbb7000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x7f9c0c99a000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x7f9c0c791000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x7f9c0c57b000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x7f9c0c1bc000) /lib64/ld-linux-x86-64.so.2 (0x7f9c0cedb000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x7f9c0bebf000) Hope that any of this was useful to you! --jm Thanks for the answer, I had the same ldd output. The interesting thing is the code is working with same libraries when we have one dependency.
Re: Linking 2 c++ libraries with D
On 06/27/2013 10:12 PM, Milvakili wrote: > I have successfully link c++ with D. > > Have ever when I create a dependency: > cpp2->cpp1->d > > when compile with dmd > > dmd cpp1.a cpp2.a file.d -L-lstdc++ I tried it and it works _perfectly_ for me, but instead of .a I compiled the C++ files to .o g++ -c cpp1.cpp g++ -c cpp2.cpp dmd cpp1.o cpp2.o file.d -L-lstdc++ (I had to comment the printf in cpp1.cpp) Running the program prints this output: Testing callinf C++ main from D cbin2 c++ library called from:cbin.cpp I'm on Kubuntu 12.04 64bits, using DMD v2.063.2 I have the following libstdc++ packages installed As shown by dpkg -l libstd*|grep ^ii libstdc++6 4.6.3-1ubuntu5 libstdc++6-4.4-dev 4.4.7-1ubuntu2 libstdc++6-4.6-dev 4.6.3-1ubuntu5 G++ version is: g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 ldd on the executable shows that it's using these libraries: linux-vdso.so.1 => (0x7fff989ff000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x7f9c0cbb7000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x7f9c0c99a000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x7f9c0c791000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x7f9c0c57b000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x7f9c0c1bc000) /lib64/ld-linux-x86-64.so.2 (0x7f9c0cedb000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x7f9c0bebf000) Hope that any of this was useful to you! --jm
Re: Linking 2 c++ libraries with D
On Friday, 28 June 2013 at 01:42:35 UTC, Milvakili wrote: On Friday, 28 June 2013 at 01:39:49 UTC, Adam D. Ruppe wrote: On Friday, 28 June 2013 at 01:12:11 UTC, Milvakili wrote: relocation error: "some path": symbol _ZNSsC1EPKcRKSaIcE, version GLIBCXX_3.4 not defined in file libstdc++.so.6 with link time reference did you compile the C++ and run the program on the same computer? This is complaining that it couldn't find the specific version of std::basic_string it was looking for in the c++ standard lib. Yes everything is on same computer and the library. When I changed the string to vector it still runs. Error is specific to string, current
Re: Linking 2 c++ libraries with D
On Friday, 28 June 2013 at 01:39:49 UTC, Adam D. Ruppe wrote: On Friday, 28 June 2013 at 01:12:11 UTC, Milvakili wrote: relocation error: "some path": symbol _ZNSsC1EPKcRKSaIcE, version GLIBCXX_3.4 not defined in file libstdc++.so.6 with link time reference did you compile the C++ and run the program on the same computer? This is complaining that it couldn't find the specific version of std::basic_string it was looking for in the c++ standard lib. Yes everything is on same computer and the library.
Re: Linking 2 c++ libraries with D
On Friday, 28 June 2013 at 01:12:11 UTC, Milvakili wrote: relocation error: "some path": symbol _ZNSsC1EPKcRKSaIcE, version GLIBCXX_3.4 not defined in file libstdc++.so.6 with link time reference did you compile the C++ and run the program on the same computer? This is complaining that it couldn't find the specific version of std::basic_string it was looking for in the c++ standard lib.