xmake icon indicating copy to clipboard operation
xmake copied to clipboard

Some packages are not properly located and therefore cannot be included

Open ElotonSotilas opened this issue 2 years ago • 2 comments

Xmake Version

2.7.2+202210271121

Operating System Version and Architecture

macOS 13 Ventura arm64

Describe Bug

TOML++ and SDL don't want to get included via #include in my C++ project. However, if I clone the repos from GitHub and make + make install them, they get included without any problem.

By contrast, I can use Boost and PugiXML, but I had them installed beforehand. Is there something wrong in xmake's package management or is there a problem with M1 in general, or is there a PATH problem? Would be nice to know and hope this gets fixed.

Expected Behavior

add_requires() should work as expected. add_package() works fine, but only if I have previously compiled it manually.

Project Configuration

add_rules("mode.debug", "mode.release")

add_requires("boost", {alias = "boost_context", configs = {context = true}})
add_requires("libsdl")
add_requires("pugixml", "toml++")
add_includedirs("/usr/local/include")   -- works without it too

set_optimize("fastest")
set_warnings("all", "error")
set_languages("cxx20")

target("Droplet")
    set_kind    ("static")
    add_files   ("Source/**.cpp")
    add_packages("boost_context", "pugixml", "libsdl", "toml++")
    if is_mode("debug") then 
        add_defines("DEBUG")
    end                             -- Debug mode flagging in the app

then try

#include <SDL2/SDL.h>
#include <toml++/toml.h>

somewhere

Additional Information and Error Logs

https://hastebin.com/usutewimup.typescript

ElotonSotilas avatar Nov 03 '22 13:11 ElotonSotilas

It works for me on my macOS, but it is not M1. I have not M1 to test it.

waruqi avatar Nov 03 '22 14:11 waruqi

Did you check the headers are actually in the /usr/local/include directory? I read more people in different situation have trouble using that linux folder structure in os x. I do know nothing about osx, but it might be a PATH problem from what i read. Tough i would expect if you add the include folder to xmake using -> add_includedirs("/usr/local/include") that xmake should look here anyway, unless it needs root permission. I do not know if xmakes warns you for not having root permissions... So it might be worth it to try xmake -v, maybe it shows a warning?

Anyway you can see if include folder is in PATH just by: echo $PATH

If the include folder does not exist, you can add it to the PATH var, but you might as well change the includedir to any other folder you like.

export PATH=$PATH:/usr/local/include

Also take a good look at this make file you did use, perhaps you can use the same folders...

EsoCoding avatar Feb 10 '23 15:02 EsoCoding