Re: libtool uses cc to link a mixed C/C++ project and fails to find operator new

2019-06-23 Thread Bob Friesenhahn

On Sun, 23 Jun 2019, Yuri wrote:


So is there an easy way to override this and always use C++ way of linking?


To do this you might need to set LD or CC to your C++ compiler.  A 
better way is to make your main program be C++ since that assures it 
can work.


Consider that C++ exceptions can not be thrown into C code unless 
a special compiler option is used so that C supports the exception 
framework.  Without this you are likely to get a core dump.


C++ is very good at using C code but C code is not very good at 
using C++ code.


Bob
--
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,http://www.GraphicsMagick.org/
Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt

___
https://lists.gnu.org/mailman/listinfo/libtool


Re: libtool uses cc to link a mixed C/C++ project and fails to find operator new

2019-06-23 Thread Yuri

On 2019-06-23 17:29, Bob Friesenhahn wrote:




I doubt that libtool can be smart enough to intuit when the C++ 
compiler needs to be used for linking when the program being linked is 
C.  The only way it could tell this is via library dependencies.  Just 
supplying the library dependencies is not enough.


C++ introduces a new wrinkle in that there are now often 3 or 4 
different C++ variants available based on C++ standard level, and 
library options (e.g. different C++ STL library implementations).


Things have changed quite a lot in the past several years when it 
comes to C++.


In addition to being linked using the C++ compiler, the correct 
options would need to be passed to the C++ compiler so that the 
correct standard level and libraries are used. 




So is there an easy way to override this and always use C++ way of linking?


Yuri


___
https://lists.gnu.org/mailman/listinfo/libtool


Re: libtool uses cc to link a mixed C/C++ project and fails to find operator new

2019-06-23 Thread Bob Friesenhahn

On Sun, 23 Jun 2019, Yuri wrote:

Those variables could be used to tune build process.
For instance CXX=my-c++ ./configure ... could be used to change C++ 
compiler.




It seems to know that c++ is the C++ compiler, but then uses cc anyway:


I doubt that libtool can be smart enough to intuit when the C++ 
compiler needs to be used for linking when the program being linked is 
C.  The only way it could tell this is via library dependencies.  Just 
supplying the library dependencies is not enough.


C++ introduces a new wrinkle in that there are now often 3 or 4 
different C++ variants available based on C++ standard level, and 
library options (e.g. different C++ STL library implementations).


Things have changed quite a lot in the past several years when it 
comes to C++.


In addition to being linked using the C++ compiler, the correct 
options would need to be passed to the C++ compiler so that the 
correct standard level and libraries are used.


Bob
--
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,http://www.GraphicsMagick.org/
Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt

___
https://lists.gnu.org/mailman/listinfo/libtool


Re: libtool uses cc to link a mixed C/C++ project and fails to find operator new

2019-06-23 Thread Yuri

On 2019-06-23 12:45, Roumen Petrov wrote:



If clang is default OS compiler is expected symbolic link c++ to 
clang++ or similar. May be some OS setup commands could set such links.



Remark:
At end ./configure --help outputs environment variables .
Those variables could be used to tune build process.
For instance CXX=my-c++ ./configure ... could be used to change C++ 
compiler.




It seems to know that c++ is the C++ compiler, but then uses cc anyway: 
https://people.freebsd.org/~yuri/vienna.log



Yuri



___
https://lists.gnu.org/mailman/listinfo/libtool


Re: libtool uses cc to link a mixed C/C++ project and fails to find operator new

2019-06-23 Thread Roumen Petrov

Yuri wrote:

On 2019-06-23 12:19, Roumen Petrov wrote:

cc ?

I'm not sure which compiler suite is used on FreeBSD but it seems to 
me C++ compiler is not installed.


clang8 is used. cc is a C compiler, c++ is a C++ compiler.


Ok. Dunno why is not detected c++ at configure time. I'm not familiar 
with clang as C++ compiler, especially installed symbolic links.
Please check configure output and then config.log to find why 
detection(tests) for C++ compiler fail. Also check detection of C complier.
For instance autoconf macro should search for availability of g++ or c++ 
or cxx or CC and etc as C++ compiler commands.

If clang C++ is not in list detection fail.

If clang is default OS compiler is expected symbolic link c++ to clang++ 
or similar. May be some OS setup commands could set such links.



Remark:
At end ./configure --help outputs environment variables .
Those variables could be used to tune build process.
For instance CXX=my-c++ ./configure ... could be used to change C++ 
compiler.



Roumen

___
https://lists.gnu.org/mailman/listinfo/libtool


Re: libtool uses cc to link a mixed C/C++ project and fails to find operator new

