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

NetBSD: setenv() missing #1230

Closed
0-wiz-0 opened this issue Jan 26, 2024 · 1 comment
Closed

NetBSD: setenv() missing #1230

0-wiz-0 opened this issue Jan 26, 2024 · 1 comment
Labels

Comments

@0-wiz-0
Copy link
Contributor

0-wiz-0 commented Jan 26, 2024

When building geeqie 2.2 on NetBSD, it fails with:

../src/exif-common.cc:780:3: error: 'setenv' was not declared in this scope; did you mean 'getenv'?

The problem here is that NetBSD (as Solaris, but different from e.g. Linux) removes symbols from headers when particular environments (like POSIX, or X/OPEN) are requested, and the file exif-common.cc defines _XOPEN_SOURCE (without a value) before including cstdlib.

The following patch fixes the problem on NetBSD:

--- src/exif-common.cc.orig     2024-01-26 13:57:52.740080922 +0000
+++ src/exif-common.cc
@@ -19,7 +19,7 @@
 
 #include <config.h>
 
-#define _XOPEN_SOURCE
+//#define _XOPEN_SOURCE
 
 #include <cmath>
 #include <cstdlib>

but I don't know why the symbol was defined in the first place and I expect there will be trouble on some other system.

If you know why it's set, you could limit the define to that system, e.g.

#ifdef __linux__ 
#define _XOPEN_SOURCE
#endif

which I think would be preferable.
If that's not an option, we could at least disable it on NetBSD:

#ifndef __NetBSD__
#define _XOPEN_SOURCE
#endif

Let me know what you think and I can prepare a PR - or just fix it :)

@0-wiz-0 0-wiz-0 added the bug label Jan 26, 2024
@caclark
Copy link
Collaborator

caclark commented Jan 28, 2024

The original commit had the comment:
Unifying the datetime output
The output of %date% and %formatted.DateTime% should be equivalent.

But I have no idea....

#ifdef linux
#define _XOPEN_SOURCE
#endif

looks to be a safe option.

0-wiz-0 added a commit to 0-wiz-0/geeqie that referenced this issue Jan 28, 2024
The definition breaks the build on NetBSD where it hides symbols
(to match what the standard says).

Fixes BestImageViewer#1230.
@mowgli mowgli closed this as completed in 87ff30b Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants