Reason to add empty source file to a STATIC library? - c++

I've seen this quite a lot in C++, that developers add an empty source file to the library in CMake. One example is here, with the empty source file found here.
The CMake file has this line:
# build the library
add_library(${PROJECT_NAME} STATIC src/dependency-tracker.cc)
This is only the case if there are no other source files in the src folder, so the library would be 'header only'. Why do they do this?
The directory structure i was referring to:
.
├── CMakeLists.txt
├── include
│   └── okvis
│   └── kinematics
│   ├── implementation
│   │   └── Transformation.hpp <- header only implementation
│   ├── operators.hpp
│   └── Transformation.hpp
├── src
│   └── dependency-tracker.cc <- empty source file
└── test
├── runTests.cpp
└── TestTransformation.cpp

The project specifies CMake 2.8.11 as a minimal requirement:
cmake_minimum_required(VERSION 2.8.11)
This version lacks for INTERFACE library type, which nowadays is a standard representation of a header-only library. (Support for INTERFACE libraries firstly appeared in CMake 3.0).
Without INTERFACE library available, a normal library with a single empty source file looks like a good alternative.
I don't know why dependency-tracker.cc name choosen for the empty source file. Probably, this name has some special meaning for the project's developers.

Related

How do I import a package from the local filesystem using dub?