2019-06-23 Thread Yuri

On 2019-06-23 12:19, Roumen Petrov wrote:



cc ?

I'm not sure which compiler suite is used on FreeBSD but it seems to 
me C++ compiler is not installed.



clang8 is used. cc is a C compiler, c++ is a C++ compiler.


Yuri


___
https://lists.gnu.org/mailman/listinfo/libtool


Re: libtool uses cc to link a mixed C/C++ project and fails to find operator new

2019-06-23 Thread Roumen Petrov

Yuri wrote:

On FreeBSD libtool can't find operator new[] because it is in C mode:

libtool: link: cc -fno-strict-aliasing -fopenmp -ftree-vectorize 
-pthread -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong 
-fno-strict-aliasing -fno-strict-aliasing -fstack-protector-strong -o 
RNALfold RNALfold_cmdl.o RNALfold.o 
../../src/ViennaRNA/.libs/libRNA_conv.a ./.libs/libhelpers.a -lm 
-pthread -fopenmp
libtool: link: cc -fno-strict-aliasing -fopenmp -ftree-vectorize 
-pthread -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong 
-fno-strict-aliasing -fno-strict-aliasing -fstack-protector-strong -o 
RNALalifold RNALalifold_cmdl.o RNALalifold.o  
../../src/ViennaRNA/.libs/libRNA_conv.a ./.libs/libhelpers.a -lm 
-pthread -fopenmp

ld: error: undefined symbol: operator new[](unsigned long)
>>> referenced by svm.cpp
>>>   svm.o:(Kernel::Kernel(int, svm_node* const*, 
svm_parameter const&)) in archive ../../src/ViennaRNA/.libs/libRNA_conv.a



cc ?

I'm not sure which compiler suite is used on FreeBSD but it seems to me 
C++ compiler is not installed.


Roumen

___
https://lists.gnu.org/mailman/listinfo/libtool


Re: libtool uses cc to link a mixed C/C++ project and fails to find operator new

2019-06-23 Thread Yuri

On 2019-06-23 12:06, Bob Friesenhahn wrote:


Are you using expected file extensions for C++ code?  Is your main 
program a C++ module or a C module? 



C++ code uses .cpp extension.

main programs are all in .c files.


Yuri



___
https://lists.gnu.org/mailman/listinfo/libtool


Re: libtool uses cc to link a mixed C/C++ project and fails to find operator new

2019-06-23 Thread Bob Friesenhahn

On Sun, 23 Jun 2019, Yuri wrote:


On FreeBSD libtool can't find operator new[] because it is in C mode:

How to switch libtool to the C++ mode?


Are you using expected file extensions for C++ code?  Is your main 
program a C++ module or a C module?


Bob
--
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,http://www.GraphicsMagick.org/
Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt

___
https://lists.gnu.org/mailman/listinfo/libtool


libtool uses cc to link a mixed C/C++ project and fails to find operator new

2019-06-23 Thread Yuri

On FreeBSD libtool can't find operator new[] because it is in C mode:

libtool: link: cc -fno-strict-aliasing -fopenmp -ftree-vectorize 
-pthread -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong 
-fno-strict-aliasing -fno-strict-aliasing -fstack-protector-strong -o 
RNALfold RNALfold_cmdl.o RNALfold.o 
../../src/ViennaRNA/.libs/libRNA_conv.a ./.libs/libhelpers.a -lm 
-pthread -fopenmp
libtool: link: cc -fno-strict-aliasing -fopenmp -ftree-vectorize 
-pthread -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong 
-fno-strict-aliasing -fno-strict-aliasing -fstack-protector-strong -o 
RNALalifold RNALalifold_cmdl.o RNALalifold.o  
../../src/ViennaRNA/.libs/libRNA_conv.a ./.libs/libhelpers.a -lm 
-pthread -fopenmp

ld: error: undefined symbol: operator new[](unsigned long)
>>> referenced by svm.cpp
>>>   svm.o:(Kernel::Kernel(int, svm_node* const*, 
svm_parameter const&)) in archive ../../src/ViennaRNA/.libs/libRNA_conv.a




I added "LT_LANG([C++]) to configure.ac but it didn't help:

AC_PROG_LIBTOOL
LT_INIT([pic-only, static])
LT_LANG([C++])
AC_SUBST(LIBTOOL_DEPS)


How to switch libtool to the C++ mode?


The source tarball: 
https://www.tbi.univie.ac.at/RNA/download/sourcecode/2_4_x/ViennaRNA-2.4.13.tar.gz



Thank you,

Yuri


___
https://lists.gnu.org/mailman/listinfo/libtool