C/C++ cmake调用(嵌入)Julia Plots,弹不出绘图窗口

Ubuntu18.04,想试一下手册“嵌入Julia”一章中的例子:
https://docs.juliacn.com/latest/manual/embedding/#高级别嵌入-1

用gcc编译、链接成功,但是运行出错:

hl@hl-MACHR-WX9:~/Julia/ccallJulia/build$ export JULIA_DIR="/home/hl/julia-1.3.0-rc1"
hl@hl-MACHR-WX9:~/Julia/ccallJulia$ gcc -o HelloJulia -fPIC -I$JULIA_DIR/include/julia -L$JULIA_DIR/lib callJulia.c -ljulia $JULIA_DIR/lib/julia/libstdc++.so.6
hl@hl-MACHR-WX9:~/Julia/ccallJulia$ ./HelloJulia 
./HelloJulia: error while loading shared libraries: libjulia.so.1: cannot open shared object file: No such file or directory

用cmake能编译但是链接不过:
hl@hl-MACHR-WX9:~/Julia/ccallJulia/build$ cmake …
正常。但是 make出错了:

hl@hl-MACHR-WX9:~/Julia/ccallJulia/build$ make
-- Configuring done
-- Generating done
-- Build files have been written to: /home/hl/Julia/ccallJulia/build
Scanning dependencies of target HelloJulia
[ 50%] Building CXX object CMakeFiles/HelloJulia.dir/CallJulia.cpp.o
[100%] Linking CXX executable HelloJulia
CMakeFiles/HelloJulia.dir/CallJulia.cpp.o:在函数‘main’中:
/home/hl/Julia/ccallJulia/CallJulia.cpp:10:对‘jl_init__threading’未定义的引用
/home/hl/Julia/ccallJulia/CallJulia.cpp:12:对‘jl_eval_string’未定义的引用
/home/hl/Julia/ccallJulia/CallJulia.cpp:14:对‘jl_atexit_hook’未定义的引用
collect2: error: ld returned 1 exit status
CMakeFiles/HelloJulia.dir/build.make:95: recipe for target 'HelloJulia' failed
make[2]: *** [HelloJulia] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/HelloJulia.dir/all' failed
make[1]: *** [CMakeFiles/HelloJulia.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

CMakeLists.txt 是这么写的:

# 声明要求的 cmake 最低版本
cmake_minimum_required(VERSION 2.8)

# 声明一个 cmake 工程
project(HelloJulia)

# 设置编译模式
set(CMAKE_BUILD_TYPE "Debug")

set(JULIA_INC_DIR "/home/hl/julia-1.3.0-rc1/include/julia")
set(JULIA_LIB_DIR "/home/hl/julia-1.3.0-rc1/lib")
include_directories(${JULIA_INC_DIR})
link_directories(${JULIA_LIB_DIR})

# 添加一个可执行程序
# 语法:add_executable( 程序名 源代码文件 )
add_executable(HelloJulia CallJulia.cpp)

# 将库文件链接到可执行程序上
target_link_libraries(HelloJulia ${JULIA_LIB_DIR}/julia/libstdc++.so.6)

CMakeLists.txt 最后一句改为
target_link_libraries(HelloJulia ${JULIA_LIB_DIR}/julia/libstdc++.so.6 ${JULIA_LIB_DIR}/libjulia.so.1)
cmake 就可以用了,运行成功。
但是 gcc 加上 libjulia.so.1 还是运行还是找不到 libjulia.so.1

会不会要从源代码编译啊

不管gcc了。我是想调用Julia的画图程序,可是弹不出绘图窗口,有办法吗?

// extern "C" {
  #include <julia.h>
// }

// C/C++ 调用 Julia
int main(int argc, char **argv) 
{
  jl_init();

  jl_eval_string("using Plots; x = 1 : 100; p = plot(x, sin.(x)); gui(p)");
  jl_eval_string("println(sqrt(2.0))");
  
  jl_atexit_hook(0);

  return 0;
}

编译运行:

hl@hl-MACHR-WX9:~/Julia/ccallJulia/build$ make
Scanning dependencies of target HelloJulia
[ 50%] Building CXX object CMakeFiles/HelloJulia.dir/CallJulia.cpp.o
[100%] Linking CXX executable HelloJulia
[100%] Built target HelloJulia
hl@hl-MACHR-WX9:~/Julia/ccallJulia/build$ ./HelloJulia 
1.4142135623730951

没看到图……

如果是savefig的话会输出图片吗?