Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault #25

Closed
svigerske opened this issue Jan 28, 2019 · 13 comments
Closed

Segmentation fault #25

svigerske opened this issue Jan 28, 2019 · 13 comments
Labels

Comments

@svigerske
Copy link
Member

Issue created by migration from Trac.

Original creator: Armand

Original creation time: 2006-12-22 10:16:31

Assignee: ipopt-team

Version: 3.2

Hi,

I installed IPOPT 3.2.3. (under Linux). The test fails with AMPL: "segmentation fault". I do not have futher explananation and I do not know how to do now. See the config.log file in attachnment.

I also intalled the same version on an another computer under Linux and it works fine.

Thanks for your help,
Paul Armand

@svigerske
Copy link
Member Author

Attachment config.log by Armand created at 2006-12-22 10:17:08

config.log

@svigerske
Copy link
Member Author

Comment by @andrea5w created at 2006-12-22 16:43:31

Hi Paul,

In the config.log file I noticed that the gcc and g++ compilers are from GCC 4.0.1, but that f77 is from GCC 3.3.6. This might give problems with the runtime libraries.

I suggest to try what happens if you use compilers that are from the same GCC version; maybe your 'g77' executable is already like that, so that just setting 'F77=g77' as configure argument would already fix the problem.

If the problem still occurs with consistent compilers, I would ask you to do a 'make install', so that there will be an 'ipopt' executable in the bin subdirectory. Please see if the segmentation fault also happens if you ran this ipopt executable with some .nl file (like the one in CoinIpopt/Ipopt/test/mytoy.nl). If it also crashes, please open this 'ipopt' with the debugger (gdb), and run it with the .nl file as argument ('run mytoy.nl'). Once it crashes there, please type 'where' and copy the output into a this ticket (into the description box).

Thanks!

Andreas

@svigerske
Copy link
Member Author

Comment by @andrea5w created at 2006-12-22 16:43:31

Changing assignee from ipopt-team to @andrea5w.

@svigerske
Copy link
Member Author

Comment by @andrea5w created at 2006-12-22 16:43:31

Changing severity from blocker to major.

@svigerske svigerske added major and removed blocker labels Jan 28, 2019
@svigerske
Copy link
Member Author

Comment by @andrea5w created at 2006-12-22 16:43:31

Changing status from new to assigned.

@svigerske
Copy link
Member Author

Comment by Armand created at 2006-12-23 07:41:10

Replying to [comment:1 andreasw]:

Hi Paul,

In the config.log file I noticed that the gcc and g++ compilers are from GCC 4.0.1, but that f77 is from GCC 3.3.6. This might give problems with the runtime libraries.

I suggest to try what happens if you use compilers that are from the same GCC version; maybe your 'g77' executable is already like that, so that just setting 'F77=g77' as configure argument would already fix the problem.

The problem still occurs.

If the problem still occurs with consistent compilers, I would ask you to do a 'make install', so that there will be an 'ipopt' executable in the bin subdirectory. Please see if the segmentation fault also happens if you ran this ipopt executable with some .nl file (like the one in CoinIpopt/Ipopt/test/mytoy.nl). If it also crashes, please open this 'ipopt' with the debugger (gdb), and run it with the .nl file as argument ('run mytoy.nl'). Once it crashes there, please type 'where' and copy the output into a this ticket (into the description box).

Program received signal SIGSEGV, Segmentation fault.

0xb7af3d7c in memcpy () from /lib/tls/libc.so.6

(gdb) where

#0 0xb7af3d7c in memcpy () from /lib/tls/libc.so.6

#1 0xb7c66356 in std::string::_M_replace_safe<__gnu_cxx::__normal_iterator<char*, std::string> > () from /usr/lib/libstdc++.so.5

#2 0xb7c63740 in std::string::append () from /usr/lib/libstdc++.so.5

#3 0x08053caf in std::operator+<char, std::char_traits, std::allocator > ()

#4 0xb7d614dd in Ipopt::AlgorithmBuilder::BuildBasicAlgorithm () from /home/armand/num/ipopt/CoinIpopt/lib/libipopt.so.0

#5 0xb7d17304 in Ipopt::IpoptApplication::OptimizeNLP () from /home/armand/num/ipopt/CoinIpopt/lib/libipopt.so.0

#6 0xb7d17ac8 in Ipopt::IpoptApplication::OptimizeTNLP () from /home/armand/num/ipopt/CoinIpopt/lib/libipopt.so.0

