Skip to content

error while loading shared libraries: libcgfam.so: cannot open shared object file: No such file or directory #7

@jmccrae

Description

@jmccrae

I am getting the following error in one of my projects. It seems to be a new issue with more recent version of Cargo.

Steps to reproduce

Create a new project

cargo new rustimization_bug

Add rustimization==0.1.1 as a dependency in Cargo.

Create src/main.rs as follows

extern crate rustimization;                                                     
                                                                                
use rustimization::minimizer::Funcmin;                                          
                                                                                
fn main() {                                                                     
                                                                                
    let f = |x : &Vec<f64>| {                                                   
        0.0f64                                                                  
    };                                                                          
    let g = |x : &Vec<f64>| {                                                   
        vec![0.0f64]                                                            
    };                                                                          
                                                                                
    let mut x = Vec::new();                                                     
    let mut fmin = Funcmin::new(&mut x, &f, &g, "cg");                          
    fmin.max_iteration(10);                                                     
    fmin.minimize();                                                            
                                                                                
    println!("Hello, world!");                                                  
}                                                                               

Build the system with cargo build and the running the executable creates the following error

-> % target/debug/rustimization_bug
target/debug/rustimization_bug: error while loading shared libraries: libcgfam.so: cannot open shared object file: No such file or directory

This works with cargo run

-> % cargo run
warning: unused variable: `x`
 --> src/main.rs:7:14
  |
7 |     let f = |x : &Vec<f64>| {
  |              ^ help: if this is intentional, prefix it with an underscore: `_x`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `x`
  --> src/main.rs:10:14
   |
10 |     let g = |x : &Vec<f64>| {
   |              ^ help: if this is intentional, prefix it with an underscore: `_x`

warning: `rustimization_bug` (bin "rustimization_bug") generated 2 warnings
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `target/debug/rustimization_bug`

 IFLAG= -3
 IMPROPER INPUT PARAMETERS (N IS NOT POSITIVE)
Hello, world!

Environment

-> % lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04 LTS
Release:	22.04
Codename:	jammy
-> % cargo --version
cargo 1.61.0 (a028ae4 2022-04-29)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions