<div dir="ltr">Hi all <br><br>Thank you for the responses. <div><br>@Keith<br><br>> <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Looks like your PKG_LIBS arguments are ignored/overwritten on the Mac build; ‘bambi.so’ appears to be missing objects contained in -lbamdb, hence the load error.</span><br style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br>Yes, it's odd.<br><div><br></div><div>@Dirk <br><br>> <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Are the libraries installed on the macOS box? <span> </span></span><br><br></div><div><br>When I build bamdb, CMake checks for the required, which corresponds to what I see<br><br><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><a href="https://github.com/d-lo/bamdb">https://github.com/d-lo/bamdb</a></span><br><br></div><div>```<br>




<span></span>





<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">-- Detecting CXX compile features - done</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">-- Found CK<span class="gmail-Apple-converted-space"> </span></span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">-- Found ZLIB: /usr/local/lib/libz.dylib (found version "1.2.11")<span class="gmail-Apple-converted-space"> </span></span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">-- Found HTSlib<span class="gmail-Apple-converted-space"> </span></span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">-- Found LMDB<span class="gmail-Apple-converted-space"> </span></span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">-- Configuring done</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">-- Generating done</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">-- Build files have been written to: /Users/ebiederstedt/bamdb/build</span></p>


<br>```<br>With `sudo make install`, I think `bamdb` should be accessible via `-lbamdb`<br><br>```<br>




<span></span>





<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">$ sudo make install</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">Password:</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[ 50%] Built target bamdb</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">[100%] Built target libbamdb</span></p>
<p class="gmail-p2" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(51,187,200);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">Install the project...</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">-- Install configuration: ""</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">-- Installing: /usr/local/bin/bamdb</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">-- Up-to-date: /usr/local/include/bamdb</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">-- Up-to-date: /usr/local/include/bamdb/bam_api.h</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">-- Up-to-date: /usr/local/include/bamdb/bam_lmdb.h</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">-- Up-to-date: /usr/local/include/bamdb/bamdb.h</span></p>
<p class="gmail-p1" style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">-- Installing: /usr/local/lib/libbamdb.dylib</span></p>


