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

Followed build and install instruction but failed to compile sample elsewhere. #372

Open
1 of 3 tasks
fhvirus opened this issue Sep 22, 2023 · 2 comments
Open
1 of 3 tasks

Comments

@fhvirus
Copy link

fhvirus commented Sep 22, 2023

Bug category
Installation issues.

Describe the bug
I followed build and install instruction, but when compiling an example manually (not with cmake, it failes to link and gives following error for each function I use from matplot++:

/usr/bin/ld: /tmp/ccqhfOPZ.o: in function `main':
t.cpp:(.text+0x3c): undefined reference to `matplot::linspace(double, double)'
collect2: error: ld returned 1 exit status

Steps to Reproduce

Following Build and install guide for Ubuntu + GCC.

Output

There is no .cpp files under /usr/local/include/matplot.

Installed files:

-- Install configuration: "Release"
-- Installing: /usr/local/lib/Matplot++/libnodesoup.a
-- Installing: /usr/local/include/matplot/detail/exports.h
-- Installing: /usr/local/lib/libmatplot.a
-- Up-to-date: /usr/local/include/matplot
-- Up-to-date: /usr/local/include/matplot/backend
-- Installing: /usr/local/include/matplot/backend/opengl_embed.h
-- Installing: /usr/local/include/matplot/backend/backend_interface.h
-- Installing: /usr/local/include/matplot/backend/opengl.h
-- Installing: /usr/local/include/matplot/backend/backend_registry.h
-- Installing: /usr/local/include/matplot/backend/gnuplot.h
-- Up-to-date: /usr/local/include/matplot/util
-- Installing: /usr/local/include/matplot/util/geodata.h
-- Installing: /usr/local/include/matplot/util/popen.h
-- Installing: /usr/local/include/matplot/util/type_traits.h
-- Installing: /usr/local/include/matplot/util/common.h
-- Installing: /usr/local/include/matplot/util/contourc.h
-- Installing: /usr/local/include/matplot/util/handle_types.h
-- Installing: /usr/local/include/matplot/util/keywords.h
-- Installing: /usr/local/include/matplot/util/concepts.h
-- Installing: /usr/local/include/matplot/util/colors.h
-- Up-to-date: /usr/local/include/matplot/freestanding
-- Installing: /usr/local/include/matplot/freestanding/figure_functions.h
-- Installing: /usr/local/include/matplot/freestanding/axes_lim.h
-- Installing: /usr/local/include/matplot/freestanding/plot.h
-- Installing: /usr/local/include/matplot/freestanding/histcounts.h
-- Installing: /usr/local/include/matplot/freestanding/axes_functions.h
-- Up-to-date: /usr/local/include/matplot/core
-- Installing: /usr/local/include/matplot/core/axis_type.h
-- Installing: /usr/local/include/matplot/core/legend.h
-- Installing: /usr/local/include/matplot/core/figure_registry.h
-- Installing: /usr/local/include/matplot/core/axes_type.h
-- Installing: /usr/local/include/matplot/core/line_spec.h
-- Installing: /usr/local/include/matplot/core/figure_type.h
-- Installing: /usr/local/include/matplot/core/axes_object.h
-- Up-to-date: /usr/local/include/matplot/detail
-- Installing: /usr/local/include/matplot/detail/config.h
-- Installing: /usr/local/include/matplot/matplot.h
-- Up-to-date: /usr/local/include/matplot/axes_objects
-- Installing: /usr/local/include/matplot/axes_objects/bars.h
-- Installing: /usr/local/include/matplot/axes_objects/surface.h
-- Installing: /usr/local/include/matplot/axes_objects/stair.h
-- Installing: /usr/local/include/matplot/axes_objects/box_chart.h
-- Installing: /usr/local/include/matplot/axes_objects/circles.h
-- Installing: /usr/local/include/matplot/axes_objects/line.h
-- Installing: /usr/local/include/matplot/axes_objects/function_line.h
-- Installing: /usr/local/include/matplot/axes_objects/parallel_lines.h
-- Installing: /usr/local/include/matplot/axes_objects/labels.h
-- Installing: /usr/local/include/matplot/axes_objects/vectors.h
-- Installing: /usr/local/include/matplot/axes_objects/contours.h
-- Installing: /usr/local/include/matplot/axes_objects/filled_area.h
-- Installing: /usr/local/include/matplot/axes_objects/network.h
-- Installing: /usr/local/include/matplot/axes_objects/string_function.h
-- Installing: /usr/local/include/matplot/axes_objects/histogram.h
-- Installing: /usr/local/include/matplot/axes_objects/matrix.h
-- Installing: /usr/local/include/matplot/axes_objects/error_bar.h
-- Installing: /usr/local/lib/cmake/Matplot++/Matplot++Targets.cmake
-- Installing: /usr/local/lib/cmake/Matplot++/Matplot++Targets-release.cmake
-- Installing: /usr/local/lib/cmake/Matplot++/Matplot++ConfigVersion.cmake
-- Installing: /usr/local/lib/cmake/Matplot++/Matplot++Config.cmake

Platform

  • cross-platform issue - linux
  • cross-platform issue - windows
  • cross-platform issue - macos

Environment Details:

  • OS: Kubuntu
  • OS Version: 22.04.3
  • Compiler: g++
  • Compiler version: GNU C++17 (Ubuntu 11.4.0-1ubuntu1~22.04) version 11.4.0 (x86_64-linux-gnu)
@fhvirus fhvirus changed the title Following build and install instruction does not install .cpp files. Followed build and install instruction but failed to compile sample elsewhere. Sep 23, 2023
@alandefreitas
Copy link
Owner

not with cmake

The instructions use cmake to link the libraries. By not using cmake, you have the responsibility to do all the linking the cmake scripts do by yourself. Simply not linking it won't work.

@ak-ferhat
Copy link

ak-ferhat commented Nov 22, 2023

I had the same problem on Almalinux 8.8. Here is what I did.

Suppose the libmatplot.a (libmatplot.so) library is in "/matplot1.2.0/lib64" folder

1- For compiling you example (main.cpp), you have to specify all the required libraries, and the path to "matplotlib.a":

g++ -std=c++17 -L/matplot1.2.0/lib64 -lmatplot -lstdc++fs -lpng -ljpeg -ltiff -llapack -lblas -lfftw3 -lpthread -lz main.cpp -o myoutfile

Notice -L/matplot1.2.0/lib64 to specify the path

2- For launching Now you have to specify the path to the library for launch your example (myoutfile). You may have the same problem if you test the examples which come the package.

eport LD_LIBRARY_PATH=/matplot1.2.0/lib64:$LD_LIBRARY_PATH
./myoutfile

This works for me.

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

No branches or pull requests

3 participants