I have a project that uses dub. I want to use an external file vendored into my project, as a dependency. How do I do this? I don't want to have it in my project's source/ dir. I don't want to add it as a dub managed dependency, but I do want to be able to just import xxx.
The package is this one: https://github.com/gianm/d-json , it does not use dub or have a dub.json project file.
Alternative thing: make a third_party directory, put the file in there, then add that to the sourcePaths in your dub config (you'll probably specify both ["third_party", "source"] since the default source will be overridden if you don't list it too.
Convert the package to dub by adding a dub.json file in the root, with the following contents: {"name": "jsonx"}. Create a source folder, and move jsonx.d into it.
Put the folder anywhere you want, e.g. top-level next to your own project.
Add the following dependency to your dub.json:
"dependencies": {
...
"jsonx": {"path": "../jsonx/"}
}
You can now import the package anywhere using import jsonx;.
In conclusion, if your app is in a dir called app, your tree should look like this:
.
├── app
│   ├── dub.json
│   └── source
│      └── myapp.d
└── jsonx
├── dub.json
└── source
└── jsonx.d

Can I have source code ouside project folder in xcode?

I just created my first xcode C++ project. Directory structure looks like the following:
myproject
+-xproject
+-xproject
| +-main.cpp
+-xproject.xcodeproj
Let me describe it (not sure if its necessary). The base folder is myproject, everything inside it was created by xcode.
Instead, I would like have main.cpp outside, like the following:
myproject
+-main.cpp
+-xproject
+-xproject.xcodeproj
Is that possible? How can I get things this way?
Why I want that? Because different IDEs offer different benefits (and debugging in qtcreator might be less straightforward than in xcode, How to debug C++ project using Qt Creator?)
Actually xproject.xcodeproj is a folder which contains:
xproject/xproject.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│   ├── contents.xcworkspacedata
│   ├── xcshareddata
│   │   └── IDEWorkspaceChecks.plist
│   └── xcuserdata
│   └── user.xcuserdatad
│   └── UserInterfaceState.xcuserstate
└── xcuserdata
└── user.xcuserdatad
└── xcschemes
└── xcschememanagement.plist
What I tried (looks like Eljay approach): Open project on xcode, remove xproject/main.cpp and then add myproject/main.cpp. Hit play button and it says build succedded. But also says:
Could not launch "xproject"
LLDB provided no error string.
When I click details I get:
Domain: IDEDebugSessionErrorDomain
Code: 3
Failure Reason: LLDB provided no error string.
User Info: {
DVTRadarComponentKey = 855031;
RawLLDBErrorMessage = "LLDB provided no error string.";
}
ln -s xproject/main.cpp main.cpp
Although I don't like this solution because the original file have to be inside xcode project.
I tried the oposite, but then xcode refuses to work.

Problems when linking my main output library with my test executable

I'm building a "framework" library which one I'm trying to integrate Google Tests. It's a pretty small library, that at the end gives me a .so or .dll file.
When I was starting to tests my library, I found a configuration (details below) that works fine on my CMakeFile at my linux environment. But when I try to run the same project using a MSBuild for MSVC14, it gives me a link error
LINK : fatal error LNK1104: cannot open file '..\src\Debug\foobar.lib'
I'm thinking that my cmake is guessing the lib name wrong (foobar.lib instead of foobar.dll), but I couldn't find why nor how to fix it.
Also, I don't know if this is really the best way for me testing this. What I want is a way to test the whole framework (initializing, creating stuffs, checking returns etc..) without a main.cpp file, and meanwhile start to create the unit tests.
So, my question is.. What am I doing wrong that at the Windows environment the linker does not find the foobar lib built by src/CMakeLists.txt? (I checked, and the lib is created in "src/Debug/foobar.dll", same dir that appears at the error, and works fine)
Also, is my method so wrong that windows just don't wanna deal with? lol I mean, it's wrong to do something like I'm trying to do? It's not that I do not want to make unit tests, which I'll be doing soon, but I really like to build and try my lib without using any external exec binary before I starting to do that.
Thanks!
OBS:
My google tests is working fine both in linux and windows;
I can run the test FooA if I remove the FooBar test, which is linking to foobar lib.
Using my linux environment this configuration works perfectly.
Update:
As #vre suggested, I found the macro __declspec(dllexport) and put it before my FooBar class name and the compilation passed, but it crashes when I run and throws this warning when compiling:
warning C4251: 'FooBar::_impl': class 'std::unique_ptr<FooBar::FooBarImpl,
std::default_delete<_Ty>>' needs to have dll-interface to be used by clients of class 'FooBar'
That's because I have a PImp implementation of the FooBar class. So, I have this:
class __declspec(dllexport) FooBar
{
...
private:
class FooBarImpl;
std::unique_ptr<FooBarImpl> _impl;
}
I don't really know what it means yet. Trying to find out why it crashes.
My project has this file tree:
├── CMakeLists.txt
├── include
| ├── FooBar.hpp
├── src
│   ├── CMakeLists.txt
│   ├── FooBar.cpp
│   ├── FooA
│   │   └── CMakeLists.txt
│   ├── FooB
│   │   └── CMakeLists.txt
│   └── FooC
│   └── CMakeLists.txt
└── test
├── CMakeLists.txt
├── FooBar
│   └── FooBarTest.hpp
├── FooA
│   ├── FakeBar.hpp
│   ├── FooATest.hpp
│   └── mockObj.hpp
My main CMakeLists.txt is like this:
...
set(FOOBAR_INCLUDE "${PROJECT_SOURCE_DIR}/include/FooBar.hpp")
# Include src main CMakeLists
add_subdirectory("${PROJECT_SOURCE_DIR}/src")
# Include tests if enabled
if (test)
add_subdirectory("${PROJECT_SOURCE_DIR}/test")
endif ()
My src/CMakeLists.txt:
...
set(FOOBAR_SOURCES "FooBar.cpp")
# Build
add_library(foobar SHARED ${FOOBAR_SOURCES} ${FOOBAR_INCLUDE})
# Links the library with components.
target_link_libraries(foobar FooA FooB FooC)
And my test/CMakeLists.txt is something like this:
enable_testing()
# Include directories used for testing.
include_directories("${CMAKE_SOURCE_DIR}/src"
"${CMAKE_SOURCE_DIR}/include"
"FooA/"
"FooBar/")
# Include the files for testing.
set(INCLUDE_TESTS "${CMAKE_SOURCE_DIR}/src/FooA/FooA.cpp"
"${CMAKE_SOURCE_DIR}/src/FooA/Bar.cpp")
# Include the test source files.
set(TEST_SOURCES "main.cpp"
"FooBar/JepluTest.hpp"
"FooA/FakeBar.hpp"
"FooA/FooATest.hpp")
# Build
add_executable(foobar-test ${TEST_SOURCES} ${INCLUDE_TESTS})
# Links the library with components. (HERE IS WHERE OCCURS THE PROBLEM)
target_link_libraries(foobar-test gtest foobar)
# Not really important right now
add_test(NAME foobar-test COMMAND foobar-test)
Reformulating and enhancing my previous comments:
You need to export symbols from the DLL on Windows otherwise no import library is created, and that's what MSBuild is complaining about.
First you should add to your FooBar.hpp header the following construct:
#ifdef WIN32
#ifdef FOOBARLIB_EXPORTS
#define FOOBARLIB_API __declspec(dllexport)
#else
#define FOOBARLIB_API __declspec(dllimport)
#endif
#else
#define FOOBARLIB_API
#endif
Later mark your classes, functions and symbols to be exported as follows:
void FOOBARLIB_API foobar(char*)
{
}
In your CMakeLists.txt after creating the shared library target foobar add the line:
target_compile_definitions(foobar PRIVATE FOOBARLIB_EXPORTS)
EDIT:
As #vre commented, these CMake properties are also needed because Windows does not load a DLL located in another folder, causing a crash when it tries to run the executable. So, when a DLL is build and the CMAKE_RUNTIME_OUTPUT_DIRECTORY variable is set, the output library goes to the same directory as the test .exe file.
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

local socket = require("socket"), module 'socket' not found

Im using Lua with C++ in a project in Visual Studio 2015. I have used Luarocks to create socket/core.dll and mime/core.dll. I have added the core.dll to the debug folder where my C++ program executes. The error I get in lua is generated when "require("socket")" executes. The following error is what I get:
...s\Visual Studio 2015\Projects\RaceGame3\Debug\Client.lua:17: module
'socket' not found:
no field package.preload['socket']
no file 'C:\Users\Username\Documents\Visual Studio
2015\Projects\RaceGame3\Debug\lua\socket.lua'
no file 'C:\Users\Username\Documents\Visual Studio 2015\Projects\RaceGame3\Debug\lua\socket\init.lua'
no file 'C:\Users\Username\Documents\Visual Studio 2015\Projects\RaceGame3\Debug\socket.lua'
no file 'C:\Users\Username\Documents\Visual Studio 2015\Projects\RaceGame3\Debug\socket\init.lua'
no file 'C:\Users\Username\Documents\Visual Studio 2015\Projects\RaceGame3\Debug\..\share\lua\5.3\socket.lua'
no file 'C:\Users\Username\Documents\Visual Studio 2015\Projects\RaceGame3\Debug\..\share\lua\5.3\socket\init.lua'
no file '.\socket.lua'
no file '.\socket\init.lua'
no file 'C:\Users\Username\Documents\Visual Studio 2015\Projects\RaceGame3\Debug\socket.dll'
no file 'C:\Users\Username\Documents\Visual Studio 2015\Projects\RaceGame3\Debug\..\lib\lua\5.3\socket.dll'
no file 'C:\Users\Username\Documents\Visual Studio 2015\Projects\RaceGame3\Debug\loadall.dll'
no file '.\socket.dll'
So to sum up: How do I correctly link the core.dll or other luasocket files to my current Lua instance while running the C++ project?
I've solved a similar issue by changing the require to:
require("socket.core")
That only works, of course, if you have the core.dll inside a folder named socket that can be found locally or in your PATH / package.cpath, etc..
You could also rename core.dll to socket.dll (and place it in a searchable folder).
The problem, as far as I know, is: the required name and the actual dll name simply doesn't match.
edit: To play safe, I've put the lua modules and the dll together, locally, like this:
socket
├── core.dll
├── ltn12.lua
├── mime.lua
├── mime-1.0.3.dll
├── socket
│   ├── ftp.lua
│   ├── headers.lua
│   ├── http.lua
│   ├── smtp.lua
│   ├── tp.lua
│   └── url.lua
└── socket.lua
You were in a very similar situation to me. In my case, I required socket.http in sample.lua,
require("socket.http")
content, status, header = socket.http.request("http://website.com/aaa.php")
and have met the following error message:
...\MyProject\Release\sample.lua:1: module 'socket.http' not found:
no field package.preload['socket.http']
no file '.\socket\http.lua'
(...)
I've addressed this issue by putting some necessary lua scripts and dll files in the path where a sample executable is located.
Release
├── socket
│ ├── ftp.lua
│ ├── http.lua
│ ├── smtp.lua
│ ├── tp.lua
│ └── url.lua
├── mime
│ └── core.dll
├── ltn12.lua
├── mime.lua
├── socket.dll <--- renamed from $(LUA_PATH)\clibs\socket\core.dll
├── socket.lua
├── lua5.1.dll
├── sample.exe
└── sample.lua
The cpp code is as follows:
#pragma comment(lib, "lua5.1.lib")
#include <lua.hpp>
void main() {
lua_State *L = luaL_newstate();
luaL_openlibs(L);
luaL_dofile(L, "sample.lua");
lua_close(L);
}

Leiningen can't locate local dependency

I'm having problems using a local version of a library which I don't want to push up to Clojars to test and find out it's broken. I appreciate this is a common problem for lots of devs new to Clojure and Leiningen. I've followed the steps provided by others and it still doesn't work.
In summary:
I've tried lein pom/jar/install, as well as the checkout feature (where you symlink your other project). I think there is a source-paths option I could try, but I'm not sure how that works. I also thought about trying to modify the lein classpath but I'm not sure if that's possible?
For those of you who prefer much more detail...
I have two Leiningen projects:
https://github.com/Integralist/spurious-clojure-aws-sdk-helper
https://github.com/Integralist/spurious-clojure-example
The idea is that the second project "spurious-clojure-example" should use the first "spurious-clojure-aws-sdk-helper" as a dev dependency (as it's a library you use while local dev'ing against faked AWS resources; so no need to use it in a production environment).
The "spurious-clojure-example" project.clj file looks like...
(defproject spurious-clojure-example "0.1.0"
:description "This is an example application that utilises the Spurious Clojure AWS SDK Helper"
:url "https://github.com/integralist/spurious-clojure-example"
:dependencies [[org.clojure/clojure "1.6.0"]
[compojure "1.1.6"]
[hiccup "1.0.5"]
[ring-server "0.3.1"]
[amazonica "0.3.13"]
[environ "1.0.0"]]
:plugins [[lein-ring "0.8.12"]
[lein-environ "1.0.0"]]
:ring {:handler spurious-clojure-example.handler/app
:init spurious-clojure-example.handler/init
:destroy spurious-clojure-example.handler/destroy}
:profiles
{:uberjar {:aot :all}
:production
{:ring
{:open-browser? false, :stacktraces? false, :auto-reload? false}}
:dev
{:dependencies [[ring-mock "0.1.5"]
[ring/ring-devel "1.3.1"]
[spurious-aws-sdk-helper "0.1.0"]]}})
Notice I've put [spurious-aws-sdk-helper "0.1.0"] into :dev {:dependencies}.
The way the "spurious-clojure-aws-sdk-helper" code gets loaded is like so:
(if (env :debug) ; defined in profiles.clj
(do
(require '[spurious-aws-sdk-helper.core :as core])
(...other stuff...)))
The first thing I tried within my "spurious-aws-sdk-helper" project was...
lein pom
lein jar
lein install
...as I was told this would install "spurious-aws-sdk-helper" into the local directory ~/.m2 which Leiningen would look at first as a local cache of remote dependencies.
tree ~/.m2 | grep spurious
├── spurious-aws-sdk-helper
│   └── spurious-aws-sdk-helper
│   │   ├── spurious-aws-sdk-helper-0.1.0.jar
│   │   └── spurious-aws-sdk-helper-0.1.0.pom
│   │   ├── spurious-aws-sdk-helper-0.1.0-SNAPSHOT.jar
│   │   └── spurious-aws-sdk-helper-0.1.0-SNAPSHOT.pom
├── spurious-clojure-example
│   └── spurious-clojure-example
│   │   ├── spurious-clojure-example-0.1.0-SNAPSHOT.jar
│   │   └── spurious-clojure-example-0.1.0-SNAPSHOT.pom
This didn't work. When I connect my Vim editor to an nREPL and try to evaluate the require call to the library it would say it couldn't find the namespace.
I then tried doing the same lein pom/jar/install process for my "spurious-clojure-example" project (just in case there was some strange reason both projects needed to be locally installed). Again, no difference either, but i wasn't expected this to do anything really.
I then tried renaming my projects to remove the -SNAPSHOT from the version number (in case that made Leiningen think the dependency couldn't be used - nonsense I know, but I was clutching at straws).
I moved onto trying out the checkout feature (https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md#checkout-dependencies) and when I evaluated the require call, that would pass through (e.g. no errors) but then one of the dependencies used by "spurious-aws-sdk-helper" would fail to load (i.e. org.clojure/data.json).
As a temporary measure I decided to add org.clojure/data.json to my "spurious-clojure-example" dependencies. So when evaluating the code again in the REPL, it this time got past the first two namespace errors but then it again errored because the spurious-aws-sdk-helper.s3 namespace couldn't be found :-/
At this point I realised I must be missing something really obvious, because it should not be this hard to test a library locally on your computer.
Could someone help me to resolve this problem.
Many thanks!
UPDATE: here is the result of lein classpath for "spurious-clojure-example"...
/Users/markmcdonnell/Code/spurious-clojure-example/test
/Users/markmcdonnell/Code/spurious-clojure-example/src
/Users/markmcdonnell/Code/spurious-clojure-example/dev-resources
/Users/markmcdonnell/Code/spurious-clojure-example/resources
/Users/markmcdonnell/Code/spurious-clojure-example/target/classes
/Users/markmcdonnell/.m2/repository/ns-tracker/ns-tracker/0.2.1/ns-tracker-0.2.1.jar
/Users/markmcdonnell/.m2/repository/org/clojure/tools.macro/0.1.0/tools.macro-0.1.0.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-sqs/1.9.13/aws-java-sdk-sqs-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-s3/1.9.13/aws-java-sdk-s3-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-dynamodb/1.9.13/aws-java-sdk-dynamodb-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-swf-libraries/1.9.13/aws-java-sdk-swf-libraries-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/clojure/algo.generic/0.1.2/algo.generic-0.1.2.jar
/Users/markmcdonnell/.m2/repository/org/clojure/java.classpath/0.2.0/java.classpath-0.2.0.jar
/Users/markmcdonnell/.m2/repository/watchtower/watchtower/0.1.1/watchtower-0.1.1.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-config/1.9.13/aws-java-sdk-config-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-redshift/1.9.13/aws-java-sdk-redshift-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar
/Users/markmcdonnell/.m2/repository/clojure-complete/clojure-complete/0.2.3/clojure-complete-0.2.3.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-glacier/1.9.13/aws-java-sdk-glacier-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk/1.9.13/aws-java-sdk-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-directconnect/1.9.13/aws-java-sdk-directconnect-1.9.13.jar
/Users/markmcdonnell/.m2/repository/ring/ring-codec/1.0.0/ring-codec-1.0.0.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-server/7.6.8.v20121106/jetty-server-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/joda-time/joda-time/2.2/joda-time-2.2.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-ec2/1.9.13/aws-java-sdk-ec2-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-continuation/7.6.8.v20121106/jetty-continuation-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-lambda/1.9.13/aws-java-sdk-lambda-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-storagegateway/1.9.13/aws-java-sdk-storagegateway-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-ses/1.9.13/aws-java-sdk-ses-1.9.13.jar
/Users/markmcdonnell/.m2/repository/clj-stacktrace/clj-stacktrace/0.2.5/clj-stacktrace-0.2.5.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-opsworks/1.9.13/aws-java-sdk-opsworks-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-core/1.9.13/aws-java-sdk-core-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-util/7.6.8.v20121106/jetty-util-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/ring/ring-servlet/1.2.1/ring-servlet-1.2.1.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-simpleworkflow/1.9.13/aws-java-sdk-simpleworkflow-1.9.13.jar
/Users/markmcdonnell/.m2/repository/clj-time/clj-time/0.4.4/clj-time-0.4.4.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-logs/1.9.13/aws-java-sdk-logs-1.9.13.jar
/Users/markmcdonnell/.m2/repository/robert/hooke/1.3.0/hooke-1.3.0.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudsearch/1.9.13/aws-java-sdk-cloudsearch-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-simpledb/1.9.13/aws-java-sdk-simpledb-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudfront/1.9.13/aws-java-sdk-cloudfront-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-sts/1.9.13/aws-java-sdk-sts-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-codedeploy/1.9.13/aws-java-sdk-codedeploy-1.9.13.jar
/Users/markmcdonnell/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-kinesis/1.9.13/aws-java-sdk-kinesis-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-autoscaling/1.9.13/aws-java-sdk-autoscaling-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/amazon-kinesis-client/1.1.0/amazon-kinesis-client-1.1.0.jar
/Users/markmcdonnell/.m2/repository/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar
/Users/markmcdonnell/.m2/repository/ring/ring-jetty-adapter/1.2.1/ring-jetty-adapter-1.2.1.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-support/1.9.13/aws-java-sdk-support-1.9.13.jar
/Users/markmcdonnell/.m2/repository/commons-fileupload/commons-fileupload/1.3/commons-fileupload-1.3.jar
/Users/markmcdonnell/.m2/repository/hiccup/hiccup/1.0.5/hiccup-1.0.5.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-elasticbeanstalk/1.9.13/aws-java-sdk-elasticbeanstalk-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/clojure/tools.reader/0.7.3/tools.reader-0.7.3.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cognitoidentity/1.9.13/aws-java-sdk-cognitoidentity-1.9.13.jar
/Users/markmcdonnell/.m2/repository/ring-refresh/ring-refresh/0.1.2/ring-refresh-0.1.2.jar
/Users/markmcdonnell/.m2/repository/org/tukaani/xz/1.5/xz-1.5.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudwatch/1.9.13/aws-java-sdk-cloudwatch-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-rds/1.9.13/aws-java-sdk-rds-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-importexport/1.9.13/aws-java-sdk-importexport-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudformation/1.9.13/aws-java-sdk-cloudformation-1.9.13.jar
/Users/markmcdonnell/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-route53/1.9.13/aws-java-sdk-route53-1.9.13.jar
/Users/markmcdonnell/.m2/repository/ring/ring/1.2.1/ring-1.2.1.jar
/Users/markmcdonnell/.m2/repository/org/clojure/tools.namespace/0.1.3/tools.namespace-0.1.3.jar
/Users/markmcdonnell/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.3.2/jackson-databind-2.3.2.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-elastictranscoder/1.9.13/aws-java-sdk-elastictranscoder-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-elasticache/1.9.13/aws-java-sdk-elasticache-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/iq80/snappy/snappy/0.3/snappy-0.3.jar
/Users/markmcdonnell/.m2/repository/ring/ring-devel/1.2.1/ring-devel-1.2.1.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-kms/1.9.13/aws-java-sdk-kms-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-emr/1.9.13/aws-java-sdk-emr-1.9.13.jar
/Users/markmcdonnell/.m2/repository/clout/clout/1.1.0/clout-1.1.0.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudwatchmetrics/1.9.13/aws-java-sdk-cloudwatchmetrics-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/clojure/tools.nrepl/0.2.6/tools.nrepl-0.2.6.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-elasticloadbalancing/1.9.13/aws-java-sdk-elasticloadbalancing-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-iam/1.9.13/aws-java-sdk-iam-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-datapipeline/1.9.13/aws-java-sdk-datapipeline-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/orbit/javax.servlet/2.5.0.v201103041518/javax.servlet-2.5.0.v201103041518.jar
/Users/markmcdonnell/.m2/repository/org/clojure/clojure/1.6.0/clojure-1.6.0.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-sns/1.9.13/aws-java-sdk-sns-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudtrail/1.9.13/aws-java-sdk-cloudtrail-1.9.13.jar
/Users/markmcdonnell/.m2/repository/environ/environ/1.0.0/environ-1.0.0.jar
/Users/markmcdonnell/.m2/repository/net/jpountz/lz4/lz4/1.2.0/lz4-1.2.0.jar
/Users/markmcdonnell/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.3.2/jackson-core-2.3.2.jar
/Users/markmcdonnell/.m2/repository/compojure/compojure/1.1.6/compojure-1.1.6.jar
/Users/markmcdonnell/.m2/repository/ring-server/ring-server/0.3.1/ring-server-0.3.1.jar
/Users/markmcdonnell/.m2/repository/com/taoensso/nippy/2.7.0/nippy-2.7.0.jar
/Users/markmcdonnell/.m2/repository/amazonica/amazonica/0.3.13/amazonica-0.3.13.jar
/Users/markmcdonnell/.m2/repository/ring/ring-core/1.2.1/ring-core-1.2.1.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-io/7.6.8.v20121106/jetty-io-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-http/7.6.8.v20121106/jetty-http-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/org/clojure/core.incubator/0.1.0/core.incubator-0.1.0.jar
/Users/markmcdonnell/.m2/repository/com/taoensso/encore/1.11.2/encore-1.11.2.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cognitosync/1.9.13/aws-java-sdk-cognitosync-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.3.0/jackson-annotations-2.3.0.jar
UPDATE 2:
/Users/markmcdonnell/.m2
└── repository
├── amazonica
├── ant
├── antlr
├── aopalliance
├── args4j
├── asm
├── bbc
├── bidi
├── bouncycastle
├── ch
├── cheshire
├── circleci
├── classworlds
├── clj-stacktrace
├── clj-time
├── clojure-complete
├── clout
├── co
├── com
├── commons-beanutils
├── commons-cli
├── commons-codec
├── commons-collections
├── commons-digester
├── commons-discovery
├── commons-el
├── commons-fileupload
├── commons-httpclient
├── commons-io
├── commons-jelly
├── commons-jexl
├── commons-lang
├── commons-logging
├── commons-net
├── commons-validator
├── compojure
├── compojure-app
├── crypto-equality
├── crypto-random
├── de
├── dom4j
├── dotenv
├── doxia
├── environ
├── findbugs
├── geronimo-spec
├── hiccup
├── http-kit
├── instaparse
├── jackmorrill
├── javax
├── jaxen
├── jdom
├── jfree
├── jline
├── joda-time
├── junit
├── juxt
├── lein-dotenv
├── lein-environ
├── lein-ring
├── leinjacker
├── local
├── log4j
├── medley
├── modular
├── mx4j
├── nekohtml
├── net
├── ns-tracker
├── org
├── oro
├── pathetic
├── plexus
├── potemkin
├── prismatic
├── qdox
├── ring
├── ring-mock
├── ring-refresh
├── ring-server
├── robert
├── spurious-aws-sdk-helper
├── stax
├── thneed
├── tigris
├── trammel
├── velocity
├── watchtower
├── xalan
├── xerces
├── xml-apis
├── xom
└── xpp3
95 directories, 0 files
UPDATE 3: lein with-profile +dev classpath
/Users/markmcdonnell/Code/spurious-clojure-example/test
/Users/markmcdonnell/Code/spurious-clojure-example/src
/Users/markmcdonnell/Code/spurious-clojure-example/dev-resources
/Users/markmcdonnell/Code/spurious-clojure-example/resources
/Users/markmcdonnell/Code/spurious-clojure-example/target/classes
/Users/markmcdonnell/.m2/repository/ns-tracker/ns-tracker/0.2.1/ns-tracker-0.2.1.jar
/Users/markmcdonnell/.m2/repository/org/clojure/tools.macro/0.1.0/tools.macro-0.1.0.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-sqs/1.9.13/aws-java-sdk-sqs-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-s3/1.9.13/aws-java-sdk-s3-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-dynamodb/1.9.13/aws-java-sdk-dynamodb-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-swf-libraries/1.9.13/aws-java-sdk-swf-libraries-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/clojure/algo.generic/0.1.2/algo.generic-0.1.2.jar
/Users/markmcdonnell/.m2/repository/org/clojure/java.classpath/0.2.0/java.classpath-0.2.0.jar
/Users/markmcdonnell/.m2/repository/watchtower/watchtower/0.1.1/watchtower-0.1.1.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-config/1.9.13/aws-java-sdk-config-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-redshift/1.9.13/aws-java-sdk-redshift-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar
/Users/markmcdonnell/.m2/repository/clojure-complete/clojure-complete/0.2.3/clojure-complete-0.2.3.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-glacier/1.9.13/aws-java-sdk-glacier-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk/1.9.13/aws-java-sdk-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-directconnect/1.9.13/aws-java-sdk-directconnect-1.9.13.jar
/Users/markmcdonnell/.m2/repository/ring/ring-codec/1.0.0/ring-codec-1.0.0.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-server/7.6.8.v20121106/jetty-server-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/joda-time/joda-time/2.2/joda-time-2.2.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-ec2/1.9.13/aws-java-sdk-ec2-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-continuation/7.6.8.v20121106/jetty-continuation-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-lambda/1.9.13/aws-java-sdk-lambda-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-storagegateway/1.9.13/aws-java-sdk-storagegateway-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-ses/1.9.13/aws-java-sdk-ses-1.9.13.jar
/Users/markmcdonnell/.m2/repository/clj-stacktrace/clj-stacktrace/0.2.5/clj-stacktrace-0.2.5.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-opsworks/1.9.13/aws-java-sdk-opsworks-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-core/1.9.13/aws-java-sdk-core-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-util/7.6.8.v20121106/jetty-util-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/ring/ring-servlet/1.2.1/ring-servlet-1.2.1.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-simpleworkflow/1.9.13/aws-java-sdk-simpleworkflow-1.9.13.jar
/Users/markmcdonnell/.m2/repository/clj-time/clj-time/0.4.4/clj-time-0.4.4.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-logs/1.9.13/aws-java-sdk-logs-1.9.13.jar
/Users/markmcdonnell/.m2/repository/robert/hooke/1.3.0/hooke-1.3.0.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudsearch/1.9.13/aws-java-sdk-cloudsearch-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-simpledb/1.9.13/aws-java-sdk-simpledb-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudfront/1.9.13/aws-java-sdk-cloudfront-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-sts/1.9.13/aws-java-sdk-sts-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-codedeploy/1.9.13/aws-java-sdk-codedeploy-1.9.13.jar
/Users/markmcdonnell/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-kinesis/1.9.13/aws-java-sdk-kinesis-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-autoscaling/1.9.13/aws-java-sdk-autoscaling-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/amazon-kinesis-client/1.1.0/amazon-kinesis-client-1.1.0.jar
/Users/markmcdonnell/.m2/repository/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar
/Users/markmcdonnell/.m2/repository/ring/ring-jetty-adapter/1.2.1/ring-jetty-adapter-1.2.1.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-support/1.9.13/aws-java-sdk-support-1.9.13.jar
/Users/markmcdonnell/.m2/repository/commons-fileupload/commons-fileupload/1.3/commons-fileupload-1.3.jar
/Users/markmcdonnell/.m2/repository/hiccup/hiccup/1.0.5/hiccup-1.0.5.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-elasticbeanstalk/1.9.13/aws-java-sdk-elasticbeanstalk-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/clojure/tools.reader/0.7.3/tools.reader-0.7.3.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cognitoidentity/1.9.13/aws-java-sdk-cognitoidentity-1.9.13.jar
/Users/markmcdonnell/.m2/repository/ring-refresh/ring-refresh/0.1.2/ring-refresh-0.1.2.jar
/Users/markmcdonnell/.m2/repository/org/tukaani/xz/1.5/xz-1.5.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudwatch/1.9.13/aws-java-sdk-cloudwatch-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-rds/1.9.13/aws-java-sdk-rds-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-importexport/1.9.13/aws-java-sdk-importexport-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudformation/1.9.13/aws-java-sdk-cloudformation-1.9.13.jar
/Users/markmcdonnell/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-route53/1.9.13/aws-java-sdk-route53-1.9.13.jar
/Users/markmcdonnell/.m2/repository/ring/ring/1.2.1/ring-1.2.1.jar
/Users/markmcdonnell/.m2/repository/org/clojure/tools.namespace/0.1.3/tools.namespace-0.1.3.jar
/Users/markmcdonnell/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.3.2/jackson-databind-2.3.2.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-elastictranscoder/1.9.13/aws-java-sdk-elastictranscoder-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-elasticache/1.9.13/aws-java-sdk-elasticache-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/iq80/snappy/snappy/0.3/snappy-0.3.jar
/Users/markmcdonnell/.m2/repository/ring/ring-devel/1.2.1/ring-devel-1.2.1.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-kms/1.9.13/aws-java-sdk-kms-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-emr/1.9.13/aws-java-sdk-emr-1.9.13.jar
/Users/markmcdonnell/.m2/repository/clout/clout/1.1.0/clout-1.1.0.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudwatchmetrics/1.9.13/aws-java-sdk-cloudwatchmetrics-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/clojure/tools.nrepl/0.2.6/tools.nrepl-0.2.6.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-elasticloadbalancing/1.9.13/aws-java-sdk-elasticloadbalancing-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-iam/1.9.13/aws-java-sdk-iam-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-datapipeline/1.9.13/aws-java-sdk-datapipeline-1.9.13.jar
/Users/markmcdonnell/.m2/repository/org/apache/httpcomponents/httpclient/4.3.3/httpclient-4.3.3.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/orbit/javax.servlet/2.5.0.v201103041518/javax.servlet-2.5.0.v201103041518.jar
/Users/markmcdonnell/.m2/repository/org/clojure/clojure/1.6.0/clojure-1.6.0.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-sns/1.9.13/aws-java-sdk-sns-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cloudtrail/1.9.13/aws-java-sdk-cloudtrail-1.9.13.jar
/Users/markmcdonnell/.m2/repository/environ/environ/1.0.0/environ-1.0.0.jar
/Users/markmcdonnell/.m2/repository/net/jpountz/lz4/lz4/1.2.0/lz4-1.2.0.jar
/Users/markmcdonnell/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.3.2/jackson-core-2.3.2.jar
/Users/markmcdonnell/.m2/repository/compojure/compojure/1.1.6/compojure-1.1.6.jar
/Users/markmcdonnell/.m2/repository/ring-server/ring-server/0.3.1/ring-server-0.3.1.jar
/Users/markmcdonnell/.m2/repository/com/taoensso/nippy/2.7.0/nippy-2.7.0.jar
/Users/markmcdonnell/.m2/repository/amazonica/amazonica/0.3.13/amazonica-0.3.13.jar
/Users/markmcdonnell/.m2/repository/ring/ring-core/1.2.1/ring-core-1.2.1.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-io/7.6.8.v20121106/jetty-io-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/org/eclipse/jetty/jetty-http/7.6.8.v20121106/jetty-http-7.6.8.v20121106.jar
/Users/markmcdonnell/.m2/repository/org/clojure/core.incubator/0.1.0/core.incubator-0.1.0.jar
/Users/markmcdonnell/.m2/repository/com/taoensso/encore/1.11.2/encore-1.11.2.jar
/Users/markmcdonnell/.m2/repository/com/amazonaws/aws-java-sdk-cognitosync/1.9.13/aws-java-sdk-cognitosync-1.9.13.jar
/Users/markmcdonnell/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.3.0/jackson-annotations-2.3.0.jar
Justin Smith from the #clojure irc channel helped me to resolve this issue.
It seems that just running lein install was enough, but the real issue was that the error I was seeing about the namespace not being found was actually misleading as there were errors within my helper library that needed to be fixed first before I could load it successfully in my example application.
The advice was to test thoroughly within the REPL (e.g. attempt to load the helper namespace within the helper's own REPL and if it doesn't work then run a linter to verify there is no issues with the code itself).
lein install is the correct approach, but you must have some inconsistency in naming or versions.
It can be helpful to show the classpath that leiningen is actually using:
lein classpath
Or with a profile (the +dev means default +dev):
lein with-profile +dev classpath
You should find the library somewhere under ~/.m2 listed in the output.
lein deps :tree is similar and you may find it easier to find the inconsistency via that.
I had essentially the same issue, could not deal with it for 1.5 days...
The solution involved:
Getting the groupid/artifactid dependancies right in all project.clj files and in the namespace declarations.
There was an unused test file in the library project that had a reference to another charting library which was not declared in the project.clj file. The project compiled and installed without this charting lib declaration. However, referencing this lib using the local repo did not work until I removed this test file (or included the needed charting lib dependency in its project.clj)
I had to remove both of these manual local repository declarations from project.clj files:
:local-repo "file:/home/atmamta/.m2/repository/"
:repositories [["local" "file:/home/atmamta/.m2/repository/"]]
Uninstalled cider snapshot version and its dependent emacs libraries, reinstalled them using the latest stable versions, and modified my ~/.lein/profiles.clj to reflect these changes.
I.e. I changed the [cider/cider-nrepl "SNAPSHOT-x.y.z"] line to [cider/cider-nrepl "0.8.2"] in {:user {:plugins ...}} in file ~/.lein/profiles.clj
Important: cider version has to be the same as cider-nrepl version.