```<br><br>It's very odd these PKG_LIBS are ignored though....<br><br>> <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Could you compile and link a </span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">trivial test program against them?<br></span><br>I think this is the next step...<br><br>@Ralf<br><br>> <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">You can change the used compiler for *your* system via </span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">~/.R/Makevars, though. From my point of view that is a (short-time) </span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">workaround only. You have to figure out why clang does not like your </span><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">package/library.<br><br>I've yet to test changing the compiler in ~/.R/Makevars. However, it's not clear to me why this would be a short-term solution. Could you clarify why using g++ instead of clang would be a problem gong forwards?<br><br><br><br><br><br></span></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 30, 2018 at 11:27 AM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
On 30 April 2018 at 06:48, Evan Biederstedt wrote:<br>
| Dear list<br>
| <br>
| I have the following R package which is interacting with a C library via<br>
| Rcpp and extern. At some point, the goal is to combine these....but I'm<br>
| trying this with baby steps.<br>
| <br>
| R package with C++ wrapper:<br>
| <a href="https://github.com/d-lo/bambi" rel="noreferrer" target="_blank">https://github.com/d-lo/bambi</a><br>
<br>
</span>Ok, so src/Makevars wants three libraries:<br>
<br>
   PKG_LIBS= -lbamdb -llmdb -lhts<br>
<span class=""><br>
| <br>
| The C library:<br>
| <a href="https://github.com/d-lo/bamdb" rel="noreferrer" target="_blank">https://github.com/d-lo/bamdb</a><br>
| <br>
| When I try to install the R package on Linux, the Makevars appears use the<br>
| compiler g++, and it installs correctly:<br>
| <br>
| <br>
| ```<br>
| Installing package into '/home/username/R/x86_64-pc-<wbr>linux-gnu-library/3.2'<br>
| (as 'lib' is unspecified)<br>
| * installing *source* package 'bambi' ...<br>
| ** libs<br>
| g++ -std=c++11 -I/usr/share/R/include -DNDEBUG -I../inst/include/<br>
| -I"/usr/lib/R/site-library/<wbr>Rcpp/include"   -fpic  -g -O2<br>
| -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time<br>
| -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o<br>
| g++ -std=c++11 -I/usr/share/R/include -DNDEBUG -I../inst/include/<br>
| -I"/usr/lib/R/site-library/<wbr>Rcpp/include"   -fpic  -g -O2<br>
| -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time<br>
| -D_FORTIFY_SOURCE=2 -g -c bambi.cpp -o bambi.o<br>
| g++ -std=c++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions<br>
| -Wl,-z,relro -o bambi.so RcppExports.o bambi.o -lbamdb -llmdb -lhts<br>
| -L/usr/lib/R/lib -lR<br>
<br>
</span>and here we get them as libbamdb.so, liblmdb.so, libhts.so are all system<br>
level libraries and (I guess) 'sudo ldconfig -p' shows them. Linking works,<br>
and they are found as the package loads.<br>
<div><div class="h5"><br>
| installing to /home/username/R/x86_64-pc-<wbr>linux-gnu-library/3.2/bambi/<wbr>libs<br>
| ** R<br>
| ** preparing package for lazy loading<br>
| ** help<br>
| *** installing help indices<br>
| ** building package indices<br>
| ** testing if installed package can be loaded<br>
| * DONE (bambi)<br>
| > library(bambi)<br>
| ```<br>
| <br>
| Here's what I see when I do the same on Mac OS. It uses clang++, and has<br>
| entirely different build commands:<br>
| <br>
| ```<br>
| <br>
| * installing to library<br>
| ‘/Library/Frameworks/R.<wbr>framework/Versions/3.4/<wbr>Resources/library’<br>
| <br>
| * installing *source* package ‘bambi’ ...<br>
| <br>
| ** libs<br>
| <br>
| clang++  -I/Library/Frameworks/R.<wbr>framework/Resources/include -DNDEBUG<br>
| -I"/Library/Frameworks/R.<wbr>framework/Versions/3.4/<wbr>Resources/library/Rcpp/<wbr>include"<br>
| -I/usr/local/include   -fPIC  -Wall -g -O2  -c RcppExports.cpp -o<br>
| RcppExports.o<br>
| <br>
| clang++  -I/Library/Frameworks/R.<wbr>framework/Resources/include -DNDEBUG<br>
| -I"/Library/Frameworks/R.<wbr>framework/Versions/3.4/<wbr>Resources/library/Rcpp/<wbr>include"<br>
| -I/usr/local/include   -fPIC  -Wall -g -O2  -c bambi.cpp -o bambi.o<br>
| <br>
| clang++  -I/Library/Frameworks/R.<wbr>framework/Resources/include -DNDEBUG<br>
| -I"/Library/Frameworks/R.<wbr>framework/Versions/3.4/<wbr>Resources/library/Rcpp/<wbr>include"<br>
| -I/usr/local/include   -fPIC  -Wall -g -O2  -c rcpp_hello_world.cpp -o<br>
| rcpp_hello_world.o<br>
| <br>
| clang++ -dynamiclib -Wl,-headerpad_max_install_<wbr>names -undefined<br>
| dynamic_lookup -single_module -multiply_defined suppress<br>
| -L/Library/Frameworks/R.<wbr>framework/Resources/lib -L/usr/local/lib -o<br>
| bambi.so RcppExports.o bambi.o rcpp_hello_world.o<br>
| -F/Library/Frameworks/R.<wbr>framework/.. -framework R -Wl,-framework<br>
| -Wl,CoreFoundation<br>
<br>
</div></div>I think they should show up here too, but they do not. <br>
<br>
Are the libraries installed on the macOS box?  Could you compile and link a<br>
trivial test program against them?<br>
<br>
Dirk<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
| installing to<br>
| /Library/Frameworks/R.<wbr>framework/Versions/3.4/<wbr>Resources/library/bambi/libs<br>
| <br>
| ** R<br>
| <br>
| ** preparing package for lazy loading<br>
| <br>
| ** help<br>
| <br>
| *** installing help indices<br>
| <br>
| ** building package indices<br>
| <br>
| ** testing if installed package can be loaded<br>
| <br>
| Error: package or namespace load failed for ‘bambi’ in dyn.load(file,<br>
| DLLpath = DLLpath, ...):<br>
| <br>
|  unable to load shared object<br>
| '/Library/Frameworks/R.<wbr>framework/Versions/3.4/<wbr>Resources/library/bambi/libs/<wbr>bambi.so':<br>
| <br>
|   dlopen(/Library/Frameworks/R.<wbr>framework/Versions/3.4/<wbr>Resources/library/bambi/libs/<wbr>bambi.so,<br>
| 6): Symbol not found: _get_bam_rows<br>
| <br>
|   Referenced from:<br>
| /Library/Frameworks/R.<wbr>framework/Versions/3.4/<wbr>Resources/library/bambi/libs/<wbr>bambi.so<br>
| <br>
|   Expected in: flat namespace<br>
| <br>
|  in<br>
| /Library/Frameworks/R.<wbr>framework/Versions/3.4/<wbr>Resources/library/bambi/libs/<wbr>bambi.so<br>
| <br>
| Error: loading failed<br>
| <br>
| Execution halted<br>
| <br>
| ERROR: loading failed<br>
| <br>
| * removing<br>
| ‘/Library/Frameworks/R.<wbr>framework/Versions/3.4/<wbr>Resources/library/bambi’<br>
| <br>
| ```<br>
| <br>
| Why is there this discrepancy? How do I direct the Makevars to use g++ and<br>
| give me the "correct" build as I see on Linux? `CXX=g++` or<br>
| `CXX=/usr/local/bin/g++` doesn't appear to work.<br>
</div></div><div class="HOEnZb"><div class="h5">| ______________________________<wbr>_________________<br>
| Rcpp-devel mailing list<br>
| <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-<wbr>project.org</a><br>
| <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" rel="noreferrer" target="_blank">https://lists.r-forge.r-<wbr>project.org/cgi-bin/mailman/<wbr>listinfo/rcpp-devel</a><br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">-- <br>
<a href="http://dirk.eddelbuettel.com" rel="noreferrer" target="_blank">http://dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a><br>
</font></span></blockquote></div><br></div>