#7 0x0804bb07 in main ()

Many thanks for your help.
Paul

@svigerske
Copy link
Member Author

Comment by Armand created at 2006-12-29 14:54:57

Hi Andreas,

I updated my linux system Mandriva 2006 -> Mandriva 2007.
Now every thing is right, IPOPT works well with AMPL.

Except that I need to call ipopt from Matlab with the Matlab command 'unix'.
It seems that there is a problem with a librairy.

unix('ipopt-ampl mytoy.nl')
ipopt-ampl: /usr/local/src/matlab73/sys/os/glnx86/libstdc++.so.6: version `CXXABI_1.3.1' not found (required by /home/armand/num/ipopt/CoinIpopt/lib/libipopt.so.0)

Am I missing some configure option ?
Paul

@svigerske
Copy link
Member Author

Comment by @andrea5w created at 2006-12-31 17:27:33

Hi Paul,

The problem with the incompatible shared libraries might be that the environment set up in Matlabs 'unix' shell is different from what you usually have in your shell. Maybe some environment variables are set differently, so that the loader has a different search path for shared libraries when it is trying to run the ipopt executable.

One thing that might work is to compile your ipopt executable as a completely static executable. In the Bonmin project, there has been some discussion on that, see:

http://list.coin-or.org/pipermail/bonmin/2006-August/000007.html

I'm trying this right now, and if it works, I will send a posting to the Ipopt mailing list.

Thanks for not giving up yet :)

A Happy New Year!

Andreas

@svigerske
Copy link
Member Author

Comment by @andrea5w created at 2006-12-31 20:26:37

Hi again (in the old year, at least in the US...)

I was able to build a non-dynamic ipopt executable, and I would think it would work for you from Matlab. However, unfortunlately, I had to do some "hacking" in order to make it work, since the GNU libtool doesn't seem to do the right thing all the time.

Here is what I did:

  1. I set the environment variables AM_LDFLAGS to "-all-static" (e.g., with export AM_LDFLAGS=-all-static in the bash shell).
  2. With a brand-new version (or after 'make distclean'), I configured, using the following options
configure ADD_CXXFLAGS=-static ADD_FFLAGS=-static ADD_CFLAGS=-static --disable-shared
  1. Ran make install. This will fail when trying to link the ipopt executable (at least it did on my Linux machine). The error message in my case said something like "cannot find -lgcc_s"
  2. Change into the subdirectory, where the ipopt executable is built
cd Ipopt/src/Apps/AmplSolver
  1. Copy and paste the link command that failed during make (this starts with the C++ compiler name and goes over several lines) into the command line and hit ENTER; this should give the same error message as before.
  2. Repeat the last step, but now edit the line to delete the reference to the library that it complained about (-lgcc_s in my case), and also replace all *.so files by the "-l" reference (e.g., something like /usr/lib/libg2c.so becomes -lg2c).
  3. This worked for me, and the new ipopt executable should work. (There is a warning message regarding 'dlopen', but you can ignore that.)
  4. If you try ldd ipopt it should now say "not a dynamic executable". You can now take this executable and put it where you want it to be.

Hopefully this works also for you (I assume here that you are still using Linux).

@svigerske
Copy link
Member Author

Comment by @andrea5w created at 2007-01-17 19:04:55

Changing severity from major to minor.

@svigerske svigerske added minor and removed major labels Jan 28, 2019
@svigerske
Copy link
Member Author

Comment by Armand created at 2007-01-18 07:57:04

Dear Andreas,

I tried what you did on my laptop, but it does not work.
But I think that I found the trouble.

In my directory

/usr/local/src/matlab73/sys/os/glnx86

I modified the link

libstdc++.so.6 -> libstdc++.so.6.0.3*

to

libstdc++.so.6 -> /usr/lib/libstdc++.so.6.0.8*

That's all and that works now !

Thank's a lot for your help and sorry for my ignorance of the
mysteries of c++-lib.

Paul

@svigerske
Copy link
Member Author

Comment by @andrea5w created at 2007-01-18 14:52:50

Hi Paul,

Great, I'm glad you got it to work. I also easily get confused about all those differences with the C++ shared libraries...

I'm closing the ticket now.

Cheers!

Andreas

@svigerske
Copy link
Member Author

Comment by @andrea5w created at 2007-01-18 14:52:50

Resolution: fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant